提交 f7fd10e5 编写于 作者: J Julio Faracco 提交者: John Ferlan

lxc: Introduce lxcNetworkParseDataSuffix

This commit removes the full network entry setting: "lxc.network.X" to
type only. Like "type", "name", "flags", etc. This will handle entries
regardless of whether they are prefixed by "lxc.network." (today) or
"lxc.net.X." (the future).
Signed-off-by: NJulio Faracco <jcfaracco@gmail.com>
Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
上级 0ebb057a
......@@ -565,7 +565,7 @@ lxcNetworkParseDataIPs(const char *name,
if (VIR_ALLOC(ip) < 0)
return -1;
if (STREQ(name, "lxc.network.ipv6"))
if (STREQ(name, "ipv6"))
family = AF_INET6;
ipparts = virStringSplit(value->str, "/", 2);
......@@ -593,13 +593,13 @@ lxcNetworkParseDataIPs(const char *name,
static int
lxcNetworkParseDataEntry(const char *name,
virConfValuePtr value,
lxcNetworkParseData *parseData)
lxcNetworkParseDataSuffix(const char *name,
virConfValuePtr value,
lxcNetworkParseData *parseData)
{
int status;
if (STREQ(name, "lxc.network.type")) {
if (STREQ(name, "type")) {
virDomainDefPtr def = parseData->def;
size_t networks = parseData->networks;
bool privnet = parseData->privnet;
......@@ -624,36 +624,48 @@ lxcNetworkParseDataEntry(const char *name,
/* Keep the new value */
parseData->type = value->str;
}
else if (STREQ(name, "lxc.network.link"))
else if (STREQ(name, "link"))
parseData->link = value->str;
else if (STREQ(name, "lxc.network.hwaddr"))
else if (STREQ(name, "hwaddr"))
parseData->mac = value->str;
else if (STREQ(name, "lxc.network.flags"))
else if (STREQ(name, "flags"))
parseData->flag = value->str;
else if (STREQ(name, "lxc.network.macvlan.mode"))
else if (STREQ(name, "macvlan.mode"))
parseData->macvlanmode = value->str;
else if (STREQ(name, "lxc.network.vlan.id"))
else if (STREQ(name, "vlan.id"))
parseData->vlanid = value->str;
else if (STREQ(name, "lxc.network.name"))
else if (STREQ(name, "name"))
parseData->name = value->str;
else if (STREQ(name, "lxc.network.ipv4") ||
STREQ(name, "lxc.network.ipv6")) {
else if (STREQ(name, "ipv4") ||
STREQ(name, "ipv6")) {
if (lxcNetworkParseDataIPs(name, value, parseData) < 0)
return -1;
} else if (STREQ(name, "lxc.network.ipv4.gateway")) {
} else if (STREQ(name, "ipv4.gateway")) {
parseData->gateway_ipv4 = value->str;
} else if (STREQ(name, "lxc.network.ipv6.gateway")) {
} else if (STREQ(name, "ipv6.gateway")) {
parseData->gateway_ipv6 = value->str;
} else if (STRPREFIX(name, "lxc.network")) {
} else {
VIR_WARN("Unhandled network property: %s = %s",
name,
value->str);
return -1;
}
return 0;
}
static int
lxcNetworkParseDataEntry(const char *name,
virConfValuePtr value,
lxcNetworkParseData *parseData)
{
const char *suffix = STRSKIP(name, "lxc.network.");
return lxcNetworkParseDataSuffix(suffix, value, parseData);
}
static int
lxcNetworkWalkCallback(const char *name, virConfValuePtr value, void *data)
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册