[libvirt] [PATCH RFC 2/2] libxl: set net device prefix
Daniel P. Berrange
berrange at redhat.com
Fri Jan 22 14:51:17 UTC 2016
On Wed, Jan 20, 2016 at 11:41:27PM +0000, Joao Martins wrote:
> Use the newly added virCapabilitiesSetNetPrefix to set
> the network prefix for the driver. This in return will
> be use by NetDefFormat() and NetDefParseXML() routines
> to free any interface name that start with the registered
> prefix.
>
> Signed-off-by: Joao Martins <joao.m.martins at oracle.com>
> ---
> src/libxl/libxl_conf.c | 3 +++
> src/libxl/libxl_conf.h | 4 ++++
> 2 files changed, 7 insertions(+)
>
> diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
> index 6320421..d7fb533 100644
> --- a/src/libxl/libxl_conf.c
> +++ b/src/libxl/libxl_conf.c
> @@ -183,6 +183,9 @@ libxlCapsInitHost(libxl_ctx *ctx, virCapsPtr caps)
> virCapabilitiesAddHostFeature(caps, "pae") < 0)
> return -1;
>
> + if (virCapabilitiesSetNetPrefix(caps, LIBXL_GENERATED_PREFIX_XEN) < 0)
> + return -1;
> +
> return 0;
> }
>
> diff --git a/src/libxl/libxl_conf.h b/src/libxl/libxl_conf.h
> index 7c68b2b..6ad9ad3 100644
> --- a/src/libxl/libxl_conf.h
> +++ b/src/libxl/libxl_conf.h
> @@ -47,6 +47,10 @@
> # define LIBXL_MIGRATION_PORT_MIN 49152
> # define LIBXL_MIGRATION_PORT_MAX 49216
>
> +/* Used for prefix of ifname of any network name generated dynamically
> + * by libvirt for Xen, and cannot be used for a persistent network name. */
> +# define LIBXL_GENERATED_PREFIX_XEN "vif"
> +
> # define LIBXL_CONFIG_BASE_DIR SYSCONFDIR "/libvirt"
> # define LIBXL_CONFIG_DIR SYSCONFDIR "/libvirt/libxl"
> # define LIBXL_AUTOSTART_DIR LIBXL_CONFIG_DIR "/autostart"
ACK
Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
More information about the libvir-list
mailing list