mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 18:55:27 -06:00
virt-manager: Default to qcow2 on kvm
qcow2 enables fancy features like snapshots and is generally more desktopy, which we purport to be. We only do this on not horribly old libvirt/qemu, and only on qemu connections. This may work for xen but I'm not going to turn it on until someone tests it.
This commit is contained in:
parent
1294965aa3
commit
9194feb1f5
@ -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()):
|
||||
|
@ -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"
|
||||
|
@ -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 #
|
||||
|
@ -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()):
|
||||
|
@ -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)
|
||||
|
@ -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):
|
||||
|
@ -325,7 +325,11 @@ SUPPORT_CONN_LISTALLDEVICES = _make(function="virConnect.listAllDevices",
|
||||
SUPPORT_CONN_VIRTIO_MMIO = _make(version=1001002,
|
||||
drv_version=[("qemu", 1006000)])
|
||||
SUPPORT_CONN_DISK_SD = _make(version=1001002)
|
||||
|
||||
# This is an arbitrary check to say whether it's a good idea to
|
||||
# default to qcow2. It might be fine for xen or qemu older than the versions
|
||||
# here, but until someone tests things I'm going to be a bit conservative.
|
||||
SUPPORT_CONN_DEFAULT_QCOW2 = _make(
|
||||
version=8000, drv_version=[("qemu", 1002000), ("test", 0)])
|
||||
|
||||
# Domain checks
|
||||
SUPPORT_DOMAIN_GETVCPUS = _make(function="virDomain.vcpus", args=())
|
||||
|
Loading…
Reference in New Issue
Block a user