diff options
author | John Hua <john.hua@citrix.com> | 2015-07-27 02:34:11 +0100 |
---|---|---|
committer | John Garbutt <john@johngarbutt.com> | 2015-09-07 12:39:01 +0000 |
commit | b97e409dfd5c8635c8bf97be982bd7f3dd90752d (patch) | |
tree | 680e0fd478c69a3291ba419c914cb3e266488667 /plugins | |
parent | 8cf2228ea1a8c70c51ac1c3e862e1783e0ec1df1 (diff) | |
download | nova-b97e409dfd5c8635c8bf97be982bd7f3dd90752d.tar.gz |
xenapi: Support extra tgz images that with only a single VHD
Currently tgz images are supported only when the names of VHD files
within follow the format of "0.vhd, 1.vhd, ... (n-1).vhd" called VDI
chain.
To maximize the range of support, the arbitrary named VHD file could be
renamed to 0.vhd when the tgz image only has a single VHD file.
Change-Id: I01cadf26262b20f1ad5a19e4441b42a0155f5a52
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/xenserver/xenapi/etc/xapi.d/plugins/utils.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/plugins/xenserver/xenapi/etc/xapi.d/plugins/utils.py b/plugins/xenserver/xenapi/etc/xapi.d/plugins/utils.py index 3fde25735d..60d680ca93 100644 --- a/plugins/xenserver/xenapi/etc/xapi.d/plugins/utils.py +++ b/plugins/xenserver/xenapi/etc/xapi.d/plugins/utils.py @@ -207,6 +207,15 @@ def _handle_old_style_images(staging_path): _rename(path, os.path.join(staging_path, "%d.vhd" % file_num)) file_num += 1 + # Rename any format of name to 0.vhd when there is only single one + contents = os.listdir(staging_path) + if len(contents) == 1: + filename = contents[0] + if filename != '0.vhd' and filename.endswith('.vhd'): + _rename( + os.path.join(staging_path, filename), + os.path.join(staging_path, '0.vhd')) + def _assert_vhd_not_hidden(path): """Sanity check to ensure that only appropriate VHDs are marked as hidden. |