[virt-tools-list] [PATCH 2/5] Share the list of all disk image formats

Cédric Bosdonnat cbosdonnat at suse.com
Fri Jan 24 10:40:09 UTC 2014


---
 virtManager/fsdetails.py     | 4 ++--
 virtinst/devicefilesystem.py | 3 ---
 virtinst/storage.py          | 7 +++++--
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/virtManager/fsdetails.py b/virtManager/fsdetails.py
index e3895cf..0d32611 100644
--- a/virtManager/fsdetails.py
+++ b/virtManager/fsdetails.py
@@ -24,7 +24,7 @@ from gi.repository import Gtk
 from gi.repository import GObject
 # pylint: enable=E0611
 
-from virtinst import VirtualFilesystem
+from virtinst import VirtualFilesystem, StorageVolume
 from virtinst import util
 from virtManager import uihelpers
 from virtManager.baseclass import vmmGObjectUI
@@ -122,7 +122,7 @@ class vmmFSDetails(vmmGObjectUI):
             simple_store_set("fs-driver-combo", [VirtualFilesystem.DRIVER_LOOP,
                                                  VirtualFilesystem.DRIVER_NBD,
                                                  VirtualFilesystem.DRIVER_DEFAULT])
-        simple_store_set("fs-format-combo", VirtualFilesystem.NBD_FORMATS)
+        simple_store_set("fs-format-combo", StorageVolume.ALL_FORMATS),
         simple_store_set("fs-wrpolicy-combo", VirtualFilesystem.WRPOLICIES)
         self.show_pair_combo("fs-type", self.conn.is_openvz() or self.conn.is_lxc())
         self.show_check_button("fs-readonly",
diff --git a/virtinst/devicefilesystem.py b/virtinst/devicefilesystem.py
index 2b1b0ba..f516fed 100644
--- a/virtinst/devicefilesystem.py
+++ b/virtinst/devicefilesystem.py
@@ -51,9 +51,6 @@ class VirtualFilesystem(VirtualDevice):
     DRIVER_DEFAULT = "default"
     DRIVERS = [DRIVER_PATH, DRIVER_HANDLE, DRIVER_LOOP, DRIVER_NBD, DRIVER_DEFAULT]
 
-    NBD_FORMATS = ["raw", "bochs", "cloop", "cow", "dmg", "iso", "qcow",
-                   "qcow2", "qed", "vmdk", "vpc", "fat", "vhd", "vdi"]
-
     @staticmethod
     def type_to_source_prop(fs_type):
         """
diff --git a/virtinst/storage.py b/virtinst/storage.py
index fac816d..8529863 100644
--- a/virtinst/storage.py
+++ b/virtinst/storage.py
@@ -460,6 +460,10 @@ class StorageVolume(_StorageObject):
     """
     Base class for building and installing libvirt storage volume xml
     """
+    
+    ALL_FORMATS = ["raw", "bochs", "cloop", "cow", "dmg", "iso", "qcow",
+                   "qcow2", "qed", "vmdk", "vpc", "fat", "vhd", "vdi"]
+
     @staticmethod
     def find_free_name(pool_object, basename, **kwargs):
         """
@@ -608,8 +612,7 @@ class StorageVolume(_StorageObject):
 
     def list_formats(self):
         if self.file_type == self.TYPE_FILE:
-            return ["raw", "bochs", "cloop", "cow", "dmg", "iso", "qcow",
-                    "qcow2", "qed", "vmdk", "vpc", "vdi"]
+            return ALL_FORMATS
         return []
 
     def list_create_formats(self):
-- 
1.8.5.2




More information about the virt-tools-list mailing list