Implicit controllers may be dependent on device definitions altered
in a post-parse callback. E.g., 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.
By moving the implicit controller definition after the post-parse
procssing this can be fixed. OTOH the implicit controllers might
need post-parse actions as well, although I am currentyl not
aware of one.
What would speak against swapping the order as suggested in
the patch below? Feedback welcome.
Signed-off-by: Viktor Mihajlovski <mihajlov(a)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 29d6edc..ef1f876 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -12062,14 +12062,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