Просмотр исходного кода

Removes target disk on failed convert_disk_format

Alessandro Pilotti 9 лет назад
Родитель
Сommit
be316afd9f
1 измененных файлов с 5 добавлено и 1 удалено
  1. 5 1
      coriolis/utils.py

+ 5 - 1
coriolis/utils.py

@@ -225,7 +225,11 @@ def convert_disk_format(disk_path, target_disk_path, target_format,
             allocation_args +
             allocation_args +
             [disk_path, target_disk_path])
             [disk_path, target_disk_path])
 
 
-    exec_process(args)
+    try:
+        exec_process(args)
+    except Exception:
+        ignore_exceptions(os.remove)(target_disk_path)
+        raise
 
 
 
 
 def get_hostname():
 def get_hostname():