disk: Fix virt-xml --add-device --disk size=X

This commit is contained in:
Cole Robinson 2019-01-22 10:28:38 -05:00
parent c82042245b
commit 9b2e6886d0
3 changed files with 16 additions and 0 deletions

View File

@ -0,0 +1,13 @@
<panic>
<address type="isa" iobase="0x505"/>
</panic>
+ <disk type="file" device="disk">
+ <source file="/var/lib/libvirt/images/test-for-virtxml.qcow2"/>
+ <target dev="hdb" bus="ide"/>
+ </disk>
</devices>
<seclabel type="dynamic" model="selinux" relabel="yes"/>
</domain>
Domain 'test-for-virtxml' defined successfully.
Changes will take effect after the domain is fully powered off.

View File

@ -967,6 +967,7 @@ c.add_compare("--add-device --sound pcspk", "add-sound")
c.add_compare("--add-device --disk %(EXISTIMG1)s,bus=virtio,target=vdf", "add-disk-basic")
c.add_compare("--add-device --disk %(EXISTIMG1)s", "add-disk-notarget") # filling in acceptable target
c.add_compare("--add-device --disk %(NEWIMG1)s,size=.01", "add-disk-create-storage")
c.add_compare("--add-device --disk size=.01", "add-disk-default-storage")
c.add_compare("--remove-device --sound ich6", "remove-sound-model", check_version="1.3.5") # check_version=new graphics listen output
c.add_compare("--remove-device --disk 3", "remove-disk-index")
c.add_compare("--remove-device --disk /dev/null", "remove-disk-path")

View File

@ -413,6 +413,8 @@ class DeviceDisk(Device):
def get_vol_object(self):
return self._storage_backend.get_vol_object()
def get_vol_install(self):
if not self._storage_backend:
return None
return self._storage_backend.get_vol_install()
def get_parent_pool(self):
if self.get_vol_install():