After LXC version 3, some settings were changed to new names. Same as network. LXC introduced network indexes and changed IPv{4,6} addresses fields. Before, users should only pass `lxc.network.ipv4` to define an IPv4 address. Now, on version 3, users need to pass `lxc.net.X.ipv4.address` to specify the same thing. Same for IPv6. Signed-off-by: Julio Faracco <jcfaracco@xxxxxxxxx> --- For further details: https://discuss.linuxcontainers.org/t/lxc-2-1-has-been-released/487 --- --- src/lxc/lxc_native.c | 12 ++++++++---- src/lxc/lxc_native.h | 2 ++ tests/lxcconf2xmldata/lxcconf2xml-ethernet-v3.config | 4 ++-- .../lxcconf2xml-miscnetwork-v3.config | 4 ++-- .../lxcconf2xml-physnetwork-v3.config | 4 ++-- tests/lxcconf2xmldata/lxcconf2xml-simple-v3.config | 4 ++-- 6 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/lxc/lxc_native.c b/src/lxc/lxc_native.c index 5462b74b85..ea79c90f83 100644 --- a/src/lxc/lxc_native.c +++ b/src/lxc/lxc_native.c @@ -44,10 +44,12 @@ VIR_ENUM_IMPL(virLXCNetworkConfigEntry, "flags", "macvlan.mode", "vlan.id", - "ipv4", + "ipv4", /* Legacy: LXC IPv4 address */ "ipv4.gateway", - "ipv6", - "ipv6.gateway" + "ipv4.address", + "ipv6", /* Legacy: LXC IPv6 address */ + "ipv6.gateway", + "ipv6.address" ); static virDomainFSDefPtr @@ -570,7 +572,7 @@ lxcNetworkParseDataIPs(const char *name, if (VIR_ALLOC(ip) < 0) return -1; - if (STREQ(name, "ipv6")) + if (STREQ(name, "ipv6") || STREQ(name, "ipv6.address")) family = AF_INET6; ipparts = virStringSplit(value->str, "/", 2); @@ -627,7 +629,9 @@ lxcNetworkParseDataSuffix(const char *entry, parseData->name = value->str; break; case VIR_LXC_NETWORK_CONFIG_IPV4: + case VIR_LXC_NETWORK_CONFIG_IPV4_ADDRESS: case VIR_LXC_NETWORK_CONFIG_IPV6: + case VIR_LXC_NETWORK_CONFIG_IPV6_ADDRESS: if (lxcNetworkParseDataIPs(entry, value, parseData) < 0) return -1; break; diff --git a/src/lxc/lxc_native.h b/src/lxc/lxc_native.h index f16407f2e6..813272e129 100644 --- a/src/lxc/lxc_native.h +++ b/src/lxc/lxc_native.h @@ -35,8 +35,10 @@ typedef enum { VIR_LXC_NETWORK_CONFIG_VLAN_ID, VIR_LXC_NETWORK_CONFIG_IPV4, VIR_LXC_NETWORK_CONFIG_IPV4_GATEWAY, + VIR_LXC_NETWORK_CONFIG_IPV4_ADDRESS, VIR_LXC_NETWORK_CONFIG_IPV6, VIR_LXC_NETWORK_CONFIG_IPV6_GATEWAY, + VIR_LXC_NETWORK_CONFIG_IPV6_ADDRESS, VIR_LXC_NETWORK_CONFIG_LAST, } virLXCNetworkConfigEntry; diff --git a/tests/lxcconf2xmldata/lxcconf2xml-ethernet-v3.config b/tests/lxcconf2xmldata/lxcconf2xml-ethernet-v3.config index 0a641549f3..f2ca48f1f2 100644 --- a/tests/lxcconf2xmldata/lxcconf2xml-ethernet-v3.config +++ b/tests/lxcconf2xmldata/lxcconf2xml-ethernet-v3.config @@ -5,9 +5,9 @@ lxc.net.0.type = veth lxc.net.0.flags = up lxc.net.0.hwaddr = 02:00:15:8f:05:c1 lxc.net.0.name = eth0 -lxc.net.0.ipv4 = 192.168.122.2/24 +lxc.net.0.ipv4.address = 192.168.122.2/24 lxc.net.0.ipv4.gateway = 192.168.122.1 -lxc.net.0.ipv6 = 2003:db8:1:0:214:1234:fe0b:3596/64 +lxc.net.0.ipv6.address = 2003:db8:1:0:214:1234:fe0b:3596/64 lxc.net.0.ipv6.gateway = 2003:db8:1:0:214:1234:fe0b:3595 #remove next line if host DNS configuration should not be available to container diff --git a/tests/lxcconf2xmldata/lxcconf2xml-miscnetwork-v3.config b/tests/lxcconf2xmldata/lxcconf2xml-miscnetwork-v3.config index 537da64592..6bc22b8e46 100644 --- a/tests/lxcconf2xmldata/lxcconf2xml-miscnetwork-v3.config +++ b/tests/lxcconf2xmldata/lxcconf2xml-miscnetwork-v3.config @@ -1,9 +1,9 @@ lxc.net.0.type = phys lxc.net.0.link = eth0 lxc.net.0.name = eth1 -lxc.net.0.ipv4 = 192.168.122.2/24 +lxc.net.0.ipv4.address = 192.168.122.2/24 lxc.net.0.ipv4.gateway = 192.168.122.1 -lxc.net.0.ipv6 = 2003:db8:1:0:214:1234:fe0b:3596/64 +lxc.net.0.ipv6.address = 2003:db8:1:0:214:1234:fe0b:3596/64 lxc.net.0.ipv6.gateway = 2003:db8:1:0:214:1234:fe0b:3595 lxc.net.1.type = vlan diff --git a/tests/lxcconf2xmldata/lxcconf2xml-physnetwork-v3.config b/tests/lxcconf2xmldata/lxcconf2xml-physnetwork-v3.config index 9cf96163b3..649b73c8b8 100644 --- a/tests/lxcconf2xmldata/lxcconf2xml-physnetwork-v3.config +++ b/tests/lxcconf2xmldata/lxcconf2xml-physnetwork-v3.config @@ -1,9 +1,9 @@ lxc.net.0.type = phys lxc.net.0.link = eth0 lxc.net.0.name = eth1 -lxc.net.0.ipv4 = 192.168.122.2/24 +lxc.net.0.ipv4.address = 192.168.122.2/24 lxc.net.0.ipv4.gateway = 192.168.122.1 -lxc.net.0.ipv6 = 2003:db8:1:0:214:1234:fe0b:3596/64 +lxc.net.0.ipv6.address = 2003:db8:1:0:214:1234:fe0b:3596/64 lxc.net.0.ipv6.gateway = 2003:db8:1:0:214:1234:fe0b:3595 lxc.rootfs.path = /var/lib/lxc/migrate_test/rootfs diff --git a/tests/lxcconf2xmldata/lxcconf2xml-simple-v3.config b/tests/lxcconf2xmldata/lxcconf2xml-simple-v3.config index b0656571b2..ecd71044f9 100644 --- a/tests/lxcconf2xmldata/lxcconf2xml-simple-v3.config +++ b/tests/lxcconf2xmldata/lxcconf2xml-simple-v3.config @@ -6,9 +6,9 @@ lxc.net.0.flags = up lxc.net.0.link = virbr0 lxc.net.0.hwaddr = 02:00:15:8f:05:c1 lxc.net.0.name = eth0 -lxc.net.0.ipv4 = 192.168.122.2/24 +lxc.net.0.ipv4.address = 192.168.122.2/24 lxc.net.0.ipv4.gateway = 192.168.122.1 -lxc.net.0.ipv6 = 2003:db8:1:0:214:1234:fe0b:3596/64 +lxc.net.0.ipv6.address = 2003:db8:1:0:214:1234:fe0b:3596/64 lxc.net.0.ipv6.gateway = 2003:db8:1:0:214:1234:fe0b:3595 #remove next line if host DNS configuration should not be available to container -- 2.20.1