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>
This commit is contained in:
Cole Robinson 2022-01-19 14:19:56 -05:00
parent 2676640979
commit 9e133de21a
2 changed files with 4 additions and 7 deletions

View File

@ -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>

View File

@ -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):