[libvirt] [PATCHv3 0/5] Virtio support for S390

As 0.9.13 is stabilizing and I will not be available next week I am sending this reworked patch set already today, looking forward to comments. This series adds support for the s390 flavor of virtio devices. Since the s390 virtio devices are not implemented as PCI devices it is necessary to refactor some of the device address assignment code. v2 changes resent as thread v3 changes renumbered new virtio-s390 capability fixed incorrect whitespace fixed subject lines Viktor Mihajlovski (5): qemu: Extended qemuDomainAssignAddresses to be callable from everywhere. qemu: Change tests to use (modified) qemuDomainAssignAddresses S390: Add support for virtio-s390 devices. S390: Domain Schema for s390-virtio machines. S390: Adding testcases for s390 docs/schemas/domaincommon.rng | 20 +++ src/conf/domain_conf.c | 11 +- src/conf/domain_conf.h | 1 + src/qemu/qemu_capabilities.c | 7 + src/qemu/qemu_capabilities.h | 1 + src/qemu/qemu_command.c | 139 ++++++++++++++++++-- src/qemu/qemu_command.h | 6 +- src/qemu/qemu_driver.c | 14 +- src/qemu/qemu_process.c | 42 +------ .../qemuxml2argv-console-virtio-s390.args | 9 ++ .../qemuxml2argv-console-virtio-s390.xml | 24 ++++ .../qemuxml2argv-disk-virtio-s390.args | 5 + .../qemuxml2argv-disk-virtio-s390.xml | 22 +++ .../qemuxml2argv-minimal-s390.args | 5 + .../qemuxml2argvdata/qemuxml2argv-minimal-s390.xml | 21 +++ .../qemuxml2argv-net-virtio-s390.args | 5 + .../qemuxml2argv-net-virtio-s390.xml | 22 +++ tests/qemuxml2argvtest.c | 20 ++-- tests/qemuxmlnstest.c | 13 +-- tests/testutilsqemu.c | 31 +++++ 20 files changed, 332 insertions(+), 86 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-console-virtio-s390.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-console-virtio-s390.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-s390.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-s390.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-minimal-s390.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-minimal-s390.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-net-virtio-s390.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-net-virtio-s390.xml

This is in preparation of the enablement of s390 guests with virtio devices. The assignment of device addresses happens in different places, i.e. the qemu driver and process modules as well as in the unit tests in slightly different flavors. Currently, these are PPC spapr-vio and PCI devices, virtio-s390 (not PCI based) will follow. By optionally passing to qemuDomainAssignAddresses the domain object and the capabilities it is now possible to call the function from most of the places (except for hotplug) where address assignment is done. Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com> --- src/qemu/qemu_command.c | 41 ++++++++++++++++++++++++++++++++--------- src/qemu/qemu_command.h | 6 ++++-- src/qemu/qemu_driver.c | 14 +++++++------- src/qemu/qemu_process.c | 42 ++++-------------------------------------- 4 files changed, 47 insertions(+), 56 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 6549f57..5edf915 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -942,16 +942,22 @@ cleanup: int -qemuDomainAssignPCIAddresses(virDomainDefPtr def) +qemuDomainAssignPCIAddresses(virDomainDefPtr def, virBitmapPtr qemuCaps, + virDomainObjPtr obj) { int ret = -1; - virBitmapPtr qemuCaps = NULL; + virBitmapPtr localCaps = NULL; qemuDomainPCIAddressSetPtr addrs = NULL; + qemuDomainObjPrivatePtr priv = NULL; - if (qemuCapsExtractVersionInfo(def->emulator, def->os.arch, - NULL, - &qemuCaps) < 0) - goto cleanup; + if (!qemuCaps) { + /* need to get information from real environment */ + if (qemuCapsExtractVersionInfo(def->emulator, def->os.arch, + NULL, + &localCaps) < 0) + goto cleanup; + qemuCaps = localCaps; + } if (qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { if (!(addrs = qemuDomainPCIAddressSetCreate(def))) @@ -961,16 +967,33 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def) goto cleanup; } + if (obj && obj->privateData) { + priv = obj->privateData; + if (addrs) { + /* if this is the live domain object, we persist the PCI addresses*/ + if (priv->pciaddrs) { + qemuDomainPCIAddressSetFree(priv->pciaddrs); + priv->pciaddrs = NULL; + } + priv->persistentAddrs = 1; + priv->pciaddrs = addrs; + addrs = NULL; + } else { + priv->persistentAddrs = 0; + } + } + ret = 0; cleanup: - qemuCapsFree(qemuCaps); + qemuCapsFree(localCaps); qemuDomainPCIAddressSetFree(addrs); return ret; } -int qemuDomainAssignAddresses(virDomainDefPtr def) +int qemuDomainAssignAddresses(virDomainDefPtr def, virBitmapPtr qemuCaps, + virDomainObjPtr obj) { int rc; @@ -978,7 +1001,7 @@ int qemuDomainAssignAddresses(virDomainDefPtr def) if (rc) return rc; - return qemuDomainAssignPCIAddresses(def); + return qemuDomainAssignPCIAddresses(def, qemuCaps, obj); } static void diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h index 1eafeb3..dd104d6 100644 --- a/src/qemu/qemu_command.h +++ b/src/qemu/qemu_command.h @@ -175,10 +175,12 @@ virDomainDefPtr qemuParseCommandLinePid(virCapsPtr caps, virDomainChrSourceDefPtr *monConfig, bool *monJSON); -int qemuDomainAssignAddresses(virDomainDefPtr def); +int qemuDomainAssignAddresses(virDomainDefPtr def, virBitmapPtr qemuCaps, + virDomainObjPtr); int qemuDomainAssignSpaprVIOAddresses(virDomainDefPtr def); -int qemuDomainAssignPCIAddresses(virDomainDefPtr def); +int qemuDomainAssignPCIAddresses(virDomainDefPtr def, virBitmapPtr qemuCaps, + virDomainObjPtr obj); qemuDomainPCIAddressSetPtr qemuDomainPCIAddressSetCreate(virDomainDefPtr def); int qemuDomainPCIAddressReserveFunction(qemuDomainPCIAddressSetPtr addrs, int slot, int function); diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 2f93404..ef9983c 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -1404,7 +1404,7 @@ static virDomainPtr qemudDomainCreate(virConnectPtr conn, const char *xml, if (qemudCanonicalizeMachine(driver, def) < 0) goto cleanup; - if (qemuDomainAssignAddresses(def) < 0) + if (qemuDomainAssignAddresses(def, NULL, NULL) < 0) goto cleanup; if (!(vm = virDomainAssignDef(driver->caps, @@ -5070,7 +5070,7 @@ static virDomainPtr qemudDomainDefine(virConnectPtr conn, const char *xml) { if (qemudCanonicalizeMachine(driver, def) < 0) goto cleanup; - if (qemuDomainAssignAddresses(def) < 0) + if (qemuDomainAssignAddresses(def, NULL, NULL) < 0) goto cleanup; if (!(vm = virDomainAssignDef(driver->caps, @@ -5548,7 +5548,7 @@ qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef, if (disk->bus != VIR_DOMAIN_DISK_BUS_VIRTIO) if (virDomainDefAddImplicitControllers(vmdef) < 0) return -1; - if (qemuDomainAssignAddresses(vmdef) < 0) + if (qemuDomainAssignAddresses(vmdef, NULL, NULL) < 0) return -1; break; @@ -5566,7 +5566,7 @@ qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef, return -1; } dev->data.net = NULL; - if (qemuDomainAssignAddresses(vmdef) < 0) + if (qemuDomainAssignAddresses(vmdef, NULL, NULL) < 0) return -1; break; @@ -5582,7 +5582,7 @@ qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef, return -1; } dev->data.hostdev = NULL; - if (qemuDomainAssignAddresses(vmdef) < 0) + if (qemuDomainAssignAddresses(vmdef, NULL, NULL) < 0) return -1; break; @@ -5736,7 +5736,7 @@ qemuDomainUpdateDeviceConfig(virDomainDefPtr vmdef, vmdef->nets[pos] = net; dev->data.net = NULL; - if (qemuDomainAssignAddresses(vmdef) < 0) + if (qemuDomainAssignAddresses(vmdef, NULL, NULL) < 0) return -1; break; @@ -11734,7 +11734,7 @@ static virDomainPtr qemuDomainAttach(virConnectPtr conn, if (qemudCanonicalizeMachine(driver, def) < 0) goto cleanup; - if (qemuDomainAssignAddresses(def) < 0) + if (qemuDomainAssignAddresses(def, NULL, NULL) < 0) goto cleanup; if (!(vm = virDomainAssignDef(driver->caps, diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index c5140c3..bf32487 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -3090,13 +3090,8 @@ qemuProcessReconnect(void *opaque) goto endjob; } - if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) { - priv->persistentAddrs = 1; - - if (!(priv->pciaddrs = qemuDomainPCIAddressSetCreate(obj->def)) || - qemuAssignDevicePCISlots(obj->def, priv->pciaddrs) < 0) - goto error; - } + if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) + qemuDomainAssignAddresses(obj->def, priv->qemuCaps, obj); if (virSecurityManagerReserveLabel(driver->securityManager, obj->def, obj->pid) < 0) goto error; @@ -3560,22 +3555,7 @@ int qemuProcessStart(virConnectPtr conn, */ if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) { VIR_DEBUG("Assigning domain PCI addresses"); - /* Populate cache with current addresses */ - if (priv->pciaddrs) { - qemuDomainPCIAddressSetFree(priv->pciaddrs); - priv->pciaddrs = NULL; - } - if (!(priv->pciaddrs = qemuDomainPCIAddressSetCreate(vm->def))) - goto cleanup; - - - /* Assign any remaining addresses */ - if (qemuAssignDevicePCISlots(vm->def, priv->pciaddrs) < 0) - goto cleanup; - - priv->persistentAddrs = 1; - } else { - priv->persistentAddrs = 0; + qemuDomainAssignAddresses(vm->def, priv->qemuCaps, vm); } VIR_DEBUG("Building emulator command line"); @@ -4257,21 +4237,7 @@ int qemuProcessAttach(virConnectPtr conn ATTRIBUTE_UNUSED, */ if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) { VIR_DEBUG("Assigning domain PCI addresses"); - /* Populate cache with current addresses */ - if (priv->pciaddrs) { - qemuDomainPCIAddressSetFree(priv->pciaddrs); - priv->pciaddrs = NULL; - } - if (!(priv->pciaddrs = qemuDomainPCIAddressSetCreate(vm->def))) - goto cleanup; - - /* Assign any remaining addresses */ - if (qemuAssignDevicePCISlots(vm->def, priv->pciaddrs) < 0) - goto cleanup; - - priv->persistentAddrs = 1; - } else { - priv->persistentAddrs = 0; + qemuDomainAssignAddresses(vm->def, priv->qemuCaps, vm); } if ((timestamp = virTimeStringNow()) == NULL) { -- 1.7.0.4

On 29.06.2012 17:02, Viktor Mihajlovski wrote:
This is in preparation of the enablement of s390 guests with virtio devices.
The assignment of device addresses happens in different places, i.e. the qemu driver and process modules as well as in the unit tests in slightly different flavors. Currently, these are PPC spapr-vio and PCI devices, virtio-s390 (not PCI based) will follow.
By optionally passing to qemuDomainAssignAddresses the domain object and the capabilities it is now possible to call the function from most of the places (except for hotplug) where address assignment is done.
Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com> --- src/qemu/qemu_command.c | 41 ++++++++++++++++++++++++++++++++--------- src/qemu/qemu_command.h | 6 ++++-- src/qemu/qemu_driver.c | 14 +++++++------- src/qemu/qemu_process.c | 42 ++++-------------------------------------- 4 files changed, 47 insertions(+), 56 deletions(-)
Nice cleanup.
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 6549f57..5edf915 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -942,16 +942,22 @@ cleanup:
int -qemuDomainAssignPCIAddresses(virDomainDefPtr def) +qemuDomainAssignPCIAddresses(virDomainDefPtr def, virBitmapPtr qemuCaps, + virDomainObjPtr obj)
Even though this is still less than 80 characters, I think we could have each argument per separate line.
{ int ret = -1; - virBitmapPtr qemuCaps = NULL; + virBitmapPtr localCaps = NULL; qemuDomainPCIAddressSetPtr addrs = NULL; + qemuDomainObjPrivatePtr priv = NULL;
- if (qemuCapsExtractVersionInfo(def->emulator, def->os.arch, - NULL, - &qemuCaps) < 0) - goto cleanup; + if (!qemuCaps) { + /* need to get information from real environment */ + if (qemuCapsExtractVersionInfo(def->emulator, def->os.arch, + NULL, + &localCaps) < 0) + goto cleanup; + qemuCaps = localCaps; + }
if (qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { if (!(addrs = qemuDomainPCIAddressSetCreate(def))) @@ -961,16 +967,33 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def) goto cleanup; }
+ if (obj && obj->privateData) { + priv = obj->privateData; + if (addrs) { + /* if this is the live domain object, we persist the PCI addresses*/ + if (priv->pciaddrs) { + qemuDomainPCIAddressSetFree(priv->pciaddrs); + priv->pciaddrs = NULL; + }
qemuDomainPCIAddressSetFree() handles passed NULL, so this check is redundant.
+ priv->persistentAddrs = 1; + priv->pciaddrs = addrs; + addrs = NULL; + } else { + priv->persistentAddrs = 0; + } + } + ret = 0;
cleanup: - qemuCapsFree(qemuCaps); + qemuCapsFree(localCaps); qemuDomainPCIAddressSetFree(addrs);
return ret; }
-int qemuDomainAssignAddresses(virDomainDefPtr def) +int qemuDomainAssignAddresses(virDomainDefPtr def, virBitmapPtr qemuCaps, + virDomainObjPtr obj)
Again. I'd prefer to have each argument on a separate line...
{ int rc;
@@ -978,7 +1001,7 @@ int qemuDomainAssignAddresses(virDomainDefPtr def) if (rc) return rc;
- return qemuDomainAssignPCIAddresses(def); + return qemuDomainAssignPCIAddresses(def, qemuCaps, obj); }
static void diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h index 1eafeb3..dd104d6 100644 --- a/src/qemu/qemu_command.h +++ b/src/qemu/qemu_command.h @@ -175,10 +175,12 @@ virDomainDefPtr qemuParseCommandLinePid(virCapsPtr caps, virDomainChrSourceDefPtr *monConfig, bool *monJSON);
-int qemuDomainAssignAddresses(virDomainDefPtr def); +int qemuDomainAssignAddresses(virDomainDefPtr def, virBitmapPtr qemuCaps, + virDomainObjPtr); int qemuDomainAssignSpaprVIOAddresses(virDomainDefPtr def);
-int qemuDomainAssignPCIAddresses(virDomainDefPtr def); +int qemuDomainAssignPCIAddresses(virDomainDefPtr def, virBitmapPtr qemuCaps, + virDomainObjPtr obj); qemuDomainPCIAddressSetPtr qemuDomainPCIAddressSetCreate(virDomainDefPtr def);
... and same here.
int qemuDomainPCIAddressReserveFunction(qemuDomainPCIAddressSetPtr addrs, int slot, int function); diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 2f93404..ef9983c 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -1404,7 +1404,7 @@ static virDomainPtr qemudDomainCreate(virConnectPtr conn, const char *xml, if (qemudCanonicalizeMachine(driver, def) < 0) goto cleanup;
- if (qemuDomainAssignAddresses(def) < 0) + if (qemuDomainAssignAddresses(def, NULL, NULL) < 0) goto cleanup;
if (!(vm = virDomainAssignDef(driver->caps, @@ -5070,7 +5070,7 @@ static virDomainPtr qemudDomainDefine(virConnectPtr conn, const char *xml) { if (qemudCanonicalizeMachine(driver, def) < 0) goto cleanup;
- if (qemuDomainAssignAddresses(def) < 0) + if (qemuDomainAssignAddresses(def, NULL, NULL) < 0) goto cleanup;
if (!(vm = virDomainAssignDef(driver->caps, @@ -5548,7 +5548,7 @@ qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef, if (disk->bus != VIR_DOMAIN_DISK_BUS_VIRTIO) if (virDomainDefAddImplicitControllers(vmdef) < 0) return -1; - if (qemuDomainAssignAddresses(vmdef) < 0) + if (qemuDomainAssignAddresses(vmdef, NULL, NULL) < 0) return -1; break;
@@ -5566,7 +5566,7 @@ qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef, return -1; } dev->data.net = NULL; - if (qemuDomainAssignAddresses(vmdef) < 0) + if (qemuDomainAssignAddresses(vmdef, NULL, NULL) < 0) return -1; break;
@@ -5582,7 +5582,7 @@ qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef, return -1; } dev->data.hostdev = NULL; - if (qemuDomainAssignAddresses(vmdef) < 0) + if (qemuDomainAssignAddresses(vmdef, NULL, NULL) < 0) return -1; break;
@@ -5736,7 +5736,7 @@ qemuDomainUpdateDeviceConfig(virDomainDefPtr vmdef, vmdef->nets[pos] = net; dev->data.net = NULL;
- if (qemuDomainAssignAddresses(vmdef) < 0) + if (qemuDomainAssignAddresses(vmdef, NULL, NULL) < 0) return -1; break;
@@ -11734,7 +11734,7 @@ static virDomainPtr qemuDomainAttach(virConnectPtr conn, if (qemudCanonicalizeMachine(driver, def) < 0) goto cleanup;
- if (qemuDomainAssignAddresses(def) < 0) + if (qemuDomainAssignAddresses(def, NULL, NULL) < 0) goto cleanup;
if (!(vm = virDomainAssignDef(driver->caps, diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index c5140c3..bf32487 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -3090,13 +3090,8 @@ qemuProcessReconnect(void *opaque) goto endjob; }
- if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) { - priv->persistentAddrs = 1; - - if (!(priv->pciaddrs = qemuDomainPCIAddressSetCreate(obj->def)) || - qemuAssignDevicePCISlots(obj->def, priv->pciaddrs) < 0) - goto error; - } + if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) + qemuDomainAssignAddresses(obj->def, priv->qemuCaps, obj);
if (virSecurityManagerReserveLabel(driver->securityManager, obj->def, obj->pid) < 0) goto error; @@ -3560,22 +3555,7 @@ int qemuProcessStart(virConnectPtr conn, */ if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) { VIR_DEBUG("Assigning domain PCI addresses"); - /* Populate cache with current addresses */ - if (priv->pciaddrs) { - qemuDomainPCIAddressSetFree(priv->pciaddrs); - priv->pciaddrs = NULL; - } - if (!(priv->pciaddrs = qemuDomainPCIAddressSetCreate(vm->def))) - goto cleanup; - - - /* Assign any remaining addresses */ - if (qemuAssignDevicePCISlots(vm->def, priv->pciaddrs) < 0) - goto cleanup; - - priv->persistentAddrs = 1; - } else { - priv->persistentAddrs = 0; + qemuDomainAssignAddresses(vm->def, priv->qemuCaps, vm); }
VIR_DEBUG("Building emulator command line"); @@ -4257,21 +4237,7 @@ int qemuProcessAttach(virConnectPtr conn ATTRIBUTE_UNUSED, */ if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) { VIR_DEBUG("Assigning domain PCI addresses"); - /* Populate cache with current addresses */ - if (priv->pciaddrs) { - qemuDomainPCIAddressSetFree(priv->pciaddrs); - priv->pciaddrs = NULL; - } - if (!(priv->pciaddrs = qemuDomainPCIAddressSetCreate(vm->def))) - goto cleanup; - - /* Assign any remaining addresses */ - if (qemuAssignDevicePCISlots(vm->def, priv->pciaddrs) < 0) - goto cleanup; - - priv->persistentAddrs = 1; - } else { - priv->persistentAddrs = 0; + qemuDomainAssignAddresses(vm->def, priv->qemuCaps, vm); }
if ((timestamp = virTimeStringNow()) == NULL) {
ACK with this squashed in: diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index a6fc9ca..bcc2192 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -942,7 +942,8 @@ cleanup: int -qemuDomainAssignPCIAddresses(virDomainDefPtr def, virBitmapPtr qemuCaps, +qemuDomainAssignPCIAddresses(virDomainDefPtr def, + virBitmapPtr qemuCaps, virDomainObjPtr obj) { int ret = -1; @@ -971,10 +972,7 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def, virBitmapPtr qemuCaps, priv = obj->privateData; if (addrs) { /* if this is the live domain object, we persist the PCI addresses*/ - if (priv->pciaddrs) { - qemuDomainPCIAddressSetFree(priv->pciaddrs); - priv->pciaddrs = NULL; - } + qemuDomainPCIAddressSetFree(priv->pciaddrs); priv->persistentAddrs = 1; priv->pciaddrs = addrs; addrs = NULL; @@ -992,7 +990,8 @@ cleanup: return ret; } -int qemuDomainAssignAddresses(virDomainDefPtr def, virBitmapPtr qemuCaps, +int qemuDomainAssignAddresses(virDomainDefPtr def, + virBitmapPtr qemuCaps, virDomainObjPtr obj) { int rc; diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h index dd104d6..ddf426f 100644 --- a/src/qemu/qemu_command.h +++ b/src/qemu/qemu_command.h @@ -175,11 +175,13 @@ virDomainDefPtr qemuParseCommandLinePid(virCapsPtr caps, virDomainChrSourceDefPtr *monConfig, bool *monJSON); -int qemuDomainAssignAddresses(virDomainDefPtr def, virBitmapPtr qemuCaps, +int qemuDomainAssignAddresses(virDomainDefPtr def, + virBitmapPtr qemuCaps, virDomainObjPtr); int qemuDomainAssignSpaprVIOAddresses(virDomainDefPtr def); -int qemuDomainAssignPCIAddresses(virDomainDefPtr def, virBitmapPtr qemuCaps, +int qemuDomainAssignPCIAddresses(virDomainDefPtr def, + virBitmapPtr qemuCaps, virDomainObjPtr obj); qemuDomainPCIAddressSetPtr qemuDomainPCIAddressSetCreate(virDomainDefPtr def); int qemuDomainPCIAddressReserveFunction(qemuDomainPCIAddressSetPtr addrs, Michal

Rewrote the device assignment parts in tests to use qemuDomainAssignAddresses. This way the tests will work for new device address types as they show up in the future (like s390 device types). Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com> --- tests/qemuxml2argvtest.c | 12 +----------- tests/qemuxmlnstest.c | 13 ++----------- 2 files changed, 3 insertions(+), 22 deletions(-) diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 7b00ea2..cda32b6 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -149,21 +149,11 @@ static int testCompareXMLToArgvFiles(const char *xml, goto out; if (qemuCapsGet(extraFlags, QEMU_CAPS_DEVICE)) { - qemuDomainPCIAddressSetPtr pciaddrs; - - if (qemuDomainAssignSpaprVIOAddresses(vmdef)) { + if (qemuDomainAssignAddresses(vmdef, extraFlags, NULL)) { if (expectError) goto ok; goto out; } - - if (!(pciaddrs = qemuDomainPCIAddressSetCreate(vmdef))) - goto out; - - if (qemuAssignDevicePCISlots(vmdef, pciaddrs) < 0) - goto out; - - qemuDomainPCIAddressSetFree(pciaddrs); } log = virtTestLogContentAndReset(); diff --git a/tests/qemuxmlnstest.c b/tests/qemuxmlnstest.c index 8eca466..0bc821d 100644 --- a/tests/qemuxmlnstest.c +++ b/tests/qemuxmlnstest.c @@ -95,17 +95,8 @@ static int testCompareXMLToArgvFiles(const char *xml, if (qemudCanonicalizeMachine(&driver, vmdef) < 0) goto fail; - if (qemuCapsGet(extraFlags, QEMU_CAPS_DEVICE)) { - qemuDomainPCIAddressSetPtr pciaddrs; - if (!(pciaddrs = qemuDomainPCIAddressSetCreate(vmdef))) - goto fail; - - if (qemuAssignDevicePCISlots(vmdef, pciaddrs) < 0) - goto fail; - - qemuDomainPCIAddressSetFree(pciaddrs); - } - + if (qemuCapsGet(extraFlags, QEMU_CAPS_DEVICE)) + qemuDomainAssignAddresses(vmdef, extraFlags, NULL); log = virtTestLogContentAndReset(); VIR_FREE(log); -- 1.7.0.4

On 29.06.2012 17:02, Viktor Mihajlovski wrote:
Rewrote the device assignment parts in tests to use qemuDomainAssignAddresses. This way the tests will work for new device address types as they show up in the future (like s390 device types).
Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com> --- tests/qemuxml2argvtest.c | 12 +----------- tests/qemuxmlnstest.c | 13 ++----------- 2 files changed, 3 insertions(+), 22 deletions(-)
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 7b00ea2..cda32b6 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -149,21 +149,11 @@ static int testCompareXMLToArgvFiles(const char *xml, goto out;
if (qemuCapsGet(extraFlags, QEMU_CAPS_DEVICE)) { - qemuDomainPCIAddressSetPtr pciaddrs; - - if (qemuDomainAssignSpaprVIOAddresses(vmdef)) { + if (qemuDomainAssignAddresses(vmdef, extraFlags, NULL)) { if (expectError) goto ok; goto out; } - - if (!(pciaddrs = qemuDomainPCIAddressSetCreate(vmdef))) - goto out; - - if (qemuAssignDevicePCISlots(vmdef, pciaddrs) < 0) - goto out; - - qemuDomainPCIAddressSetFree(pciaddrs); }
log = virtTestLogContentAndReset(); diff --git a/tests/qemuxmlnstest.c b/tests/qemuxmlnstest.c index 8eca466..0bc821d 100644 --- a/tests/qemuxmlnstest.c +++ b/tests/qemuxmlnstest.c @@ -95,17 +95,8 @@ static int testCompareXMLToArgvFiles(const char *xml, if (qemudCanonicalizeMachine(&driver, vmdef) < 0) goto fail;
- if (qemuCapsGet(extraFlags, QEMU_CAPS_DEVICE)) { - qemuDomainPCIAddressSetPtr pciaddrs; - if (!(pciaddrs = qemuDomainPCIAddressSetCreate(vmdef))) - goto fail; - - if (qemuAssignDevicePCISlots(vmdef, pciaddrs) < 0) - goto fail; - - qemuDomainPCIAddressSetFree(pciaddrs); - } - + if (qemuCapsGet(extraFlags, QEMU_CAPS_DEVICE)) + qemuDomainAssignAddresses(vmdef, extraFlags, NULL);
log = virtTestLogContentAndReset(); VIR_FREE(log);
ACK. Michal

The s390(x) architecture doesn't feature a PCI bus. For the purpose of supporting virtio devices a virtual bus called virtio-s390 is used. A new address type VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390 is used to distinguish the virtio devices on s390 from PCI-based virtio devices. V3 Change: updated QEMU_CAPS_VIRTIO_S390 to fit upstream. Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com> --- src/conf/domain_conf.c | 11 +++- src/conf/domain_conf.h | 1 + src/qemu/qemu_capabilities.c | 7 +++ src/qemu/qemu_capabilities.h | 1 + src/qemu/qemu_command.c | 98 +++++++++++++++++++++++++++++++++++++++-- 5 files changed, 110 insertions(+), 8 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 4086dac..cf7c757 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -149,7 +149,8 @@ VIR_ENUM_IMPL(virDomainDeviceAddress, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_LAST, "virtio-serial", "ccid", "usb", - "spapr-vio") + "spapr-vio", + "virtio-s390") VIR_ENUM_IMPL(virDomainDeviceAddressPciMulti, VIR_DOMAIN_DEVICE_ADDRESS_PCI_MULTI_LAST, @@ -2132,7 +2133,8 @@ virDomainDeviceInfoFormat(virBufferPtr buf, virBufferAddLit(buf, "/>\n"); } - if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) + if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE || + info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390) return 0; /* We'll be in domain/devices/[device type]/ so 3 level indent */ @@ -4123,6 +4125,7 @@ virDomainControllerDefParseXML(xmlNodePtr node, if (def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE && def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO && + def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390 && def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) { virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Controllers must use the 'pci' address type")); @@ -4676,6 +4679,7 @@ virDomainNetDefParseXML(virCapsPtr caps, * them we should make sure address type is correct */ if (def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE && def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO && + def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390 && def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) { virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Network interfaces must use 'pci' address type")); @@ -9078,7 +9082,8 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps, def->memballoon = memballoon; VIR_FREE(nodes); - } else { + } else if (!STREQ(def->os.arch,"s390x")) { + /* TODO: currently no balloon support on s390 -> no default balloon */ if (def->virtType == VIR_DOMAIN_VIRT_XEN || def->virtType == VIR_DOMAIN_VIRT_QEMU || def->virtType == VIR_DOMAIN_VIRT_KQEMU || diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 7d5d60b..5e5374a 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -172,6 +172,7 @@ enum virDomainDeviceAddressType { VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCID, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_USB, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO, + VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_LAST }; diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 1e12a39..b6e5bd1 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -166,6 +166,7 @@ VIR_ENUM_IMPL(qemuCaps, QEMU_CAPS_LAST, "hda-micro", /* 95 */ "dump-guest-memory", "nec-usb-xhci", + "virtio-s390", ); @@ -1430,6 +1431,12 @@ qemuCapsParseDeviceStr(const char *str, virBitmapPtr flags) qemuCapsSet(flags, QEMU_CAPS_USB_HUB); if (strstr(str, "name \"ich9-ahci\"")) qemuCapsSet(flags, QEMU_CAPS_ICH9_AHCI); + if (strstr(str, "name \"virtio-blk-s390\"")) + qemuCapsSet(flags, QEMU_CAPS_VIRTIO_S390); + if (strstr(str, "name \"virtio-net-s390\"")) + qemuCapsSet(flags, QEMU_CAPS_VIRTIO_S390); + if (strstr(str, "name \"virtio-serial-s390\"")) + qemuCapsSet(flags, QEMU_CAPS_VIRTIO_S390); /* Prefer -chardev spicevmc (detected earlier) over -device spicevmc */ if (!qemuCapsGet(flags, QEMU_CAPS_CHARDEV_SPICEVMC) && diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 83c135b..9b5ff30 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -133,6 +133,7 @@ enum qemuCapsFlags { QEMU_CAPS_HDA_MICRO = 95, /* -device hda-micro */ QEMU_CAPS_DUMP_GUEST_MEMORY = 96, /* dump-guest-memory command */ QEMU_CAPS_NEC_USB_XHCI = 97, /* -device nec-usb-xhci */ + QEMU_CAPS_VIRTIO_S390 = 98, /* -device virtio-*-s390 */ QEMU_CAPS_LAST, /* this must always be the last item */ }; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 5edf915..99dbc1a 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -735,6 +735,67 @@ qemuAssignDeviceAliases(virDomainDefPtr def, virBitmapPtr qemuCaps) return -1; } +static void +qemuDomainPrimeS390VirtioDevices(virDomainDefPtr def, + enum virDomainDeviceAddressType type) +{ + /* + declare address-less virtio devices to be of address type 'type' + only disks, networks, consoles and controllers for now + */ + int i; + + for (i = 0; i < def->ndisks ; i++) { + if (def->disks[i]->bus == VIR_DOMAIN_DISK_BUS_VIRTIO && + def->disks[i]->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) + def->disks[i]->info.type = type; + } + + for (i = 0; i < def->nnets ; i++) { + if (STREQ(def->nets[i]->model,"virtio") && + def->nets[i]->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) + def->nets[i]->info.type = type; + } + + for (i = 0; i < def->ncontrollers ; i++) { + if (def->controllers[i]->type == + VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL && + def->controllers[i]->info.type == + VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) + def->controllers[i]->info.type = type; + } + +} + +static int +qemuDomainAssignS390Addresses(virDomainDefPtr def, virBitmapPtr qemuCaps) +{ + int ret = -1; + virBitmapPtr localCaps = NULL; + + if (!qemuCaps) { + /* need to get information from real environment */ + if (qemuCapsExtractVersionInfo(def->emulator, def->os.arch, + NULL, + &localCaps) < 0) + goto cleanup; + qemuCaps = localCaps; + } + + if (qemuCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_S390)) { + /* deal with legacy virtio-s390 */ + qemuDomainPrimeS390VirtioDevices( + def, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390); + } + + ret = 0; + +cleanup: + qemuCapsFree(localCaps); + + return ret; +} + static int qemuSpaprVIOFindByReg(virDomainDefPtr def ATTRIBUTE_UNUSED, virDomainDeviceDefPtr device ATTRIBUTE_UNUSED, @@ -1001,6 +1062,10 @@ int qemuDomainAssignAddresses(virDomainDefPtr def, virBitmapPtr qemuCaps, if (rc) return rc; + rc = qemuDomainAssignS390Addresses(def, qemuCaps); + if (rc) + return rc; + return qemuDomainAssignPCIAddresses(def, qemuCaps, obj); } @@ -1545,7 +1610,10 @@ qemuAssignDevicePCISlots(virDomainDefPtr def, qemuDomainPCIAddressSetPtr addrs) if (def->disks[i]->bus != VIR_DOMAIN_DISK_BUS_VIRTIO) continue; - if (def->disks[i]->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) + /* don't touch s390 devices */ + if (def->disks[i]->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI || + def->disks[i]->info.type == + VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390) continue; if (def->disks[i]->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) { @@ -2020,7 +2088,13 @@ qemuBuildDriveStr(virConnectPtr conn ATTRIBUTE_UNUSED, break; case VIR_DOMAIN_DISK_BUS_VIRTIO: - /* Each virtio drive is a separate PCI device, no unit/busid or index */ + if (qemuCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_S390) && + (disk->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390)) { + /* Paranoia - leave in here for now */ + qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("unexpected address type for s390-virtio disk")); + goto error; + } idx = -1; break; @@ -2450,7 +2524,12 @@ qemuBuildDriveDevStr(virDomainDefPtr def, disk->info.addr.drive.unit); break; case VIR_DOMAIN_DISK_BUS_VIRTIO: - virBufferAddLit(&opt, "virtio-blk-pci"); + if (disk->info.type == + VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390) { + virBufferAddLit(&opt, "virtio-blk-s390"); + } else { + virBufferAddLit(&opt, "virtio-blk-pci"); + } qemuBuildIoEventFdStr(&opt, disk->ioeventfd, qemuCaps); if (disk->event_idx && qemuCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_BLK_EVENT_IDX)) { @@ -2708,6 +2787,9 @@ qemuBuildControllerDevStr(virDomainDefPtr domainDef, case VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL: if (def->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) { virBufferAddLit(&buf, "virtio-serial-pci"); + } else if (def->info.type == + VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390) { + virBufferAddLit(&buf, "virtio-serial-s390"); } else { virBufferAddLit(&buf, "virtio-serial"); } @@ -2803,7 +2885,12 @@ qemuBuildNicDevStr(virDomainNetDefPtr net, if (!net->model) { nic = "rtl8139"; } else if (STREQ(net->model, "virtio")) { - nic = "virtio-net-pci"; + if (net->info.type == + VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390) { + nic = "virtio-net-s390"; + } else { + nic = "virtio-net-pci"; + } usingVirtio = true; } else { nic = net->model; @@ -3606,7 +3693,8 @@ qemuBuildVirtioSerialPortDevStr(virDomainChrDefPtr dev, return NULL; } - if (dev->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) { + if (dev->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE && + dev->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390) { /* Check it's a virtio-serial address */ if (dev->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_SERIAL) -- 1.7.0.4

On 29.06.2012 17:02, Viktor Mihajlovski wrote:
The s390(x) architecture doesn't feature a PCI bus. For the purpose of supporting virtio devices a virtual bus called virtio-s390 is used. A new address type VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390 is used to distinguish the virtio devices on s390 from PCI-based virtio devices.
V3 Change: updated QEMU_CAPS_VIRTIO_S390 to fit upstream.
Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com> --- src/conf/domain_conf.c | 11 +++- src/conf/domain_conf.h | 1 + src/qemu/qemu_capabilities.c | 7 +++ src/qemu/qemu_capabilities.h | 1 + src/qemu/qemu_command.c | 98 +++++++++++++++++++++++++++++++++++++++-- 5 files changed, 110 insertions(+), 8 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 4086dac..cf7c757 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -149,7 +149,8 @@ VIR_ENUM_IMPL(virDomainDeviceAddress, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_LAST, "virtio-serial", "ccid", "usb", - "spapr-vio") + "spapr-vio", + "virtio-s390")
VIR_ENUM_IMPL(virDomainDeviceAddressPciMulti, VIR_DOMAIN_DEVICE_ADDRESS_PCI_MULTI_LAST, @@ -2132,7 +2133,8 @@ virDomainDeviceInfoFormat(virBufferPtr buf, virBufferAddLit(buf, "/>\n"); }
- if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) + if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE || + info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390) return 0;
/* We'll be in domain/devices/[device type]/ so 3 level indent */ @@ -4123,6 +4125,7 @@ virDomainControllerDefParseXML(xmlNodePtr node,
if (def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE && def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO && + def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390 && def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) { virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Controllers must use the 'pci' address type")); @@ -4676,6 +4679,7 @@ virDomainNetDefParseXML(virCapsPtr caps, * them we should make sure address type is correct */ if (def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE && def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO && + def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390 && def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) { virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Network interfaces must use 'pci' address type")); @@ -9078,7 +9082,8 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
def->memballoon = memballoon; VIR_FREE(nodes); - } else { + } else if (!STREQ(def->os.arch,"s390x")) { + /* TODO: currently no balloon support on s390 -> no default balloon */ if (def->virtType == VIR_DOMAIN_VIRT_XEN || def->virtType == VIR_DOMAIN_VIRT_QEMU || def->virtType == VIR_DOMAIN_VIRT_KQEMU || diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 7d5d60b..5e5374a 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -172,6 +172,7 @@ enum virDomainDeviceAddressType { VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCID, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_USB, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO, + VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390,
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_LAST }; diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 1e12a39..b6e5bd1 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -166,6 +166,7 @@ VIR_ENUM_IMPL(qemuCaps, QEMU_CAPS_LAST, "hda-micro", /* 95 */ "dump-guest-memory", "nec-usb-xhci", + "virtio-s390",
);
@@ -1430,6 +1431,12 @@ qemuCapsParseDeviceStr(const char *str, virBitmapPtr flags) qemuCapsSet(flags, QEMU_CAPS_USB_HUB); if (strstr(str, "name \"ich9-ahci\"")) qemuCapsSet(flags, QEMU_CAPS_ICH9_AHCI); + if (strstr(str, "name \"virtio-blk-s390\"")) + qemuCapsSet(flags, QEMU_CAPS_VIRTIO_S390); + if (strstr(str, "name \"virtio-net-s390\"")) + qemuCapsSet(flags, QEMU_CAPS_VIRTIO_S390); + if (strstr(str, "name \"virtio-serial-s390\"")) + qemuCapsSet(flags, QEMU_CAPS_VIRTIO_S390);
I think this could be joined into one if with ||
/* Prefer -chardev spicevmc (detected earlier) over -device spicevmc */ if (!qemuCapsGet(flags, QEMU_CAPS_CHARDEV_SPICEVMC) && diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 83c135b..9b5ff30 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -133,6 +133,7 @@ enum qemuCapsFlags { QEMU_CAPS_HDA_MICRO = 95, /* -device hda-micro */ QEMU_CAPS_DUMP_GUEST_MEMORY = 96, /* dump-guest-memory command */ QEMU_CAPS_NEC_USB_XHCI = 97, /* -device nec-usb-xhci */ + QEMU_CAPS_VIRTIO_S390 = 98, /* -device virtio-*-s390 */
QEMU_CAPS_LAST, /* this must always be the last item */ }; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 5edf915..99dbc1a 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -735,6 +735,67 @@ qemuAssignDeviceAliases(virDomainDefPtr def, virBitmapPtr qemuCaps) return -1; }
+static void +qemuDomainPrimeS390VirtioDevices(virDomainDefPtr def, + enum virDomainDeviceAddressType type) +{ + /* + declare address-less virtio devices to be of address type 'type' + only disks, networks, consoles and controllers for now + */ + int i; + + for (i = 0; i < def->ndisks ; i++) { + if (def->disks[i]->bus == VIR_DOMAIN_DISK_BUS_VIRTIO && + def->disks[i]->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) + def->disks[i]->info.type = type; + } + + for (i = 0; i < def->nnets ; i++) { + if (STREQ(def->nets[i]->model,"virtio") && + def->nets[i]->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) + def->nets[i]->info.type = type; + } + + for (i = 0; i < def->ncontrollers ; i++) { + if (def->controllers[i]->type == + VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL && + def->controllers[i]->info.type == + VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) + def->controllers[i]->info.type = type; + } + +} + +static int +qemuDomainAssignS390Addresses(virDomainDefPtr def, virBitmapPtr qemuCaps) +{ + int ret = -1; + virBitmapPtr localCaps = NULL; + + if (!qemuCaps) { + /* need to get information from real environment */ + if (qemuCapsExtractVersionInfo(def->emulator, def->os.arch, + NULL, + &localCaps) < 0) + goto cleanup; + qemuCaps = localCaps; + } + + if (qemuCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_S390)) { + /* deal with legacy virtio-s390 */ + qemuDomainPrimeS390VirtioDevices( + def, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390); + } + + ret = 0; + +cleanup: + qemuCapsFree(localCaps); + + return ret; +} + static int qemuSpaprVIOFindByReg(virDomainDefPtr def ATTRIBUTE_UNUSED, virDomainDeviceDefPtr device ATTRIBUTE_UNUSED, @@ -1001,6 +1062,10 @@ int qemuDomainAssignAddresses(virDomainDefPtr def, virBitmapPtr qemuCaps, if (rc) return rc;
+ rc = qemuDomainAssignS390Addresses(def, qemuCaps); + if (rc) + return rc; + return qemuDomainAssignPCIAddresses(def, qemuCaps, obj); }
@@ -1545,7 +1610,10 @@ qemuAssignDevicePCISlots(virDomainDefPtr def, qemuDomainPCIAddressSetPtr addrs) if (def->disks[i]->bus != VIR_DOMAIN_DISK_BUS_VIRTIO) continue;
- if (def->disks[i]->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) + /* don't touch s390 devices */ + if (def->disks[i]->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI || + def->disks[i]->info.type == + VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390) continue;
if (def->disks[i]->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) { @@ -2020,7 +2088,13 @@ qemuBuildDriveStr(virConnectPtr conn ATTRIBUTE_UNUSED, break;
case VIR_DOMAIN_DISK_BUS_VIRTIO: - /* Each virtio drive is a separate PCI device, no unit/busid or index */ + if (qemuCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_S390) && + (disk->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390)) { + /* Paranoia - leave in here for now */ + qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("unexpected address type for s390-virtio disk")); + goto error; + } idx = -1; break;
@@ -2450,7 +2524,12 @@ qemuBuildDriveDevStr(virDomainDefPtr def, disk->info.addr.drive.unit); break; case VIR_DOMAIN_DISK_BUS_VIRTIO: - virBufferAddLit(&opt, "virtio-blk-pci"); + if (disk->info.type == + VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390) { + virBufferAddLit(&opt, "virtio-blk-s390"); + } else { + virBufferAddLit(&opt, "virtio-blk-pci"); + } qemuBuildIoEventFdStr(&opt, disk->ioeventfd, qemuCaps); if (disk->event_idx && qemuCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_BLK_EVENT_IDX)) { @@ -2708,6 +2787,9 @@ qemuBuildControllerDevStr(virDomainDefPtr domainDef, case VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL: if (def->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) { virBufferAddLit(&buf, "virtio-serial-pci"); + } else if (def->info.type == + VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390) { + virBufferAddLit(&buf, "virtio-serial-s390"); } else { virBufferAddLit(&buf, "virtio-serial"); } @@ -2803,7 +2885,12 @@ qemuBuildNicDevStr(virDomainNetDefPtr net, if (!net->model) { nic = "rtl8139"; } else if (STREQ(net->model, "virtio")) { - nic = "virtio-net-pci"; + if (net->info.type == + VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390) { + nic = "virtio-net-s390"; + } else { + nic = "virtio-net-pci"; + } usingVirtio = true; } else { nic = net->model; @@ -3606,7 +3693,8 @@ qemuBuildVirtioSerialPortDevStr(virDomainChrDefPtr dev, return NULL; }
- if (dev->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) { + if (dev->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE && + dev->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390) { /* Check it's a virtio-serial address */ if (dev->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_SERIAL)
ACK with this squashed in: diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index b6e5bd1..9e4d927 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -1431,11 +1431,9 @@ qemuCapsParseDeviceStr(const char *str, virBitmapPtr flags) qemuCapsSet(flags, QEMU_CAPS_USB_HUB); if (strstr(str, "name \"ich9-ahci\"")) qemuCapsSet(flags, QEMU_CAPS_ICH9_AHCI); - if (strstr(str, "name \"virtio-blk-s390\"")) - qemuCapsSet(flags, QEMU_CAPS_VIRTIO_S390); - if (strstr(str, "name \"virtio-net-s390\"")) - qemuCapsSet(flags, QEMU_CAPS_VIRTIO_S390); - if (strstr(str, "name \"virtio-serial-s390\"")) + if (strstr(str, "name \"virtio-blk-s390\"") || + strstr(str, "name \"virtio-net-s390\"") || + strstr(str, "name \"virtio-serial-s390\"")) qemuCapsSet(flags, QEMU_CAPS_VIRTIO_S390); /* Prefer -chardev spicevmc (detected earlier) over -device spicevmc */ Michal

Added s390-virtio machine type to the XML schema for domains in order to not fail the domain schema tests. Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com> --- docs/schemas/domaincommon.rng | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+), 0 deletions(-) diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 912a1a2..70c7d16 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -283,6 +283,7 @@ <ref name="hvmsparc"/> <ref name="hvmppc"/> <ref name="hvmppc64"/> + <ref name="hvms390"/> </choice> </optional> <value>hvm</value> @@ -369,6 +370,25 @@ </optional> </group> </define> + <define name="hvms390"> + <group> + <optional> + <attribute name="arch"> + <choice> + <value>s390</value> + <value>s390x</value> + </choice> + </attribute> + </optional> + <optional> + <attribute name="machine"> + <choice> + <value>s390-virtio</value> + </choice> + </attribute> + </optional> + </group> + </define> <define name="osexe"> <element name="os"> <element name="type"> -- 1.7.0.4

On 29.06.2012 17:02, Viktor Mihajlovski wrote:
Added s390-virtio machine type to the XML schema for domains in order to not fail the domain schema tests.
Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com> --- docs/schemas/domaincommon.rng | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 912a1a2..70c7d16 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -283,6 +283,7 @@ <ref name="hvmsparc"/> <ref name="hvmppc"/> <ref name="hvmppc64"/> + <ref name="hvms390"/> </choice> </optional> <value>hvm</value> @@ -369,6 +370,25 @@ </optional> </group> </define> + <define name="hvms390"> + <group> + <optional> + <attribute name="arch"> + <choice> + <value>s390</value> + <value>s390x</value> + </choice> + </attribute> + </optional> + <optional> + <attribute name="machine"> + <choice> + <value>s390-virtio</value> + </choice> + </attribute> + </optional> + </group> + </define> <define name="osexe"> <element name="os"> <element name="type">
Sorry cannot ACK this one until you update the documentation as well. Michal

On 07/03/2012 06:18 PM, Michal Privoznik wrote:
On 29.06.2012 17:02, Viktor Mihajlovski wrote:
Added s390-virtio machine type to the XML schema for domains in order to not fail the domain schema tests.
Signed-off-by: Viktor Mihajlovski<mihajlov@linux.vnet.ibm.com> --- docs/schemas/domaincommon.rng | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 912a1a2..70c7d16 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -283,6 +283,7 @@ <ref name="hvmsparc"/> <ref name="hvmppc"/> <ref name="hvmppc64"/> +<ref name="hvms390"/> </choice> </optional> <value>hvm</value> @@ -369,6 +370,25 @@ </optional> </group> </define> +<define name="hvms390"> +<group> +<optional> +<attribute name="arch"> +<choice> +<value>s390</value> +<value>s390x</value> +</choice> +</attribute> +</optional> +<optional> +<attribute name="machine"> +<choice> +<value>s390-virtio</value> +</choice> +</attribute> +</optional> +</group> +</define> <define name="osexe"> <element name="os"> <element name="type">
Sorry cannot ACK this one until you update the documentation as well.
Michal
Hi Michal, actually I was pondering about a doc update when preparing the patches. I only wasn't clear where to put it. The only place where possible arch/machine values are mentioned seems to be in formatcaps.html.in. Would you expect me to add a sample output of the capabilities XML for s390 with some comments in there, or did you have something else in mind? Thanks. -- Mit freundlichen Grüßen/Kind Regards Viktor Mihajlovski IBM Deutschland Research & Development GmbH Vorsitzender des Aufsichtsrats: Martin Jetter Geschäftsführung: Dirk Wittkopp Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294

On 09.07.2012 14:33, Viktor Mihajlovski wrote:
On 07/03/2012 06:18 PM, Michal Privoznik wrote:
On 29.06.2012 17:02, Viktor Mihajlovski wrote:
Added s390-virtio machine type to the XML schema for domains in order to not fail the domain schema tests.
Signed-off-by: Viktor Mihajlovski<mihajlov@linux.vnet.ibm.com> --- docs/schemas/domaincommon.rng | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 912a1a2..70c7d16 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -283,6 +283,7 @@ <ref name="hvmsparc"/> <ref name="hvmppc"/> <ref name="hvmppc64"/> +<ref name="hvms390"/> </choice> </optional> <value>hvm</value> @@ -369,6 +370,25 @@ </optional> </group> </define> +<define name="hvms390"> +<group> +<optional> +<attribute name="arch"> +<choice> +<value>s390</value> +<value>s390x</value> +</choice> +</attribute> +</optional> +<optional> +<attribute name="machine"> +<choice> +<value>s390-virtio</value>
[1]^^
+</choice> +</attribute> +</optional> +</group> +</define> <define name="osexe"> <element name="os"> <element name="type">
Sorry cannot ACK this one until you update the documentation as well.
Michal
Hi Michal,
actually I was pondering about a doc update when preparing the patches. I only wasn't clear where to put it. The only place where possible arch/machine values are mentioned seems to be in formatcaps.html.in. Would you expect me to add a sample output of the capabilities XML for s390 with some comments in there, or did you have something else in mind?
Thanks.
Actually, now I am going through docs I don't see a proper place neither. Moreover, in formatdomain.html.in we state: "The Capabilities XML provides details on allowed values for these" [these = @machine and @type] So as long as we report them in capabilities XML I guess we don't really need an doc extension. However, I think this [1] should be virtio-s390 instead of s390-virtio since we use the former among the code. What do you think? Michal

On 07/10/2012 05:50 PM, Michal Privoznik wrote:
On 09.07.2012 14:33, Viktor Mihajlovski wrote:
On 07/03/2012 06:18 PM, Michal Privoznik wrote:
On 29.06.2012 17:02, Viktor Mihajlovski wrote:
Added s390-virtio machine type to the XML schema for domains in order to not fail the domain schema tests.
Signed-off-by: Viktor Mihajlovski<mihajlov@linux.vnet.ibm.com> --- docs/schemas/domaincommon.rng | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 912a1a2..70c7d16 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -283,6 +283,7 @@ <ref name="hvmsparc"/> <ref name="hvmppc"/> <ref name="hvmppc64"/> +<ref name="hvms390"/> </choice> </optional> <value>hvm</value> @@ -369,6 +370,25 @@ </optional> </group> </define> +<define name="hvms390"> +<group> +<optional> +<attribute name="arch"> +<choice> +<value>s390</value> +<value>s390x</value> +</choice> +</attribute> +</optional> +<optional> +<attribute name="machine"> +<choice> +<value>s390-virtio</value>
[1]^^
+</choice> +</attribute> +</optional> +</group> +</define> <define name="osexe"> <element name="os"> <element name="type">
Sorry cannot ACK this one until you update the documentation as well.
Michal
Hi Michal,
actually I was pondering about a doc update when preparing the patches. I only wasn't clear where to put it. The only place where possible arch/machine values are mentioned seems to be in formatcaps.html.in. Would you expect me to add a sample output of the capabilities XML for s390 with some comments in there, or did you have something else in mind?
Thanks.
Actually, now I am going through docs I don't see a proper place neither. Moreover, in formatdomain.html.in we state: "The Capabilities XML provides details on allowed values for these" [these = @machine and @type] So as long as we report them in capabilities XML I guess we don't really need an doc extension.
However, I think this [1] should be virtio-s390 instead of s390-virtio since we use the former among the code.
What do you think?
Michal
the naming is awkward and I stumble over it from time to time too. Unfortunately this is the terminology qemu uses. In a nutshell: s390-virtio = machine type, meaning s390 machine with virtio bus virtio-s390 = bus type, meaning s390-specific virtio bus The current virtio bus on s390 is a fully virtual bus not related to a real hardware bus like the PCI bus on the other architectures. So, while the names looks strange, they are technically correct. -- Mit freundlichen Grüßen/Kind Regards Viktor Mihajlovski IBM Deutschland Research & Development GmbH Vorsitzender des Aufsichtsrats: Martin Jetter Geschäftsführung: Dirk Wittkopp Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294

On 11.07.2012 10:42, Viktor Mihajlovski wrote:
On 07/10/2012 05:50 PM, Michal Privoznik wrote:
On 09.07.2012 14:33, Viktor Mihajlovski wrote:
On 07/03/2012 06:18 PM, Michal Privoznik wrote:
On 29.06.2012 17:02, Viktor Mihajlovski wrote:
Added s390-virtio machine type to the XML schema for domains in order to not fail the domain schema tests.
Signed-off-by: Viktor Mihajlovski<mihajlov@linux.vnet.ibm.com> --- docs/schemas/domaincommon.rng | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 912a1a2..70c7d16 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -283,6 +283,7 @@ <ref name="hvmsparc"/> <ref name="hvmppc"/> <ref name="hvmppc64"/> +<ref name="hvms390"/> </choice> </optional> <value>hvm</value> @@ -369,6 +370,25 @@ </optional> </group> </define> +<define name="hvms390"> +<group> +<optional> +<attribute name="arch"> +<choice> +<value>s390</value> +<value>s390x</value> +</choice> +</attribute> +</optional> +<optional> +<attribute name="machine"> +<choice> +<value>s390-virtio</value>
[1]^^
+</choice> +</attribute> +</optional> +</group> +</define> <define name="osexe"> <element name="os"> <element name="type">
Sorry cannot ACK this one until you update the documentation as well.
Michal
Hi Michal,
actually I was pondering about a doc update when preparing the patches. I only wasn't clear where to put it. The only place where possible arch/machine values are mentioned seems to be in formatcaps.html.in. Would you expect me to add a sample output of the capabilities XML for s390 with some comments in there, or did you have something else in mind?
Thanks.
Actually, now I am going through docs I don't see a proper place neither. Moreover, in formatdomain.html.in we state: "The Capabilities XML provides details on allowed values for these" [these = @machine and @type] So as long as we report them in capabilities XML I guess we don't really need an doc extension.
However, I think this [1] should be virtio-s390 instead of s390-virtio since we use the former among the code.
What do you think?
Michal
the naming is awkward and I stumble over it from time to time too. Unfortunately this is the terminology qemu uses.
In a nutshell: s390-virtio = machine type, meaning s390 machine with virtio bus virtio-s390 = bus type, meaning s390-specific virtio bus
The current virtio bus on s390 is a fully virtual bus not related to a real hardware bus like the PCI bus on the other architectures. So, while the names looks strange, they are technically correct.
Okay. I've pushed the patch set. Michal

Add minimal s390-virtio domain testcase and testcases for virtio serial, net, disk for the virtio-s390 bus. Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com> --- .../qemuxml2argv-console-virtio-s390.args | 9 ++++++ .../qemuxml2argv-console-virtio-s390.xml | 24 +++++++++++++++ .../qemuxml2argv-disk-virtio-s390.args | 5 +++ .../qemuxml2argv-disk-virtio-s390.xml | 22 ++++++++++++++ .../qemuxml2argv-minimal-s390.args | 5 +++ .../qemuxml2argvdata/qemuxml2argv-minimal-s390.xml | 21 +++++++++++++ .../qemuxml2argv-net-virtio-s390.args | 5 +++ .../qemuxml2argv-net-virtio-s390.xml | 22 ++++++++++++++ tests/qemuxml2argvtest.c | 8 +++++ tests/testutilsqemu.c | 31 ++++++++++++++++++++ 10 files changed, 152 insertions(+), 0 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-console-virtio-s390.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-console-virtio-s390.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-s390.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-s390.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-minimal-s390.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-minimal-s390.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-net-virtio-s390.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-net-virtio-s390.xml diff --git a/tests/qemuxml2argvdata/qemuxml2argv-console-virtio-s390.args b/tests/qemuxml2argvdata/qemuxml2argv-console-virtio-s390.args new file mode 100644 index 0000000..3388a35 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-console-virtio-s390.args @@ -0,0 +1,9 @@ +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M \ +s390-virtio -m 214 -smp 1 -nographic -nodefconfig -nodefaults -chardev \ +socket,id=charmonitor,path=/tmp/test-monitor,server,nowait -mon \ +chardev=charmonitor,id=monitor,mode=readline -no-acpi \ +-boot c -device virtio-serial-s390,id=virtio-serial0 \ +-drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-virtio-disk0 \ +-device virtio-blk-s390,drive=drive-virtio-disk0,id=virtio-disk0 \ +-chardev pty,id=charconsole0 \ +-device virtconsole,chardev=charconsole0,id=console0 -usb diff --git a/tests/qemuxml2argvdata/qemuxml2argv-console-virtio-s390.xml b/tests/qemuxml2argvdata/qemuxml2argv-console-virtio-s390.xml new file mode 100644 index 0000000..5a4a9d4 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-console-virtio-s390.xml @@ -0,0 +1,24 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory>219100</memory> + <currentMemory>219100</currentMemory> + <os> + <type arch='s390x' machine='s390-virtio'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu</emulator> + <disk type='block' device='disk'> + <source dev='/dev/HostVG/QEMUGuest1'/> + <target dev='hda' bus='virtio'/> + </disk> + <console type='pty'> + <target type='virtio'/> + </console> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-s390.args b/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-s390.args new file mode 100644 index 0000000..66bdf1e --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-s390.args @@ -0,0 +1,5 @@ +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S \ +-M s390-virtio -m 214 -smp 1 -nographic -nodefaults \ +-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \ +-drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-virtio-disk0 \ +-device virtio-blk-s390,drive=drive-virtio-disk0,id=virtio-disk0 -usb diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-s390.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-s390.xml new file mode 100644 index 0000000..9ce6c18 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-s390.xml @@ -0,0 +1,22 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory>219136</memory> + <currentMemory>219136</currentMemory> + <vcpu>1</vcpu> + <os> + <type arch='s390x' machine='s390-virtio'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu</emulator> + <disk type='block' device='disk'> + <source dev='/dev/HostVG/QEMUGuest1'/> + <target dev='hda' bus='virtio'/> + </disk> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-minimal-s390.args b/tests/qemuxml2argvdata/qemuxml2argv-minimal-s390.args new file mode 100644 index 0000000..4e7bf05 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-minimal-s390.args @@ -0,0 +1,5 @@ +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu \ +-name QEMUGuest1 -S -M s390-virtio -m 214 -smp 1 -nographic \ +-monitor unix:/tmp/test-monitor,server,nowait -no-acpi \ +-boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial \ +none -parallel none -usb diff --git a/tests/qemuxml2argvdata/qemuxml2argv-minimal-s390.xml b/tests/qemuxml2argvdata/qemuxml2argv-minimal-s390.xml new file mode 100644 index 0000000..7378bd4 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-minimal-s390.xml @@ -0,0 +1,21 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory>219100</memory> + <currentMemory>219100</currentMemory> + <os> + <type arch='s390x' machine='s390-virtio'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu</emulator> + <disk type='block' device='disk'> + <source dev='/dev/HostVG/QEMUGuest1'/> + <target dev='hda' bus='virtio'/> + </disk> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-s390.args b/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-s390.args new file mode 100644 index 0000000..700ea84 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-s390.args @@ -0,0 +1,5 @@ +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S \ +-M s390-virtio -m 214 -smp 1 -nographic -nodefaults \ +-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \ +-device virtio-net-s390,vlan=0,id=net0,mac=00:11:22:33:44:55 \ +-net user,vlan=0,name=hostnet0 -usb diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-s390.xml b/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-s390.xml new file mode 100644 index 0000000..f42fadd --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-s390.xml @@ -0,0 +1,22 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory>219136</memory> + <currentMemory>219136</currentMemory> + <vcpu>1</vcpu> + <os> + <type arch='s390x' machine='s390-virtio'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu</emulator> + <interface type='user'> + <mac address='00:11:22:33:44:55'/> + <model type='virtio'/> + </interface> + </devices> +</domain> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index cda32b6..a4fa8fe 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -341,6 +341,7 @@ mymain(void) unsetenv("SDL_AUDIODRIVER"); DO_TEST("minimal", false, QEMU_CAPS_NAME); + DO_TEST("minimal-s390", false, QEMU_CAPS_NAME); DO_TEST("machine-aliases1", false, NONE); DO_TEST("machine-aliases2", true, NONE); DO_TEST("boot-cdrom", false, NONE); @@ -393,6 +394,8 @@ mymain(void) QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE); DO_TEST("disk-many", false, NONE); DO_TEST("disk-virtio", false, QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_BOOT); + DO_TEST("disk-virtio-s390", false, QEMU_CAPS_DRIVE, + QEMU_CAPS_DEVICE, QEMU_CAPS_VIRTIO_S390); DO_TEST("disk-order", false, QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE_BOOT, QEMU_CAPS_VIRTIO_BLK_SCSI, QEMU_CAPS_VIRTIO_BLK_SG_IO); @@ -552,6 +555,8 @@ mymain(void) QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_VIRTIO_TX_ALG); DO_TEST("net-virtio-netdev", false, QEMU_CAPS_DEVICE, QEMU_CAPS_NETDEV, QEMU_CAPS_NODEFCONFIG); + DO_TEST("net-virtio-s390", false, + QEMU_CAPS_DEVICE, QEMU_CAPS_VIRTIO_S390); DO_TEST("net-eth", false, NONE); DO_TEST("net-eth-ifname", false, NONE); DO_TEST("net-eth-names", false, QEMU_CAPS_NET_NAME); @@ -609,6 +614,9 @@ mymain(void) QEMU_CAPS_DEVICE, QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG); DO_TEST("console-virtio-many", false, QEMU_CAPS_DEVICE, QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG); + DO_TEST("console-virtio-s390", false, + QEMU_CAPS_DEVICE, QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG, + QEMU_CAPS_DRIVE, QEMU_CAPS_VIRTIO_S390); DO_TEST("channel-spicevmc", false, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_SPICE, QEMU_CAPS_CHARDEV_SPICEVMC); diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c index 8d5a3bf..74b9122 100644 --- a/tests/testutilsqemu.c +++ b/tests/testutilsqemu.c @@ -87,6 +87,34 @@ error: return -1; } +static int testQemuAddS390Guest(virCapsPtr caps) +{ + static const char *s390_machines[] = { "s390-virtio"}; + virCapsGuestMachinePtr *machines = NULL; + virCapsGuestPtr guest; + + machines = virCapabilitiesAllocMachines(s390_machines, + ARRAY_CARDINALITY(s390_machines)); + if (!machines) + goto error; + + guest = virCapabilitiesAddGuest(caps, "hvm", "s390x", 64, + "/usr/bin/qemu-system-s390x", NULL, + ARRAY_CARDINALITY(s390_machines), + machines); + if (!guest) + goto error; + + if (!virCapabilitiesAddGuestDomain(guest, "qemu", NULL, NULL, 0, NULL)) + goto error; + + return 0; + +error: + virCapabilitiesFreeMachines(machines, ARRAY_CARDINALITY(s390_machines)); + return -1; +} + virCapsPtr testQemuCapsInit(void) { virCapsPtr caps; virCapsGuestPtr guest; @@ -208,6 +236,9 @@ virCapsPtr testQemuCapsInit(void) { if (testQemuAddPPC64Guest(caps)) goto cleanup; + if (testQemuAddS390Guest(caps)) + goto cleanup; + if (virTestGetDebug()) { char *caps_str; -- 1.7.0.4

On 29.06.2012 17:02, Viktor Mihajlovski wrote:
Add minimal s390-virtio domain testcase and testcases for virtio serial, net, disk for the virtio-s390 bus.
Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com> --- .../qemuxml2argv-console-virtio-s390.args | 9 ++++++ .../qemuxml2argv-console-virtio-s390.xml | 24 +++++++++++++++ .../qemuxml2argv-disk-virtio-s390.args | 5 +++ .../qemuxml2argv-disk-virtio-s390.xml | 22 ++++++++++++++ .../qemuxml2argv-minimal-s390.args | 5 +++ .../qemuxml2argvdata/qemuxml2argv-minimal-s390.xml | 21 +++++++++++++ .../qemuxml2argv-net-virtio-s390.args | 5 +++ .../qemuxml2argv-net-virtio-s390.xml | 22 ++++++++++++++ tests/qemuxml2argvtest.c | 8 +++++ tests/testutilsqemu.c | 31 ++++++++++++++++++++ 10 files changed, 152 insertions(+), 0 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-console-virtio-s390.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-console-virtio-s390.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-s390.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-s390.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-minimal-s390.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-minimal-s390.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-net-virtio-s390.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-net-virtio-s390.xml
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-console-virtio-s390.args b/tests/qemuxml2argvdata/qemuxml2argv-console-virtio-s390.args new file mode 100644 index 0000000..3388a35 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-console-virtio-s390.args @@ -0,0 +1,9 @@ +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M \ +s390-virtio -m 214 -smp 1 -nographic -nodefconfig -nodefaults -chardev \ +socket,id=charmonitor,path=/tmp/test-monitor,server,nowait -mon \ +chardev=charmonitor,id=monitor,mode=readline -no-acpi \ +-boot c -device virtio-serial-s390,id=virtio-serial0 \ +-drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-virtio-disk0 \ +-device virtio-blk-s390,drive=drive-virtio-disk0,id=virtio-disk0 \ +-chardev pty,id=charconsole0 \ +-device virtconsole,chardev=charconsole0,id=console0 -usb diff --git a/tests/qemuxml2argvdata/qemuxml2argv-console-virtio-s390.xml b/tests/qemuxml2argvdata/qemuxml2argv-console-virtio-s390.xml new file mode 100644 index 0000000..5a4a9d4 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-console-virtio-s390.xml @@ -0,0 +1,24 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory>219100</memory> + <currentMemory>219100</currentMemory> + <os> + <type arch='s390x' machine='s390-virtio'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu</emulator> + <disk type='block' device='disk'> + <source dev='/dev/HostVG/QEMUGuest1'/> + <target dev='hda' bus='virtio'/> + </disk> + <console type='pty'> + <target type='virtio'/> + </console> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-s390.args b/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-s390.args new file mode 100644 index 0000000..66bdf1e --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-s390.args @@ -0,0 +1,5 @@ +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S \ +-M s390-virtio -m 214 -smp 1 -nographic -nodefaults \ +-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \ +-drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-virtio-disk0 \ +-device virtio-blk-s390,drive=drive-virtio-disk0,id=virtio-disk0 -usb diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-s390.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-s390.xml new file mode 100644 index 0000000..9ce6c18 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-s390.xml @@ -0,0 +1,22 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory>219136</memory> + <currentMemory>219136</currentMemory> + <vcpu>1</vcpu> + <os> + <type arch='s390x' machine='s390-virtio'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu</emulator> + <disk type='block' device='disk'> + <source dev='/dev/HostVG/QEMUGuest1'/> + <target dev='hda' bus='virtio'/> + </disk> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-minimal-s390.args b/tests/qemuxml2argvdata/qemuxml2argv-minimal-s390.args new file mode 100644 index 0000000..4e7bf05 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-minimal-s390.args @@ -0,0 +1,5 @@ +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu \ +-name QEMUGuest1 -S -M s390-virtio -m 214 -smp 1 -nographic \ +-monitor unix:/tmp/test-monitor,server,nowait -no-acpi \ +-boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial \ +none -parallel none -usb diff --git a/tests/qemuxml2argvdata/qemuxml2argv-minimal-s390.xml b/tests/qemuxml2argvdata/qemuxml2argv-minimal-s390.xml new file mode 100644 index 0000000..7378bd4 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-minimal-s390.xml @@ -0,0 +1,21 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory>219100</memory> + <currentMemory>219100</currentMemory> + <os> + <type arch='s390x' machine='s390-virtio'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu</emulator> + <disk type='block' device='disk'> + <source dev='/dev/HostVG/QEMUGuest1'/> + <target dev='hda' bus='virtio'/> + </disk> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-s390.args b/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-s390.args new file mode 100644 index 0000000..700ea84 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-s390.args @@ -0,0 +1,5 @@ +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S \ +-M s390-virtio -m 214 -smp 1 -nographic -nodefaults \ +-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \ +-device virtio-net-s390,vlan=0,id=net0,mac=00:11:22:33:44:55 \ +-net user,vlan=0,name=hostnet0 -usb diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-s390.xml b/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-s390.xml new file mode 100644 index 0000000..f42fadd --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-s390.xml @@ -0,0 +1,22 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory>219136</memory> + <currentMemory>219136</currentMemory> + <vcpu>1</vcpu> + <os> + <type arch='s390x' machine='s390-virtio'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu</emulator> + <interface type='user'> + <mac address='00:11:22:33:44:55'/> + <model type='virtio'/> + </interface> + </devices> +</domain> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index cda32b6..a4fa8fe 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -341,6 +341,7 @@ mymain(void) unsetenv("SDL_AUDIODRIVER");
DO_TEST("minimal", false, QEMU_CAPS_NAME); + DO_TEST("minimal-s390", false, QEMU_CAPS_NAME); DO_TEST("machine-aliases1", false, NONE); DO_TEST("machine-aliases2", true, NONE); DO_TEST("boot-cdrom", false, NONE); @@ -393,6 +394,8 @@ mymain(void) QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE); DO_TEST("disk-many", false, NONE); DO_TEST("disk-virtio", false, QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_BOOT); + DO_TEST("disk-virtio-s390", false, QEMU_CAPS_DRIVE, + QEMU_CAPS_DEVICE, QEMU_CAPS_VIRTIO_S390); DO_TEST("disk-order", false, QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE_BOOT, QEMU_CAPS_VIRTIO_BLK_SCSI, QEMU_CAPS_VIRTIO_BLK_SG_IO); @@ -552,6 +555,8 @@ mymain(void) QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_VIRTIO_TX_ALG); DO_TEST("net-virtio-netdev", false, QEMU_CAPS_DEVICE, QEMU_CAPS_NETDEV, QEMU_CAPS_NODEFCONFIG); + DO_TEST("net-virtio-s390", false, + QEMU_CAPS_DEVICE, QEMU_CAPS_VIRTIO_S390); DO_TEST("net-eth", false, NONE); DO_TEST("net-eth-ifname", false, NONE); DO_TEST("net-eth-names", false, QEMU_CAPS_NET_NAME); @@ -609,6 +614,9 @@ mymain(void) QEMU_CAPS_DEVICE, QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG); DO_TEST("console-virtio-many", false, QEMU_CAPS_DEVICE, QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG); + DO_TEST("console-virtio-s390", false, + QEMU_CAPS_DEVICE, QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG, + QEMU_CAPS_DRIVE, QEMU_CAPS_VIRTIO_S390); DO_TEST("channel-spicevmc", false, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_SPICE, QEMU_CAPS_CHARDEV_SPICEVMC); diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c index 8d5a3bf..74b9122 100644 --- a/tests/testutilsqemu.c +++ b/tests/testutilsqemu.c @@ -87,6 +87,34 @@ error: return -1; }
+static int testQemuAddS390Guest(virCapsPtr caps) +{ + static const char *s390_machines[] = { "s390-virtio"}; + virCapsGuestMachinePtr *machines = NULL; + virCapsGuestPtr guest; + + machines = virCapabilitiesAllocMachines(s390_machines, + ARRAY_CARDINALITY(s390_machines)); + if (!machines) + goto error; + + guest = virCapabilitiesAddGuest(caps, "hvm", "s390x", 64, + "/usr/bin/qemu-system-s390x", NULL, + ARRAY_CARDINALITY(s390_machines), + machines); + if (!guest) + goto error; + + if (!virCapabilitiesAddGuestDomain(guest, "qemu", NULL, NULL, 0, NULL)) + goto error; + + return 0; + +error: + virCapabilitiesFreeMachines(machines, ARRAY_CARDINALITY(s390_machines)); + return -1; +} + virCapsPtr testQemuCapsInit(void) { virCapsPtr caps; virCapsGuestPtr guest; @@ -208,6 +236,9 @@ virCapsPtr testQemuCapsInit(void) { if (testQemuAddPPC64Guest(caps)) goto cleanup;
+ if (testQemuAddS390Guest(caps)) + goto cleanup; + if (virTestGetDebug()) { char *caps_str;
Looking good. ACK. Michal

On 29.06.2012 17:02, Viktor Mihajlovski wrote:
As 0.9.13 is stabilizing and I will not be available next week I am sending this reworked patch set already today, looking forward to comments.
This series adds support for the s390 flavor of virtio devices. Since the s390 virtio devices are not implemented as PCI devices it is necessary to refactor some of the device address assignment code.
v2 changes resent as thread
v3 changes renumbered new virtio-s390 capability fixed incorrect whitespace fixed subject lines
Viktor Mihajlovski (5): qemu: Extended qemuDomainAssignAddresses to be callable from everywhere. qemu: Change tests to use (modified) qemuDomainAssignAddresses S390: Add support for virtio-s390 devices. S390: Domain Schema for s390-virtio machines. S390: Adding testcases for s390
docs/schemas/domaincommon.rng | 20 +++ src/conf/domain_conf.c | 11 +- src/conf/domain_conf.h | 1 + src/qemu/qemu_capabilities.c | 7 + src/qemu/qemu_capabilities.h | 1 + src/qemu/qemu_command.c | 139 ++++++++++++++++++-- src/qemu/qemu_command.h | 6 +- src/qemu/qemu_driver.c | 14 +- src/qemu/qemu_process.c | 42 +------ .../qemuxml2argv-console-virtio-s390.args | 9 ++ .../qemuxml2argv-console-virtio-s390.xml | 24 ++++ .../qemuxml2argv-disk-virtio-s390.args | 5 + .../qemuxml2argv-disk-virtio-s390.xml | 22 +++ .../qemuxml2argv-minimal-s390.args | 5 + .../qemuxml2argvdata/qemuxml2argv-minimal-s390.xml | 21 +++ .../qemuxml2argv-net-virtio-s390.args | 5 + .../qemuxml2argv-net-virtio-s390.xml | 22 +++ tests/qemuxml2argvtest.c | 20 ++-- tests/qemuxmlnstest.c | 13 +-- tests/testutilsqemu.c | 31 +++++ 20 files changed, 332 insertions(+), 86 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-console-virtio-s390.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-console-virtio-s390.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-s390.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-s390.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-minimal-s390.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-minimal-s390.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-net-virtio-s390.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-net-virtio-s390.xml
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Overall I think this is in a good shape except patch 3/5 where we are missing some documentation. So Viktor, if you'll send it into the list I can push this then. I am keeping this patch set on my local branch with all diffs I've pointed out squashed in. So there's no need to resend whole set again. Michal
participants (2)
-
Michal Privoznik
-
Viktor Mihajlovski