[libvirt PATCH] conf: match by network alias only if aliases are assigned

Ján Tomko posted 1 patch 2 years, 5 months ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/2038a08115be626330b98687ba008802c59be8b5.1637249543.git.jtomko@redhat.com
src/conf/domain_conf.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[libvirt PATCH] conf: match by network alias only if aliases are assigned
Posted by Ján Tomko 2 years, 5 months ago
Commit 114e3b423210d316b3326816fd2c33335b1167fe added matching by
aliases for interfaces with same MAC address.
( https://bugzilla.redhat.com/show_bug.cgi?id=1926190 )

However, unless the domain is using user aliases (prefixed ua-),
there are no aliases in the persistent definition.

Only match by MAC/PCI/other addresses in that case, to fix update-device
with --persistent flag (AFFECT_LIVE | AFFECT_CONFIG).

https://bugzilla.redhat.com/show_bug.cgi?id=2024098

Fixes: 114e3b423210d316b3326816fd2c33335b1167fe
Signed-off-by: Ján Tomko <jtomko@redhat.com>
---
 src/conf/domain_conf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index da0c64b460..0d7489094b 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -15763,8 +15763,8 @@ virDomainNetFindIdx(virDomainDef *def, virDomainNetDef *net)
                                             &net->info.addr.ccw))
             continue;
 
-        if (net->info.alias &&
-            STRNEQ_NULLABLE(def->nets[i]->info.alias, net->info.alias)) {
+        if (net->info.alias && def->nets[i]->info.alias &&
+            STRNEQ(def->nets[i]->info.alias, net->info.alias)) {
             continue;
         }
 
-- 
2.31.1

Re: [libvirt PATCH] conf: match by network alias only if aliases are assigned
Posted by Martin Kletzander 2 years, 5 months ago
On Thu, Nov 18, 2021 at 04:32:25PM +0100, Ján Tomko wrote:
>Commit 114e3b423210d316b3326816fd2c33335b1167fe added matching by
>aliases for interfaces with same MAC address.
>( https://bugzilla.redhat.com/show_bug.cgi?id=1926190 )
>
>However, unless the domain is using user aliases (prefixed ua-),
>there are no aliases in the persistent definition.
>
>Only match by MAC/PCI/other addresses in that case, to fix update-device
>with --persistent flag (AFFECT_LIVE | AFFECT_CONFIG).
>
>https://bugzilla.redhat.com/show_bug.cgi?id=2024098
>
>Fixes: 114e3b423210d316b3326816fd2c33335b1167fe
>Signed-off-by: Ján Tomko <jtomko@redhat.com>

Reviewed-by: Martin Kletzander <mkletzan@redhat.com>

>---
> src/conf/domain_conf.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
>diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
>index da0c64b460..0d7489094b 100644
>--- a/src/conf/domain_conf.c
>+++ b/src/conf/domain_conf.c
>@@ -15763,8 +15763,8 @@ virDomainNetFindIdx(virDomainDef *def, virDomainNetDef *net)
>                                             &net->info.addr.ccw))
>             continue;
>
>-        if (net->info.alias &&
>-            STRNEQ_NULLABLE(def->nets[i]->info.alias, net->info.alias)) {
>+        if (net->info.alias && def->nets[i]->info.alias &&
>+            STRNEQ(def->nets[i]->info.alias, net->info.alias)) {
>             continue;
>         }
>
>-- 
>2.31.1
>