[libvirt] [PATCH 2/6] lxc: Create a new method called lxcNetworkParseDataEntry().

Julio Faracco posted 6 patches 6 years, 11 months ago
[libvirt] [PATCH 2/6] lxc: Create a new method called lxcNetworkParseDataEntry().
Posted by Julio Faracco 6 years, 11 months ago
This 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 hanlder simple.

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
---
 src/lxc/lxc_native.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/lxc/lxc_native.c b/src/lxc/lxc_native.c
index 5bbbbf132c..c144f3c52e 100644
--- a/src/lxc/lxc_native.c
+++ b/src/lxc/lxc_native.c
@@ -648,6 +648,14 @@ lxcNetworkWalkCallback(const char *name, virConfValuePtr value, void *data)
     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
 lxcConvertNetworkSettings(virDomainDefPtr def, virConfPtr properties)
 {
-- 
2.19.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 2/6] lxc: Create a new method called lxcNetworkParseDataEntry().
Posted by John Ferlan 6 years, 11 months ago
$SUBJ:

lxc: Introduce lxcNetworkParseDataEntry

On 2/18/19 2:09 PM, Julio Faracco wrote:
> This 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 hanlder simple.

*handler

> 
> Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
> ---
>  src/lxc/lxc_native.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 

> diff --git a/src/lxc/lxc_native.c b/src/lxc/lxc_native.c
> index 5bbbbf132c..c144f3c52e 100644
> --- a/src/lxc/lxc_native.c
> +++ b/src/lxc/lxc_native.c
> @@ -648,6 +648,14 @@ lxcNetworkWalkCallback(const char *name, virConfValuePtr value, void *data)
>      return 0;
>  }
>  
> +static int
> +lxcNetworkParseDataEntry(const char *name, virConfValuePtr value, lxcNetworkParseData *parseData)


Same thoughts as before w/r/t method headers.

However, because we require each patch to be able to compile separately,
things won't work in this order as lxcNetworkParseDataEntry is a static
method with no callers.

What needs to be done is this move this above lxcNetworkWalkCallback and
then merge in patch 4 to here and alter patch3 slightly.

That means patch4 gets dropped. I can do this and alter the commit
messages appropriately.

Reviewed-by: John Ferlan <jferlan@redhat.com>

John


[...]

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list