[libvirt] [PATCHv2 2/2] conf: Swap order of AddImplicitControllers and DomainDefPostParse

Viktor Mihajlovski mihajlov at linux.vnet.ibm.com
Mon Jun 17 14:17:37 UTC 2013


Implicit controllers may be dependent on device definitions altered
in a post-parse callback. Specifically, if a console device is
defined without the target type, the type will be set in QEMU's
callback. In the case of s390, this is virtio, which requires
an implicit virtio-serial controller.

Signed-off-by: Viktor Mihajlovski <mihajlov at linux.vnet.ibm.com>
---
 src/conf/domain_conf.c                             |    8 ++++----
 .../qemuxml2xmlout-balloon-device-auto.xml         |    2 +-
 .../qemuxml2xmlout-channel-virtio-auto.xml         |    2 +-
 .../qemuxml2xmlout-console-virtio.xml              |    2 +-
 .../qemuxml2xmlout-disk-scsi-device-auto.xml       |    2 +-
 5 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 2373397..a5c2315 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -12058,14 +12058,14 @@ virDomainDefParseXML(xmlDocPtr xml,
         (def->ns.parse)(xml, root, ctxt, &def->namespaceData) < 0)
         goto error;
 
-    /* Auto-add any implied controllers which aren't present */
-    if (virDomainDefAddImplicitControllers(def) < 0)
-        goto error;
-
     /* callback to fill driver specific domain aspects */
     if (virDomainDefPostParse(def, caps, xmlopt) < 0)
         goto error;
 
+    /* Auto-add any implied controllers which aren't present */
+    if (virDomainDefAddImplicitControllers(def) < 0)
+        goto error;
+
     virHashFree(bootHash);
 
     return def;
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-balloon-device-auto.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-balloon-device-auto.xml
index 6aed326..380b70f 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-balloon-device-auto.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-balloon-device-auto.xml
@@ -20,8 +20,8 @@
       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
     </disk>
     <controller type='usb' index='0'/>
-    <controller type='ide' index='0'/>
     <controller type='pci' index='0' model='pci-root'/>
+    <controller type='ide' index='0'/>
     <memballoon model='virtio'/>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-channel-virtio-auto.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-channel-virtio-auto.xml
index 0175272..fd6b852 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-channel-virtio-auto.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-channel-virtio-auto.xml
@@ -25,8 +25,8 @@
     <controller type='virtio-serial' index='1'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
     </controller>
-    <controller type='virtio-serial' index='2'/>
     <controller type='pci' index='0' model='pci-root'/>
+    <controller type='virtio-serial' index='2'/>
     <channel type='pty'>
       <target type='virtio' name='org.linux-kvm.port.0'/>
       <address type='virtio-serial' controller='0' bus='0' port='1'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-virtio.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-virtio.xml
index 3c865c3..340430e 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-virtio.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-virtio.xml
@@ -21,8 +21,8 @@
     </disk>
     <controller type='usb' index='0'/>
     <controller type='ide' index='0'/>
-    <controller type='virtio-serial' index='0'/>
     <controller type='pci' index='0' model='pci-root'/>
+    <controller type='virtio-serial' index='0'/>
     <console type='pty'>
       <target type='virtio' port='0'/>
     </console>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-device-auto.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-device-auto.xml
index 7d152bc..5ec1e94 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-device-auto.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-scsi-device-auto.xml
@@ -26,8 +26,8 @@
     </disk>
     <controller type='usb' index='0'/>
     <controller type='ide' index='0'/>
-    <controller type='scsi' index='0'/>
     <controller type='pci' index='0' model='pci-root'/>
+    <controller type='scsi' index='0'/>
     <memballoon model='virtio'/>
   </devices>
 </domain>
-- 
1.7.9.5




More information about the libvir-list mailing list