
On Tue, Jan 14, 2014 at 02:49:54PM +0100, Cédric Bosdonnat wrote:
Some of the LXC configuration properties aren't migrated since they would only cause problems in libvirt-lxc: lxc.network.ipv[46]: LXC driver doesn't setup IP address of guests
That doesn't make sense in a machine virt world, but has been requested a few times in the context of LXC and before that with OpenVZ. I guess we need a bug filed to request that we support this. Currently I have to workaround it with libvirt-sandbox's LXC support too
lxc.network.name
What is this config param for ? Is that the name of the guest visible NIC ? Currently we hardcode it ethNNN, assigning the NNN value incrementally. Guess that'd be another RFE bug.
--- src/lxc/lxc_native.c | 98 ++++++++++++++++++++++++++-- tests/lxcconf2xmldata/lxcconf2xml-simple.xml | 5 ++ 2 files changed, 96 insertions(+), 7 deletions(-)
diff --git a/src/lxc/lxc_native.c b/src/lxc/lxc_native.c index 6b62a5b..a9ef453 100644 --- a/src/lxc/lxc_native.c +++ b/src/lxc/lxc_native.c @@ -517,35 +517,119 @@ error: return -1; }
+static virDomainNetDefPtr +lxcCreateNetDef(const char *type, + const char *link, + const char *mac, + const char *flag) +{ + virDomainNetDefPtr net = NULL; + + if (VIR_ALLOC(net) < 0) + goto error; + + if (flag) { + if (STREQ(flag, "up")) + net->linkstate = VIR_DOMAIN_NET_INTERFACE_LINK_STATE_UP; + else + net->linkstate = VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DOWN; + }
Hmm, the LXC driver doesn't honour the 'linkstate' config parameter currently, so we need a bug about that filed, or feel free to do a patch for that.
+ + if (STREQ(type, "veth")) { + virMacAddr macAddr; + + if (!link) + goto error; + + net->type = VIR_DOMAIN_NET_TYPE_BRIDGE; + + if (VIR_STRDUP(net->data.bridge.brname, link) < 0) + goto error; + + if (mac && virMacAddrParse(mac, &macAddr) == 0) + net->mac = macAddr; + + } + + return net; + +error: + virDomainNetDefFree(net); + return NULL; +} +
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 :|