KVM SR: add fallback in case of download exception.

parent 0b3ad5c2
...@@ -60,7 +60,11 @@ def getSocketStatus(host, port): ...@@ -60,7 +60,11 @@ def getSocketStatus(host, port):
# Download existing hard drive if needed at first boot # Download existing hard drive if needed at first boot
if not os.path.exists(disk_path) and virtual_hard_drive_url != '': if not os.path.exists(disk_path) and virtual_hard_drive_url != '':
print('Downloading virtual hard drive...') print('Downloading virtual hard drive...')
urllib.urlretrieve(virtual_hard_drive_url, disk_path) try:
urllib.urlretrieve(virtual_hard_drive_url, disk_path)
except:
os.remove(disk_path)
raise
md5sum = virtual_hard_drive_md5sum.strip() md5sum = virtual_hard_drive_md5sum.strip()
if md5sum: if md5sum:
print('Checking MD5 checksum...') print('Checking MD5 checksum...')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment