cli: --pm: use predictable cli subarg names

To match the XML schema, rename these subarguments and add aliases
to preserve compatibility:

* suspend_to_disk -> suspend_to_disk.enabled
* suspend_to_mem -> suspend_to_mem.enabled
This commit is contained in:
Cole Robinson 2019-05-11 21:26:56 -04:00
parent a160fac5e8
commit 83e15a3bce
2 changed files with 9 additions and 3 deletions

View File

@ -352,7 +352,9 @@ Use --clock=? to see a list of all available sub options. Complete details at L<
=item B<--pm> OPTIONS
Configure guest power management features. Example suboptions include suspend_to_mem=on|off and suspend_to_disk=on|off
Configure guest power management features. Example:
--pm suspend_to_memi.enabled=on,suspend_to_disk.enabled=off
Use --pm=? to see a list of all available sub options. Complete details at L<https://libvirt.org/formatdomain.html#elementsPowerManagement>

View File

@ -2210,12 +2210,16 @@ class ParserClock(VirtCLIParser):
class ParserPM(VirtCLIParser):
cli_arg_name = "pm"
guest_propname = "pm"
aliases = {
"suspend_to_mem.enabled": "suspend_to_mem",
"suspend_to_disk.enabled": "suspend_to_disk",
}
@classmethod
def _init_class(cls, **kwargs):
VirtCLIParser._init_class(**kwargs)
cls.add_arg("suspend_to_mem", "suspend_to_mem", is_onoff=True)
cls.add_arg("suspend_to_disk", "suspend_to_disk", is_onoff=True)
cls.add_arg("suspend_to_mem.enabled", "suspend_to_mem", is_onoff=True)
cls.add_arg("suspend_to_disk.enabled", "suspend_to_disk", is_onoff=True)
#####################