diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 22dc871b81e117956d6ac50df6d072e24eb4371a..032ead11bfdea5df8278e0a76b64231a2aa6aa2d 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -4581,8 +4581,11 @@ qemuBuildCommandLine(virConnectPtr conn, VIR_FREE(devstr); virCommandAddArg(cmd, "-device"); - virCommandAddArgFormat(cmd, "isa-serial,chardev=char%s,id=%s", - serial->info.alias, serial->info.alias); + if (!(devstr = qemuBuildChrDeviceStr(serial, def->os.arch, + def->os.machine))) + goto error; + virCommandAddArg(cmd, devstr); + VIR_FREE(devstr); } else { virCommandAddArg(cmd, "-serial"); if (!(devstr = qemuBuildChrArgStr(&serial->source, NULL))) @@ -5469,6 +5472,34 @@ qemuBuildCommandLine(virConnectPtr conn, return NULL; } +/* This function generates the correct '-device' string for character + * devices of each architecture. + */ +char * +qemuBuildChrDeviceStr(virDomainChrDefPtr serial, + char *os_arch, + char *machine) +{ + virBuffer cmd = VIR_BUFFER_INITIALIZER; + + if (STREQ(os_arch, "ppc64") && STREQ(machine, "pseries")) + virBufferAsprintf(&cmd, "spapr-vty,chardev=char%s", + serial->info.alias); + else + virBufferAsprintf(&cmd, "isa-serial,chardev=char%s,id=%s", + serial->info.alias, serial->info.alias); + + if (virBufferError(&cmd)) { + virReportOOMError(); + goto error; + } + + return virBufferContentAndReset(&cmd); + + error: + virBufferFreeAndReset(&cmd); + return NULL; +} /* * This method takes a string representing a QEMU command line ARGV set @@ -6680,8 +6711,7 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr caps, def->maxvcpus = 1; def->vcpus = 1; def->clock.offset = VIR_DOMAIN_CLOCK_OFFSET_UTC; - def->features = (1 << VIR_DOMAIN_FEATURE_ACPI) - /*| (1 << VIR_DOMAIN_FEATURE_APIC)*/; + def->onReboot = VIR_DOMAIN_LIFECYCLE_RESTART; def->onCrash = VIR_DOMAIN_LIFECYCLE_DESTROY; def->onPoweroff = VIR_DOMAIN_LIFECYCLE_DESTROY; @@ -6716,6 +6746,9 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr caps, if (!def->os.arch) goto no_memory; + if (STREQ(def->os.arch, "i686")||STREQ(def->os.arch, "x86_64")) + def->features = (1 << VIR_DOMAIN_FEATURE_ACPI) + /*| (1 << VIR_DOMAIN_FEATURE_APIC)*/; #define WANT_VALUE() \ const char *val = progargv[++i]; \ if (!val) { \ diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h index dbe2fb23b1cce0bb929290c3b418d48356072cdc..1fe039415f92201d10316627720a804022bd950c 100644 --- a/src/qemu/qemu_command.h +++ b/src/qemu/qemu_command.h @@ -53,6 +53,12 @@ virCommandPtr qemuBuildCommandLine(virConnectPtr conn, enum virNetDevVPortProfileOp vmop) ATTRIBUTE_NONNULL(1); +/* Generate string for arch-specific '-device' parameter */ +char * +qemuBuildChrDeviceStr (virDomainChrDefPtr serial, + char *os_arch, + char *machine); + /* With vlan == -1, use netdev syntax, else old hostnet */ char * qemuBuildHostNetStr(virDomainNetDefPtr net, char type_sep,