[virt-tools-list] [PATCH virt-manager]: addhardware: don't hardcode .img when pool is not defined

Charles Arnold carnold at suse.com
Fri Jul 24 14:49:59 UTC 2015


This patch moves the call to _get_ideal_path_info earlier in
get_default_path so that the suffix returned may be used instead of the
hardcoded ".img" value in the case where a pool is undefined.

This is a follow up patch to the patch with the subject line
"reset disk image name extension to format selected".

Signed-off-by: Charles Arnold <carnold at suse.com>

--- virtManager/addstorage.py.orig	2015-07-23 17:13:03.711737816 -0600
+++ virtManager/addstorage.py	2015-07-23 17:14:17.264431491 -0600
@@ -218,15 +218,16 @@ class vmmAddStorage(vmmGObjectUI):
         def path_exists(p):
             return os.path.exists(p) or p in collidelist
 
+        target, ignore, suffix = self._get_ideal_path_info(name, fmt)
         if not pool:
             # Use old generating method
-            origf = os.path.join(default_dir, name + ".img")
+            origf = os.path.join(default_dir, name + suffix)
             f = origf
 
             n = 1
             while path_exists(f) and n < 100:
                 f = os.path.join(default_dir, name +
-                                 "-" + str(n) + ".img")
+                                 "-" + str(n) + suffix)
                 n += 1
 
             if path_exists(f):
@@ -234,8 +235,6 @@ class vmmAddStorage(vmmGObjectUI):
 
             path = f
         else:
-            target, ignore, suffix = self._get_ideal_path_info(name, fmt)
-
             # Sanitize collidelist to work with the collision checker
             newcollidelist = []
             for c in collidelist:








More information about the virt-tools-list mailing list