mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
lxc: Introduce lxcNetworkParseDataEntry
Refactor lxcNetworkWalkCallback to be a simple method to handle both possible network settings with indexes or the simple one. It is better the decouple the whole algorithm to parse data to only parse which entry type libvirt is handling. The new method is responsible to verify is the settings correspond to network entry. Right now, it is only verifying "lxc.network.", but in the future, it can be used to verify "lxc.net.X." too. Any other case would be rejected. On the other hand, the idea here is working only with types. If we know that entry is part of network settings, after we just need to know which type is. It keeps the handler simple. Signed-off-by: Julio Faracco <jcfaracco@gmail.com> Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
e6cb63d2ef
commit
0ebb057a2a
@ -593,9 +593,10 @@ lxcNetworkParseDataIPs(const char *name,
|
||||
|
||||
|
||||
static int
|
||||
lxcNetworkWalkCallback(const char *name, virConfValuePtr value, void *data)
|
||||
lxcNetworkParseDataEntry(const char *name,
|
||||
virConfValuePtr value,
|
||||
lxcNetworkParseData *parseData)
|
||||
{
|
||||
lxcNetworkParseData *parseData = data;
|
||||
int status;
|
||||
|
||||
if (STREQ(name, "lxc.network.type")) {
|
||||
@ -652,6 +653,18 @@ lxcNetworkWalkCallback(const char *name, virConfValuePtr value, void *data)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
lxcNetworkWalkCallback(const char *name, virConfValuePtr value, void *data)
|
||||
{
|
||||
lxcNetworkParseData *parseData = data;
|
||||
|
||||
if (STRPREFIX(name, "lxc.network."))
|
||||
return lxcNetworkParseDataEntry(name, value, parseData);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
lxcConvertNetworkSettings(virDomainDefPtr def, virConfPtr properties)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user