[libvirt] [PATCHv3 07/16] Domain network devices can now have a <gateway> element
Daniel P. Berrange
berrange at redhat.com
Wed Oct 22 10:12:38 UTC 2014
On Fri, Oct 10, 2014 at 02:03:59PM +0200, Cédric Bosdonnat wrote:
> Network interfaces devices and host devices with net capabilities can
> now have an IPv4 and/or an IPv6 address configured.
> ---
> docs/formatdomain.html.in | 9 ++++++++
> docs/schemas/domaincommon.rng | 23 ++++++++++++++++++++
> src/conf/domain_conf.c | 42 ++++++++++++++++++++++++++++++++++++
> src/conf/domain_conf.h | 4 ++++
> tests/lxcxml2xmldata/lxc-hostdev.xml | 1 +
> tests/lxcxml2xmldata/lxc-idmap.xml | 1 +
> 6 files changed, 80 insertions(+)
>
> diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
> index e07a298..a925b6f 100644
> --- a/docs/formatdomain.html.in
> +++ b/docs/formatdomain.html.in
> @@ -4248,6 +4248,7 @@ qemu-kvm -net nic,model=? /dev/null
> <source network='default'/>
> <target dev='vnet0'/>
> <b><ip address='192.168.122.5' prefix='24'/></b>
> + <b><gateway ipv4='192.168.122.1'/></b>
> </interface>
> ...
> <hostdev mode='capabilities' type='net'>
> @@ -4255,6 +4256,7 @@ qemu-kvm -net nic,model=? /dev/null
> <interface>eth0</interface>
> </source>
> <b><ip address='192.168.122.6' prefix='24'/></b>
> + <b><gateway ipv4='192.168.122.1'/></b>
I think I'd expect this to look more like this:
<gateway family="ipv4" address="192.168.122.1"/>
<gateway family="ipv6" address="1:2:3::4"/>
We can still store it in the internal struct in the way you have
it here though.
> diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
> index bf0e2eb..5df97c4 100644
> --- a/src/conf/domain_conf.h
> +++ b/src/conf/domain_conf.h
> @@ -495,6 +495,8 @@ struct _virDomainHostdevCaps {
> char *iface;
> size_t nips;
> virDomainNetIpDefPtr *ips;
> + char *gateway_ipv4;
> + char *gateway_ipv6;
> } net;
> } u;
> };
> @@ -988,6 +990,8 @@ struct _virDomainNetDef {
> int linkstate;
> size_t nips;
> virDomainNetIpDefPtr *ips;
> + char *gateway_ipv4;
> + char *gateway_ipv6;
I think these ought to use virSocketAddr though, so we have
syntactic validation at time of parsing.
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