Re: [PATCH 04/16] LXC from native: implement no network conversion

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jan 14, 2014 at 02:49:53PM +0100, Cédric Bosdonnat wrote:
> If no network configuration is provided, LXC only provides the loopback
> interface. To match this, we need to use the privnet feature.
> ---
>  src/lxc/lxc_native.c                               | 43 ++++++++++++++++++++++
>  tests/lxcconf2xmldata/lxcconf2xml-nonetwork.config |  5 +++
>  tests/lxcconf2xmldata/lxcconf2xml-nonetwork.xml    | 33 +++++++++++++++++
>  tests/lxcconf2xmltest.c                            |  1 +
>  4 files changed, 82 insertions(+)
>  create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-nonetwork.config
>  create mode 100644 tests/lxcconf2xmldata/lxcconf2xml-nonetwork.xml
> 
> diff --git a/src/lxc/lxc_native.c b/src/lxc/lxc_native.c
> index 9e2e870..6b62a5b 100644
> --- a/src/lxc/lxc_native.c
> +++ b/src/lxc/lxc_native.c
> @@ -517,6 +517,45 @@ error:
>      return -1;
>  }
>  
> +static int
> +lxcConvertNetworkSettings(virDomainDefPtr def, virPropertiesPtr properties)
> +{
> +    virPropertyEntryPtr property = NULL;
> +    char *type = NULL;
> +    bool nonetwork = true;
> +
> +    if (properties) {
> +        for (property = properties->elements;
> +                property;
> +                property = property->next) {
> +            if (STREQ(property->key, "lxc.network.type")) {
> +                if ((type != NULL) && STRNEQ(type, "empty") &&
> +                                STRNEQ(type, "")) {
> +                    nonetwork = false;
> +                }
> +
> +                /* Start a new network interface config */
> +                type = NULL;
> +
> +                /* Keep the new value */
> +                type = property->value;
> +            }
> +        }
> +    }
> +
> +    if ((type != NULL) && STRNEQ(type, "empty") &&
> +                    STRNEQ(type, "")) {
> +        nonetwork = false;
> +    }

IIUC, they use "lxc.network.type = none" to request sharing of
the network namespace, rather than 'empty' 

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 :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]