[libvirt] [PATCHv2 05/10] libxl: pass ipaddr to libxl toolstack
Jim Fehlig
jfehlig at suse.com
Thu Feb 12 02:09:17 UTC 2015
Marek Marczykowski-Górecki wrote:
> Updated patch below.
>
> -----8<-----
> From c1bd7134d4d70a06229243c41284eb37daa35f38 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?=
> <marmarek at invisiblethingslab.com>
> Date: Thu, 5 Feb 2015 05:59:30 +0100
> Subject: [PATCH] libxl: pass ipaddr to libxl toolstack
> Cc: Marek Marczykowski-Górecki <marmarek at invisiblethingslab.com>
>
> Do not silently ignore its value. LibXL support only one address, so
> refuse multiple IPs.
>
> Signed-off-by: Marek Marczykowski-Górecki <marmarek at invisiblethingslab.com>
> ---
> src/libxl/libxl_conf.c | 11 +++++++++++
> src/libxl/libxl_domain.c | 12 ++++++++++++
> 2 files changed, 23 insertions(+)
>
> diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
> index c9f8ad5..ec0f67a 100644
> --- a/src/libxl/libxl_conf.c
> +++ b/src/libxl/libxl_conf.c
> @@ -1133,6 +1133,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:
> {
> @@ -1150,6 +1155,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;
> diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
> index 856cfb4..f0eaf6c 100644
> --- a/src/libxl/libxl_domain.c
> +++ b/src/libxl/libxl_domain.c
> @@ -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)) {
>
ACK and pushed.
Sorry I've stalled on reviewing your series. My libvirt timeslices have
been consumed by fixing deadlocks and libxl assertions
https://www.redhat.com/archives/libvir-list/2015-February/msg00024.html
As suggested by Ian Jackson, I'm working on a series to remove the
per-domain libxl_ctx. Those are remnants from the Xen 4.1 libxl days
and are no longer required in newer libxl. I have a fair bit of testing
to finish, but the series is looking promising thus far.
Regards,
Jim
More information about the libvir-list
mailing list