virsh: cmdDesc: Use separate flags variable for getters

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@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2022-02-28 18:32:30 +01:00
parent 2337098b63
commit a3ef5414ed

View File

@ -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;