[virt-tools-list] [PATCH] virt-manager generates invalid guest XML

Seeteena Thoufeek s1seetee at linux.vnet.ibm.com
Mon Dec 12 12:18:50 UTC 2016


The virt-manager application generates invalid guest XML when a
 spapr-vio SCSI model controller is changed to a virtio-scsi model controller.

1. Create a guest
2. Add an spapr-vio controller to the guest via this gui path:
->Add Hardware
->Controller
->Type SCSI
->Model Hypervisor default
At this point, there will be a valid spapr-vio SCSI controller defined:
    <controller type='scsi' index='0'>
      <address type='spapr-vio' reg='0x2000'/>
    </controller>
3.Now modify the above SCSI controller using this gui path:
->Choose "Controller sPAPR SCSI" on left pane
->Choose "VirtIO SCSI" for the Model on the right pane
->Apply
At this point, there will be a SCSI controller definition which is invalid due to an incorrect address type:
~# virsh dumpxml dotg2|grep -A2 -i scsi
    <controller type='scsi' index='0' model='virtio-scsi'>
      <address type='spapr-vio' reg='0x2000'/>
    </controller>
Any attempt to start the guest will throw this error:
error: Failed to start domain dotg2
error: internal error: process exited while connecting to monitor: 2016-12-02T17:45:12.989165Z qemu-system-ppc64le: -device virtio-scsi-pci,id=scsi0,reg=0x2000: Property '.reg' not found

virt-manager fails to realize that the address type needs to be changed to a PCI address for a virtio-scsi controller.

If you change the model, you are supposed to leave the address field empty, so that libvirt sets it correctly. Or change the address field also appropriately.

Note that this bug can be reproduced entirely within virt-manager.  No manual editing of guest XML is being done here.  So, fix is to make virt-manager delete the address field when the SCSI controller model is changed, allowing libvirt to automatically assign a new address with the correct type.

Signed-off-by: Seeteena Thoufeek <s1seetee at linux.vnet.ibm.com>
---
 virtManager/domain.py | 1 +
 1 file changed, 1 insertion(+)
diff --git a/virtManager/domain.py b/virtManager/domain.py
index 582de64..9919917 100644
--- a/virtManager/domain.py
+++ b/virtManager/domain.py
@@ -949,6 +949,7 @@ class vmmDomain(vmmLibvirtObject):
 
             else:
                 editdev.model = model
+                editdev.address.clear()
                 self.hotplug(device=editdev)
 
         if model != _SENTINEL:
-- 
1.8.3.1




More information about the virt-tools-list mailing list