aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLi Zhang <zhlcindy@linux.vnet.ibm.com>2012-05-29 16:35:17 +0800
committerEric Blake <eblake@redhat.com>2012-06-07 14:32:27 -0600
commit04a319ba4e5f82e56af47e18dc055e5735ddd74d (patch)
tree8a9410044ab2db262e01043359be31bcdc5661ab /src
parentmaint: make it easier to copy FORTIFY_SOURCE snippet (diff)
downloadlibvirt-04a319ba4e5f82e56af47e18dc055e5735ddd74d.tar.gz
libvirt-04a319ba4e5f82e56af47e18dc055e5735ddd74d.tar.bz2
libvirt-04a319ba4e5f82e56af47e18dc055e5735ddd74d.zip
Assign correct address type to spapr-vlan and spapr-vty.
For pseries guest, spapr-vlan and spapr-vty is based on spapr-vio address. According to model of network device, the address type should be assigned automatically. For serial device, serial pty device is recognized as spapr-vty device, which is also on spapr-vio. So this patch is to correct the address type of spapr-vlan and spapr-vty, and build correct command line of spapr-vty. Signed-off-by: Li Zhang <zhlcindy@linux.vnet.ibm.com> Reviewed-by: Michael Ellerman<michaele@au1.ibm.com>
Diffstat (limited to 'src')
-rw-r--r--src/qemu/qemu_command.c31
1 files changed, 21 insertions, 10 deletions
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index fb8d9a3cf..a34c707aa 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -795,6 +795,9 @@ int qemuDomainAssignSpaprVIOAddresses(virDomainDefPtr def)
/* Default values match QEMU. See spapr_(llan|vscsi|vty).c */
for (i = 0 ; i < def->nnets; i++) {
+ if (def->nets[i]->model &&
+ STREQ(def->nets[i]->model, "spapr-vlan"))
+ def->nets[i]->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO;
rc = qemuAssignSpaprVIOAddress(def, &def->nets[i]->info,
0x1000ul);
if (rc)
@@ -807,16 +810,20 @@ int qemuDomainAssignSpaprVIOAddresses(virDomainDefPtr def)
def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI)
model = qemuDefaultScsiControllerModel(def);
if (model == VIR_DOMAIN_CONTROLLER_MODEL_SCSI_IBMVSCSI &&
- def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI) {
+ def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI)
def->controllers[i]->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO;
- rc = qemuAssignSpaprVIOAddress(def, &def->controllers[i]->info,
- 0x2000ul);
- if (rc)
- return rc;
- }
+ rc = qemuAssignSpaprVIOAddress(def, &def->controllers[i]->info,
+ 0x2000ul);
+ if (rc)
+ return rc;
}
for (i = 0 ; i < def->nserials; i++) {
+ if (def->serials[i]->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL &&
+ def->serials[i]->source.type == VIR_DOMAIN_CHR_TYPE_PTY &&
+ STREQ(def->os.arch, "ppc64") &&
+ STREQ(def->os.machine, "pseries"))
+ def->serials[i]->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO;
rc = qemuAssignSpaprVIOAddress(def, &def->serials[i]->info,
0x30000000ul);
if (rc)
@@ -6183,10 +6190,14 @@ qemuBuildChrDeviceStr(virDomainChrDefPtr serial,
virBuffer cmd = VIR_BUFFER_INITIALIZER;
if (STREQ(os_arch, "ppc64") && STREQ(machine, "pseries")) {
- virBufferAsprintf(&cmd, "spapr-vty,chardev=char%s",
- serial->info.alias);
- if (qemuBuildDeviceAddressStr(&cmd, &serial->info, qemuCaps) < 0)
- goto error;
+ if (serial->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL &&
+ serial->source.type == VIR_DOMAIN_CHR_TYPE_PTY &&
+ serial->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO) {
+ virBufferAsprintf(&cmd, "spapr-vty,chardev=char%s",
+ serial->info.alias);
+ if (qemuBuildDeviceAddressStr(&cmd, &serial->info, qemuCaps) < 0)
+ goto error;
+ }
} else
virBufferAsprintf(&cmd, "isa-serial,chardev=char%s,id=%s",
serial->info.alias, serial->info.alias);