[libvirt] [PATCH RESEND] S390: Assign default model "virtio" for network interfaces

If a network interface model is not specified, libvirt will run into an unchecked NULL pointer coredump. On the other hand if the empty model is ignored, a PCI bus address would be generated, which is not supported by S390. Since the only valid network type model for S390 is virtio, we use this as the default value, which is the same for QEMU. Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com> --- src/qemu/qemu_command.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 5335dcf..9009bd2 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -810,9 +810,14 @@ qemuDomainPrimeS390VirtioDevices(virDomainDefPtr def, } for (i = 0; i < def->nnets ; i++) { + if (STRPREFIX(def->os.arch, "s390") && + def->nets[i]->model == NULL) { + def->nets[i]->model = strdup("virtio"); + } if (STREQ(def->nets[i]->model,"virtio") && - def->nets[i]->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) + def->nets[i]->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) { def->nets[i]->info.type = type; + } } for (i = 0; i < def->ncontrollers ; i++) { -- 1.7.0.4

On 10.12.2012 11:00, Viktor Mihajlovski wrote:
If a network interface model is not specified, libvirt will run into an unchecked NULL pointer coredump. On the other hand if the empty model is ignored, a PCI bus address would be generated, which is not supported by S390. Since the only valid network type model for S390 is virtio, we use this as the default value, which is the same for QEMU.
Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com> --- src/qemu/qemu_command.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 5335dcf..9009bd2 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -810,9 +810,14 @@ qemuDomainPrimeS390VirtioDevices(virDomainDefPtr def, }
for (i = 0; i < def->nnets ; i++) { + if (STRPREFIX(def->os.arch, "s390") && + def->nets[i]->model == NULL) { + def->nets[i]->model = strdup("virtio"); + } if (STREQ(def->nets[i]->model,"virtio") && - def->nets[i]->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) + def->nets[i]->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) { def->nets[i]->info.type = type; + } }
for (i = 0; i < def->ncontrollers ; i++) {
ACKed and pushed. Michal

On 12/10/2012 03:15 PM, Michal Privoznik wrote:
On 10.12.2012 11:00, Viktor Mihajlovski wrote:
If a network interface model is not specified, libvirt will run into an unchecked NULL pointer coredump. On the other hand if the empty model is ignored, a PCI bus address would be generated, which is not supported by S390. Since the only valid network type model for S390 is virtio, we use this as the default value, which is the same for QEMU.
Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com> --- src/qemu/qemu_command.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 5335dcf..9009bd2 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -810,9 +810,14 @@ qemuDomainPrimeS390VirtioDevices(virDomainDefPtr def, }
for (i = 0; i < def->nnets ; i++) { + if (STRPREFIX(def->os.arch, "s390") && + def->nets[i]->model == NULL) { + def->nets[i]->model = strdup("virtio"); + } if (STREQ(def->nets[i]->model,"virtio") && - def->nets[i]->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) + def->nets[i]->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) { def->nets[i]->info.type = type; + } }
for (i = 0; i < def->ncontrollers ; i++) {
ACKed and pushed.
Michal
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
participants (2)
-
Michal Privoznik
-
Viktor Mihajlovski