[PATCH 17/23] virsh: cmdDesc: Use separate flags variable for getters

Peter Krempa pkrempa at redhat.com
Wed Mar 2 13:55:16 UTC 2022


The getters have a different set of flags. Add a variable for the getter
to avoid having to construct flags when calling the getter.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 tools/virsh-domain.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 2d1889c71e..cac50dba51 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -8341,12 +8341,15 @@ cmdDesc(vshControl *ctl, const vshCmd *cmd)
     g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
     bool ret = false;
     unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT;
+    unsigned int queryflags = 0;

     VSH_EXCLUSIVE_OPTIONS_VAR(current, live);
     VSH_EXCLUSIVE_OPTIONS_VAR(current, config);

-    if (config)
+    if (config) {
         flags |= VIR_DOMAIN_AFFECT_CONFIG;
+        queryflags |= VIR_DOMAIN_XML_INACTIVE;
+    }
     if (live)
         flags |= VIR_DOMAIN_AFFECT_LIVE;

@@ -8370,8 +8373,7 @@ cmdDesc(vshControl *ctl, const vshCmd *cmd)

     if (edit || desc) {
         if (!desc) {
-                desc = virshGetDomainDescription(ctl, dom, title,
-                                           config?VIR_DOMAIN_XML_INACTIVE:0);
+                desc = virshGetDomainDescription(ctl, dom, title, queryflags);
                 if (!desc)
                     goto cleanup;
         }
@@ -8420,8 +8422,7 @@ cmdDesc(vshControl *ctl, const vshCmd *cmd)
                       title ? _("Domain title updated successfully") :
                               _("Domain description updated successfully"));
     } else {
-        desc = virshGetDomainDescription(ctl, dom, title,
-                                       config?VIR_DOMAIN_XML_INACTIVE:0);
+        desc = virshGetDomainDescription(ctl, dom, title, queryflags);
         if (!desc)
             goto cleanup;

-- 
2.35.1




More information about the libvir-list mailing list