diff options
author | Cole Robinson <crobinso@redhat.com> | 2022-01-19 14:19:56 -0500 |
---|---|---|
committer | Cole Robinson <crobinso@redhat.com> | 2022-01-19 14:21:48 -0500 |
commit | 9e133de21af7368c64f1fc651207ac48b82770f2 (patch) | |
tree | c060c0981913be4871c4c95e2560b9c8b3db8833 | |
parent | 2676640979f929a1d439d91fab1c13dc41a6adf0 (diff) | |
download | virt-manager-9e133de21af7368c64f1fc651207ac48b82770f2.tar.gz |
diskbackend: Restrict format->driver_type even more
We should only be returning a driver_type value for volumes that
report support_format(), meaning they support file type formats like
qcow2. Any other reported format should be ignored
Dropping the check for 'unknown' value changes one test case a bit,
but it hardcodes raw which is what libvirt gives us anyways, so it's
okay
Signed-off-by: Cole Robinson <crobinso@redhat.com>
-rw-r--r-- | tests/data/cli/compare/virt-install-many-devices.xml | 2 | ||||
-rw-r--r-- | virtinst/diskbackend.py | 9 |
2 files changed, 4 insertions, 7 deletions
diff --git a/tests/data/cli/compare/virt-install-many-devices.xml b/tests/data/cli/compare/virt-install-many-devices.xml index f68ae2c2..438c5375 100644 --- a/tests/data/cli/compare/virt-install-many-devices.xml +++ b/tests/data/cli/compare/virt-install-many-devices.xml @@ -206,7 +206,7 @@ <target dev="sdae" bus="scsi" rotation_rate="6000"/> </disk> <disk type="network" device="disk"> - <driver name="qemu"/> + <driver name="qemu" type="raw"/> <source protocol="iscsi" name="iqn.2017-12.com.virttest:emulated-iscsi-noauth.target2-lun-1"> <host name="10.66.144.87"/> </source> diff --git a/virtinst/diskbackend.py b/virtinst/diskbackend.py index eaa9d2f6..0c0620cf 100644 --- a/virtinst/diskbackend.py +++ b/virtinst/diskbackend.py @@ -787,12 +787,9 @@ class StorageBackend(_StorageBase): def get_driver_type(self): if self._vol_object: - if self.get_parent_pool_xml().type != "disk": - ret = self.get_vol_xml().format - if ret != "unknown": - return ret - else: - return "raw" + if self.get_vol_xml().supports_format(): + return self.get_vol_xml().format + return "raw" return None def validate(self): |