Przeglądaj źródła

Removes target disk on failed convert_disk_format

Alessandro Pilotti 9 lat temu
rodzic
commit
be316afd9f
1 zmienionych plików z 5 dodań i 1 usunięć
  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 +
             [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():