mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-07-30 21:47:18 +00:00
virsh: Fix flag semantics and docs for "desc" command
This patch fixes the domain modification impact flags for tie virsh desc command to match the new semantics and fix the docs to match actual behavior.
This commit is contained in:
parent
91ca45f9dc
commit
4f89138bd1
@ -1051,7 +1051,7 @@ cmdDesc(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
|
|||||||
virDomainPtr dom;
|
virDomainPtr dom;
|
||||||
bool config = vshCommandOptBool(cmd, "config");
|
bool config = vshCommandOptBool(cmd, "config");
|
||||||
bool live = vshCommandOptBool(cmd, "live");
|
bool live = vshCommandOptBool(cmd, "live");
|
||||||
/* current is ignored */
|
bool current = vshCommandOptBool(cmd, "current");
|
||||||
|
|
||||||
bool title = vshCommandOptBool(cmd, "title");
|
bool title = vshCommandOptBool(cmd, "title");
|
||||||
bool edit = vshCommandOptBool(cmd, "edit");
|
bool edit = vshCommandOptBool(cmd, "edit");
|
||||||
@ -1068,6 +1068,19 @@ cmdDesc(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
|
|||||||
bool ret = false;
|
bool ret = false;
|
||||||
unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT;
|
unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT;
|
||||||
|
|
||||||
|
if (current) {
|
||||||
|
if (live || config) {
|
||||||
|
vshError(ctl, "%s", _("--current must be specified exclusively"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
flags = VIR_DOMAIN_AFFECT_CURRENT;
|
||||||
|
} else {
|
||||||
|
if (config)
|
||||||
|
flags |= VIR_DOMAIN_AFFECT_CONFIG;
|
||||||
|
if (live)
|
||||||
|
flags |= VIR_DOMAIN_AFFECT_LIVE;
|
||||||
|
}
|
||||||
|
|
||||||
if (!vshConnectionUsability(ctl, ctl->conn))
|
if (!vshConnectionUsability(ctl, ctl->conn))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -1084,10 +1097,6 @@ cmdDesc(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
|
|||||||
virBufferAdd(&buf, opt->data, -1);
|
virBufferAdd(&buf, opt->data, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (live)
|
|
||||||
flags |= VIR_DOMAIN_AFFECT_LIVE;
|
|
||||||
if (config)
|
|
||||||
flags |= VIR_DOMAIN_AFFECT_CONFIG;
|
|
||||||
if (title)
|
if (title)
|
||||||
type = VIR_DOMAIN_METADATA_TITLE;
|
type = VIR_DOMAIN_METADATA_TITLE;
|
||||||
else
|
else
|
||||||
@ -1122,7 +1131,7 @@ cmdDesc(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
|
|||||||
|
|
||||||
/* strip a possible newline at the end of file; some
|
/* strip a possible newline at the end of file; some
|
||||||
* editors enforce a newline, this makes editing the title
|
* editors enforce a newline, this makes editing the title
|
||||||
* more convinient */
|
* more convenient */
|
||||||
if (title &&
|
if (title &&
|
||||||
(tmpstr = strrchr(desc_edited, '\n')) &&
|
(tmpstr = strrchr(desc_edited, '\n')) &&
|
||||||
*(tmpstr+1) == '\0')
|
*(tmpstr+1) == '\0')
|
||||||
|
@ -435,20 +435,18 @@ Define a domain from an XML <file>. The domain definition is registered
|
|||||||
but not started. If domain is already running, the changes will take
|
but not started. If domain is already running, the changes will take
|
||||||
effect on the next boot.
|
effect on the next boot.
|
||||||
|
|
||||||
=item B<desc> [I<--live> | I<--config>] [I<--title>] [I<--edit>]
|
=item B<desc> [[I<--live>] [I<--config>] | [I<--current>]] [I<--title>]
|
||||||
[I<--new-desc> New description or title message]
|
[I<--edit>] [I<--new-desc> New description or title message]
|
||||||
|
|
||||||
Show or modify description and title of a domain. These values are user
|
Show or modify description and title of a domain. These values are user
|
||||||
fields that allow to store arbitrary textual data to allow easy
|
fields that allow to store arbitrary textual data to allow easy
|
||||||
identification of domains. Title should be short, although it's not enforced.
|
identification of domains. Title should be short, although it's not enforced.
|
||||||
|
|
||||||
Flags I<--live> or I<--config> select whether this command works on live
|
Flags I<--live> or I<--config> select whether this command works on live
|
||||||
or persistent definitions of the domain. By default both are influenced, while
|
or persistent definitions of the domain. If both I<--live> and I<--config>
|
||||||
modifying and running definition is used while reading the note.
|
are specified, the I<--config> option takes precedence on getting the current
|
||||||
|
description and both live configuration and config are updated while setting
|
||||||
If both I<--live> and I<--config> are specified, the I<--config> option takes
|
the description. I<--current> is exclusive and implied if none of these was specified.
|
||||||
precedence on getting the current description and both live configuration
|
|
||||||
and config are updated while setting the description.
|
|
||||||
|
|
||||||
Flag I<--edit> specifies that an editor with the contents of current
|
Flag I<--edit> specifies that an editor with the contents of current
|
||||||
description or title should be opened and the contents saved back afterwards.
|
description or title should be opened and the contents saved back afterwards.
|
||||||
|
Loading…
Reference in New Issue
Block a user