diff options
Diffstat (limited to 'virtManager')
-rw-r--r-- | virtManager/addhardware.py | 2 | ||||
-rw-r--r-- | virtManager/config.py | 4 | ||||
-rw-r--r-- | virtManager/connection.py | 12 | ||||
-rw-r--r-- | virtManager/create.py | 2 | ||||
-rw-r--r-- | virtManager/createvol.py | 2 | ||||
-rw-r--r-- | virtManager/preferences.py | 2 |
6 files changed, 18 insertions, 6 deletions
diff --git a/virtManager/addhardware.py b/virtManager/addhardware.py index cf0f15a7..beb15270 100644 --- a/virtManager/addhardware.py +++ b/virtManager/addhardware.py @@ -1346,7 +1346,7 @@ class vmmAddHardware(vmmGObjectUI): disk.driver_cache = cache if not fmt: - fmt = self.config.get_storage_format() + fmt = self.conn.get_default_storage_format() if (self.is_default_storage() and disk.get_vol_install() and fmt in disk.get_vol_install().list_formats()): diff --git a/virtManager/config.py b/virtManager/config.py index 3de48a0a..83e6b738 100644 --- a/virtManager/config.py +++ b/virtManager/config.py @@ -166,7 +166,7 @@ class vmmConfig(object): self.libvirt_packages = cliconfig.libvirt_packages self.askpass_package = cliconfig.askpass_package self.default_graphics_from_config = cliconfig.default_graphics - self.default_storage_format_from_config = "raw" + self.default_storage_format_from_config = "qcow2" self._objects = [] @@ -407,7 +407,7 @@ class vmmConfig(object): def set_graphics_type(self, gtype): self.conf.set("/new-vm/graphics-type", gtype.lower()) - def get_storage_format(self, raw=False): + def get_default_storage_format(self, raw=False): ret = self.conf.get("/new-vm/storage-format") if ret not in ["default", "raw", "qcow2"]: ret = "default" diff --git a/virtManager/connection.py b/virtManager/connection.py index 815499b5..5983fe38 100644 --- a/virtManager/connection.py +++ b/virtManager/connection.py @@ -319,6 +319,18 @@ class vmmConnection(vmmGObject): os.mkdir(ret, 755) return ret + def get_default_storage_format(self): + raw = self.config.get_default_storage_format(raw=True) + if raw != "default": + return raw + + fmt = self.config.get_default_storage_format() + if fmt != "qcow2": + return + + if self.check_conn_support(self._backend.SUPPORT_CONN_DEFAULT_QCOW2): + return fmt + return None #################################### # Connection pretty print routines # diff --git a/virtManager/create.py b/virtManager/create.py index 4e0c1417..bff4561f 100644 --- a/virtManager/create.py +++ b/virtManager/create.py @@ -1805,7 +1805,7 @@ class vmmCreate(vmmGObjectUI): disk.path = diskpath disk.set_create_storage(size=disksize, sparse=sparse) - fmt = self.config.get_storage_format() + fmt = self.conn.get_default_storage_format() if (self.is_default_storage() and disk.get_vol_install() and fmt in disk.get_vol_install().list_formats()): diff --git a/virtManager/createvol.py b/virtManager/createvol.py index d959cced..8b0ad879 100644 --- a/virtManager/createvol.py +++ b/virtManager/createvol.py @@ -173,7 +173,7 @@ class vmmCreateVolume(vmmGObjectUI): if hasformat: # Select the default storage format self.widget("vol-format").set_active(0) - default = self.config.get_storage_format() + default = self.conn.get_default_storage_format() for row in self.widget("vol-format").get_model(): if row[0] == default: self.widget("vol-format").set_active_iter(row.iter) diff --git a/virtManager/preferences.py b/virtManager/preferences.py index 66b87252..096c1ef8 100644 --- a/virtManager/preferences.py +++ b/virtManager/preferences.py @@ -153,7 +153,7 @@ class vmmPreferences(vmmGObjectUI): def refresh_storage_format(self): combo = self.widget("prefs-storage-format") - val = self.config.get_storage_format(raw=True) + val = self.config.get_default_storage_format(raw=True) uihelpers.set_row_selection(combo, val) def refresh_disk_poll(self): |