Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12:Update
libvirt
e85df090-error-multiple-ips.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File e85df090-error-multiple-ips.patch of Package libvirt
From e85df0901d6cbfa3c1f3a6b24b2ca7df45ecc638 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Bosdonnat?= <cbosdonnat@suse.com> Date: Wed, 12 Nov 2014 16:58:38 +0100 Subject: [PATCH 17/17] Report error if a driver can't handle multiple IP addresses Drivers supporting one and only one IP address raise an error if more IP addresses are configured. --- src/xenconfig/xen_common.c | 12 ++++++++++-- src/xenconfig/xen_sxpr.c | 12 ++++++++++-- 3 files changed, 29 insertions(+), 7 deletions(-) Index: libvirt-1.2.5/src/xenxs/xen_sxpr.c =================================================================== --- libvirt-1.2.5.orig/src/xenxs/xen_sxpr.c +++ libvirt-1.2.5/src/xenxs/xen_sxpr.c @@ -1895,10 +1895,14 @@ xenFormatSxprNet(virConnectPtr conn, script = def->script; virBufferEscapeSexpr(buf, "(script '%s')", script); - if (def->nips > 0) { + if (def->nips == 1) { char *ipStr = virSocketAddrFormat(&def->ips[0]->address); virBufferEscapeSexpr(buf, "(ip '%s')", ipStr); VIR_FREE(ipStr); + } else if (def->nips > 1) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Driver does not support setting multiple IP addresses")); + return -1; } break; @@ -1932,10 +1936,14 @@ xenFormatSxprNet(virConnectPtr conn, if (def->script) virBufferEscapeSexpr(buf, "(script '%s')", def->script); - if (def->nips > 0) { + if (def->nips == 1) { char *ipStr = virSocketAddrFormat(&def->ips[0]->address); virBufferEscapeSexpr(buf, "(ip '%s')", ipStr); VIR_FREE(ipStr); + } else if (def->nips > 1) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Driver does not support setting multiple IP addresses")); + return -1; } break; Index: libvirt-1.2.5/src/xenxs/xen_xm.c =================================================================== --- libvirt-1.2.5.orig/src/xenxs/xen_xm.c +++ libvirt-1.2.5/src/xenxs/xen_xm.c @@ -1336,10 +1336,14 @@ static int xenFormatXMNet(virConnectPtr switch (net->type) { case VIR_DOMAIN_NET_TYPE_BRIDGE: virBufferAsprintf(&buf, ",bridge=%s", net->data.bridge.brname); - if (net->nips > 0) { + if (net->nips == 1) { char *ipStr = virSocketAddrFormat(&net->ips[0]->address); virBufferAsprintf(&buf, ",ip=%s", ipStr); VIR_FREE(ipStr); + } else if (net->nips > 1) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Driver does not support setting multiple IP addresses")); + goto cleanup; } virBufferAsprintf(&buf, ",script=%s", DEFAULT_VIF_SCRIPT); break; @@ -1347,10 +1351,14 @@ static int xenFormatXMNet(virConnectPtr case VIR_DOMAIN_NET_TYPE_ETHERNET: if (net->script) virBufferAsprintf(&buf, ",script=%s", net->script); - if (net->nips > 0) { + if (net->nips == 1) { char *ipStr = virSocketAddrFormat(&net->ips[0]->address); virBufferAsprintf(&buf, ",ip=%s", ipStr); VIR_FREE(ipStr); + } else if (net->nips > 1) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Driver does not support setting multiple IP addresses")); + goto cleanup; } break;
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor