Use .qcow2 extension when creating qcow2 files
Seems the be the practice these days
This commit is contained in:
parent
4e4fb15a2f
commit
6f93d3decf
|
@ -67,8 +67,9 @@ class vmmAddStorage(vmmGObjectUI):
|
|||
|
||||
def _get_ideal_path_info(self, name):
|
||||
path = self._get_default_dir()
|
||||
suffix = ".img"
|
||||
return (path, name, suffix)
|
||||
fmt = self.conn.get_default_storage_format()
|
||||
suffix = virtinst.StorageVolume.get_file_extension_for_format(fmt)
|
||||
return (path, name, suffix or ".img")
|
||||
|
||||
def _get_ideal_path(self, name):
|
||||
target, name, suffix = self._get_ideal_path_info(name)
|
||||
|
|
|
@ -113,10 +113,10 @@ class vmmCreateVolume(vmmGObjectUI):
|
|||
return ret
|
||||
|
||||
def default_suffix(self):
|
||||
suffix = ""
|
||||
if self.vol.file_type == self.vol.TYPE_FILE:
|
||||
suffix = ".img"
|
||||
return suffix
|
||||
if self.vol.file_type != self.vol.TYPE_FILE:
|
||||
return ""
|
||||
return StorageVolume.get_file_extension_for_format(
|
||||
self.get_config_format())
|
||||
|
||||
def _init_state(self):
|
||||
blue = Gdk.color_parse("#0072A8")
|
||||
|
@ -255,6 +255,7 @@ class vmmCreateVolume(vmmGObjectUI):
|
|||
ignore = src
|
||||
self._show_alloc()
|
||||
self._show_backing()
|
||||
self.widget("vol-name").emit("changed")
|
||||
|
||||
def browse_backing(self, src):
|
||||
ignore = src
|
||||
|
|
|
@ -1453,8 +1453,9 @@ def _parse_disk_source(guest, path, pool, vol, size, fmt, sparse):
|
|||
disk.get_vol_install().pool.name() == poolobj.name()):
|
||||
collidelist.append(os.path.basename(disk.path))
|
||||
|
||||
ext = virtinst.StorageVolume.get_file_extension_for_format(fmt)
|
||||
vname = virtinst.StorageVolume.find_free_name(
|
||||
poolobj, guest.name, suffix=".img", collidelist=collidelist)
|
||||
poolobj, guest.name, suffix=ext, collidelist=collidelist)
|
||||
|
||||
volinst = virtinst.VirtualDisk.build_vol_install(
|
||||
guest.conn, vname, poolobj, size, sparse)
|
||||
|
|
|
@ -463,6 +463,14 @@ class StorageVolume(_StorageObject):
|
|||
ALL_FORMATS = ["raw", "bochs", "cloop", "cow", "dmg", "iso", "qcow",
|
||||
"qcow2", "qed", "vmdk", "vpc", "fat", "vhd", "vdi"]
|
||||
|
||||
@staticmethod
|
||||
def get_file_extension_for_format(fmt):
|
||||
if not fmt:
|
||||
return ""
|
||||
if fmt == "raw":
|
||||
return ".img"
|
||||
return "." + fmt
|
||||
|
||||
@staticmethod
|
||||
def find_free_name(pool_object, basename, **kwargs):
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue