[libvirt] [Patch 0/4] PowerPC fixes for libvirt

This patch set addresses some miscellaneous fixes for libvirt on PowerPC. Details: Patch 1/4 : This adds 'qemu-system-ppc64' as the default emulator for ppc64 & ppc64le guests. Patch 2/4 : Fixes a small error where not specifying a CPU model leads to a NULL compat specification. Patch 3/4 : This introduces 'ppc64le' and newer pseries machine types to domain schema. Patch 4/4 : Forbids floppy devices in domain XML. Regards, -- Prerna Saxena Linux Technology Centre, IBM Systems and Technology Lab, Bangalore, India

PowerPC : Explicitly associate 'qemu-system-ppc64' as the default emulator for all 64-bit PowerPC guests ( both Big & Little Endian ) Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com> --- src/qemu/qemu_capabilities.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index a04095e..4596f6c 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -673,9 +673,14 @@ virQEMUCapsFindBinaryForArch(virArch hostarch, virArch guestarch) { char *ret; - const char *archstr = virQEMUCapsArchToString(guestarch); + const char *archstr; char *binary; + if (ARCH_IS_PPC64(guestarch)) + archstr = virQEMUCapsArchToString(VIR_ARCH_PPC64); + else + archstr = virQEMUCapsArchToString(guestarch); + if (virAsprintf(&binary, "qemu-system-%s", archstr) < 0) return NULL; -- 1.9.3 -- Prerna Saxena Linux Technology Centre, IBM Systems and Technology Lab, Bangalore, India

On Sun, Feb 15, 2015 at 09:48:00AM +0530, Prerna Saxena wrote:
PowerPC : Explicitly associate 'qemu-system-ppc64' as the default emulator for all 64-bit PowerPC guests ( both Big & Little Endian )
Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com> --- src/qemu/qemu_capabilities.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
ACK Jan

PowerPC : Forbid NULL CPU model with 'host-model' mode in qemu command line. This ensures that an XML such as following: ... <cpu mode='host-model'> <model fallback='allow'/> </cpu> ... will not generate a '-cpu host,compat=(null)' command line with qemu-system-ppc64. Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com> --- src/qemu/qemu_command.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 9c25788..317bb19 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6685,7 +6685,8 @@ qemuBuildCpuModelArgStr(virQEMUDriverPtr driver, virBufferAddLit(buf, "host"); if (ARCH_IS_PPC64(def->os.arch) && - cpu->mode == VIR_CPU_MODE_HOST_MODEL) { + cpu->mode == VIR_CPU_MODE_HOST_MODEL && + def->cpu->model != NULL) { virBufferAsprintf(buf, ",compat=%s", def->cpu->model); } else { featCpu = cpu; -- 1.9.3 -- Prerna Saxena Linux Technology Centre, IBM Systems and Technology Lab, Bangalore, India

On Sun, Feb 15, 2015 at 09:54:15AM +0530, Prerna Saxena wrote:
PowerPC : Forbid NULL CPU model with 'host-model' mode in qemu command line.
This ensures that an XML such as following: ... <cpu mode='host-model'> <model fallback='allow'/> </cpu> ...
will not generate a '-cpu host,compat=(null)' command line with qemu-system-ppc64.
Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com> --- src/qemu/qemu_command.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
ACK
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 9c25788..317bb19 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6685,7 +6685,8 @@ qemuBuildCpuModelArgStr(virQEMUDriverPtr driver, virBufferAddLit(buf, "host");
if (ARCH_IS_PPC64(def->os.arch) && - cpu->mode == VIR_CPU_MODE_HOST_MODEL) { + cpu->mode == VIR_CPU_MODE_HOST_MODEL && + def->cpu->model != NULL) { virBufferAsprintf(buf, ",compat=%s", def->cpu->model);
So we skip over setting featCpu when using compat=. Is it possible to specify custom features together with compat=? If so, it seems commit adff345 (released in v1.2.12) broke this. Jan
} else { featCpu = cpu; -- 1.9.3
-- Prerna Saxena
Linux Technology Centre, IBM Systems and Technology Lab, Bangalore, India
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list

PowerPC: Augment XML schema to include 'ppc64le' arch and newer pseries-2.* machine types. Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com> --- docs/schemas/basictypes.rng | 1 + docs/schemas/domaincommon.rng | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/schemas/basictypes.rng b/docs/schemas/basictypes.rng index 2bc9c1b..3e1841c 100644 --- a/docs/schemas/basictypes.rng +++ b/docs/schemas/basictypes.rng @@ -333,6 +333,7 @@ <value>parisc64</value> <value>ppc</value> <value>ppc64</value> + <value>ppc64le</value> <value>ppcemb</value> <value>s390</value> <value>s390x</value> diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index d467dce..3a91365 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -412,13 +412,18 @@ <group> <optional> <attribute name="arch"> - <value>ppc64</value> + <choice> + <value>ppc64</value> + <value>ppc64le</value> + </choice> </attribute> </optional> <optional> <attribute name="machine"> <choice> <value>pseries</value> + <value>pseries-2.1</value> + <value>pseries-2.2</value> </choice> </attribute> </optional> -- 1.9.3 -- Prerna Saxena Linux Technology Centre, IBM Systems and Technology Lab, Bangalore, India

On Sun, Feb 15, 2015 at 09:56:03AM +0530, Prerna Saxena wrote:
PowerPC: Augment XML schema to include 'ppc64le' arch and newer pseries-2.* machine types.
Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com> --- docs/schemas/basictypes.rng | 1 + docs/schemas/domaincommon.rng | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-)
Test cases for qemuxml2argv/qemuxml2xml would be nice. Jan

Subject: [PATCH 4/4] PowerPC : Do not allow floppy disks in domain XML. PowerKVM does not support floppy disks. Ensure that libvirt honours this. Fixes : https://bugzilla.redhat.com/show_bug.cgi?id=1180486 Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com> --- src/conf/domain_conf.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 6a57d80..df3a768 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -13892,6 +13892,14 @@ virDomainDefParseXML(xmlDocPtr xml, if (!disk) goto error; + if (ARCH_IS_PPC64(def->os.arch) && + STREQLEN(def->os.machine, "pseries", 7) && + disk->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Pseries machine does not support floppy device")); + goto error; + } + virDomainDiskInsertPreAlloced(def, disk); } VIR_FREE(nodes); -- 1.9.3 -- Prerna Saxena Linux Technology Centre, IBM Systems and Technology Lab, Bangalore, India

On Sun, Feb 15, 2015 at 10:02:25AM +0530, Prerna Saxena wrote:
Subject: [PATCH 4/4] PowerPC : Do not allow floppy disks in domain XML.
PowerKVM does not support floppy disks. Ensure that libvirt honours this. Fixes : https://bugzilla.redhat.com/show_bug.cgi?id=1180486
Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com> --- src/conf/domain_conf.c | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 6a57d80..df3a768 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -13892,6 +13892,14 @@ virDomainDefParseXML(xmlDocPtr xml, if (!disk) goto error;
+ if (ARCH_IS_PPC64(def->os.arch) && + STREQLEN(def->os.machine, "pseries", 7) &&
Using STRPREFIX eliminates the magic constant.
+ disk->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY) { + virReportError(VIR_ERR_INTERNAL_ERROR,
VIR_ERR_CONFIG_UNSUPPORTED would be a better code.
+ _("Pseries machine does not support floppy device"));
This fails 'make syntax-check': src/conf/domain_conf.c:14067: virReportError(VIR_ERR_INTERNAL_ERROR, src/conf/domain_conf.c-14068- _("Pseries machine does not support floppy device")); maint.mk: found diagnostic without % cfg.mk:657: recipe for target 'sc_prohibit_diagnostic_without_format'failed Jan

On Sun, Feb 15, 2015 at 09:45:25AM +0530, Prerna Saxena wrote:
This patch set addresses some miscellaneous fixes for libvirt on PowerPC.
Details: Patch 1/4 : This adds 'qemu-system-ppc64' as the default emulator for ppc64 & ppc64le guests. Patch 2/4 : Fixes a small error where not specifying a CPU model leads to a NULL compat specification.
I have pushed the first two patches.
Patch 3/4 : This introduces 'ppc64le' and newer pseries machine types to domain schema. Patch 4/4 : Forbids floppy devices in domain XML.
These would be better if they included some test cases (so would 2/4, but adding a different host cpu to the test suite is not that trivial). Jan

On Tuesday 17 February 2015 06:33 PM, Ján Tomko wrote:
On Sun, Feb 15, 2015 at 09:45:25AM +0530, Prerna Saxena wrote:
This patch set addresses some miscellaneous fixes for libvirt on PowerPC.
Details: Patch 1/4 : This adds 'qemu-system-ppc64' as the default emulator for ppc64 & ppc64le guests. Patch 2/4 : Fixes a small error where not specifying a CPU model leads to a NULL compat specification. I have pushed the first two patches.
Patch 3/4 : This introduces 'ppc64le' and newer pseries machine types to domain schema. Patch 4/4 : Forbids floppy devices in domain XML. These would be better if they included some test cases (so would 2/4, but adding a different host cpu to the test suite is not that trivial).
Jan
Thanks for pushing patches 1,2. I will add testcases and resend patch #3. As discussed with you, I will rework Patch #4 in line with https://www.redhat.com/archives/libvir-list/2015-February/msg00410.html Regards, -- Prerna Saxena Linux Technology Centre, IBM Systems and Technology Lab, Bangalore, India
participants (2)
-
Ján Tomko
-
Prerna Saxena