diff options
author | Andrea Bolognani <abologna@redhat.com> | 2018-11-09 16:36:40 +0100 |
---|---|---|
committer | Pavel Hrdina <phrdina@redhat.com> | 2018-11-13 12:15:50 +0100 |
commit | d2d103a334e3beeb8e108137f50adee2e5c0e5fc (patch) | |
tree | 1e590db0ac599a7c2b375d05348721fbcd6a41ea /virt-xml | |
parent | b882dbde9cb192afbc9ee8d8f4972922a4b4e616 (diff) | |
download | virt-manager-d2d103a334e3beeb8e108137f50adee2e5c0e5fc.tar.gz |
virt-xml: Start using --os-variant
The option only works with --add-device for the time being,
so we prevent its use in all other cases.
It would be nice to have it work with --build-xml too, but
in that case the user would have to provide some extra
information that in the case of --add-device we can figure
out from the existing guest, and it's not entirely clear
whether that would even be that useful, so for now we're
not considering that case at all.
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Diffstat (limited to 'virt-xml')
-rwxr-xr-x | virt-xml | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -56,6 +56,13 @@ def get_diff(origxml, newxml): return ret +def set_distro_variant(options, guest): + if options.distro_variant is None: + return + + guest.set_os_name(options.distro_variant) + + def get_domain_and_guest(conn, domstr): try: int(domstr) @@ -175,6 +182,8 @@ def action_edit(guest, options, parserclass): fail(_("'--edit %s' doesn't make sense with --%s, " "just use empty '--edit'") % (options.edit, parserclass.cli_arg_name)) + if options.distro_variant is not None: + fail(_("--os-variant is not supported with --edit")) return cli.parse_option_strings(options, guest, inst, update=True) @@ -182,6 +191,7 @@ def action_edit(guest, options, parserclass): def action_add_device(guest, options, parserclass): if not parserclass.prop_is_list(guest): fail(_("Cannot use --add-device with --%s") % parserclass.cli_arg_name) + set_distro_variant(options, guest) devs = cli.parse_option_strings(options, guest, None) devs = util.listify(devs) for dev in devs: @@ -193,6 +203,8 @@ def action_remove_device(guest, options, parserclass): if not parserclass.prop_is_list(guest): fail(_("Cannot use --remove-device with --%s") % parserclass.cli_arg_name) + if options.distro_variant is not None: + fail(_("--os-variant is not supported with --remove-device")) devs = _find_objects_to_edit(guest, "remove-device", getattr(options, parserclass.cli_arg_name)[-1], parserclass) @@ -207,6 +219,8 @@ def action_build_xml(conn, options, parserclass): if not parserclass.propname: fail(_("--build-xml not supported for --%s") % parserclass.cli_arg_name) + if options.distro_variant is not None: + fail(_("--os-variant is not supported with --build-xml")) guest = virtinst.Guest(conn) inst = parserclass.lookup_prop(guest) |