mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 14:15:28 +00:00
libxl: pass ipaddr to libxl toolstack
Do not silently ignore its value. LibXL support only one address, so refuse multiple IPs. Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
This commit is contained in:
parent
104ba5966a
commit
8703ee58bd
@ -1051,6 +1051,11 @@ libxlMakeNic(virDomainDefPtr def,
|
||||
case VIR_DOMAIN_NET_TYPE_ETHERNET:
|
||||
if (VIR_STRDUP(x_nic->script, l_nic->script) < 0)
|
||||
return -1;
|
||||
if (l_nic->nips > 0) {
|
||||
x_nic->ip = virSocketAddrFormat(&l_nic->ips[0]->address);
|
||||
if (!x_nic->ip)
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
case VIR_DOMAIN_NET_TYPE_NETWORK:
|
||||
{
|
||||
@ -1068,6 +1073,12 @@ libxlMakeNic(virDomainDefPtr def,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (l_nic->nips > 0) {
|
||||
x_nic->ip = virSocketAddrFormat(&l_nic->ips[0]->address);
|
||||
if (!x_nic->ip)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((brname = virNetworkGetBridgeName(network))) {
|
||||
if (VIR_STRDUP(x_nic->bridge, brname) < 0)
|
||||
fail = true;
|
||||
|
@ -482,6 +482,18 @@ libxlDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
|
||||
STRNEQ(def->os.type, "hvm"))
|
||||
dev->data.chr->targetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_XEN;
|
||||
|
||||
if (dev->type == VIR_DOMAIN_DEVICE_NET &&
|
||||
(dev->data.net->type == VIR_DOMAIN_NET_TYPE_BRIDGE ||
|
||||
dev->data.net->type == VIR_DOMAIN_NET_TYPE_ETHERNET ||
|
||||
dev->data.net->type == VIR_DOMAIN_NET_TYPE_NETWORK)) {
|
||||
if (dev->data.net->nips > 1) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("multiple IP addresses not supported on device type %s"),
|
||||
virDomainNetTypeToString(dev->data.net->type));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV ||
|
||||
(dev->type == VIR_DOMAIN_DEVICE_NET &&
|
||||
dev->data.net->type == VIR_DOMAIN_NET_TYPE_HOSTDEV)) {
|
||||
|
Loading…
Reference in New Issue
Block a user