提交 23be4887 编写于 作者: J Julio Faracco 提交者: Michal Privoznik

lxc: Fix wrong addresses statements for IPv{4, 6} in native network definitions

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: NJulio Faracco <jcfaracco@gmail.com>
Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
上级 991c5610
......@@ -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;
......
......@@ -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;
......
......@@ -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
......
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
......
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
......
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册