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
This commit is contained in:
parent
8cf2228ea1
commit
b97e409dfd
@ -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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user