cli: Rename options.distro_variant to options.os_variant

We don't really use the 'distro' naming any more, and the
command line option is called os_variant, so stick with that
This commit is contained in:
Cole Robinson 2019-02-07 15:48:40 -05:00
parent ada5b49d3b
commit a9eecd591c
3 changed files with 21 additions and 21 deletions

View File

@ -162,13 +162,13 @@ def convert_old_disks(options):
def convert_old_os_options(options):
# Default to distro autodetection
distkey = "auto"
if options.distro_variant:
distkey = str(options.distro_variant).lower()
elif options.distro_type:
distkey = str(options.distro_type).lower()
if options.os_variant:
distkey = str(options.os_variant).lower()
elif options.old_os_type:
distkey = str(options.old_os_type).lower()
options.distro_variant = distkey
del(options.distro_type)
options.os_variant = distkey
del(options.old_os_type)
def convert_old_memory(options):
@ -420,7 +420,7 @@ def show_warnings(options, guest, installer):
# Limit it to hvm x86 guests which presently our defaults
# only really matter for
if (guest.osinfo.name == "generic" and
options.distro_variant not in ["none", "generic"] and
options.os_variant not in ["none", "generic"] and
guest.os.is_x86() and guest.os.is_hvm()):
logging.warning(_("No operating system detected, VM performance may "
"suffer. Specify an OS with --os-variant for optimal results."))
@ -479,7 +479,7 @@ def build_installer(options, guest):
try:
# This also validates the install location
autodistro = installer.detect_distro(guest)
if options.distro_variant == "auto":
if options.os_variant == "auto":
distro = autodistro
except ValueError as e:
fail(_("Error validating install location: %s") % str(e))
@ -519,10 +519,10 @@ def build_guest_instance(conn, options):
guest.os.arch = options.arch
if options.machine:
guest.os.machine = options.machine
if options.distro_variant not in ["auto", "none"]:
if options.os_variant not in ["auto", "none"]:
# If explicit os-variant requested, set it early since it will
# provide more defaults in the future
guest.set_os_name(options.distro_variant)
guest.set_os_name(options.os_variant)
cli.parse_option_strings(options, guest, None)
@ -790,7 +790,7 @@ def parse_args():
insg.add_argument("--init", help=argparse.SUPPRESS)
osg = cli.add_os_variant_option(parser, virtinstall=True)
osg.add_argument("--os-type", dest="distro_type", help=argparse.SUPPRESS)
osg.add_argument("--os-type", dest="old_os_type", help=argparse.SUPPRESS)
devg = parser.add_argument_group(_("Device Options"))
cli.add_disk_option(devg)
@ -902,8 +902,8 @@ def set_test_stub_options(options):
options.import_install = True
if not options.graphics:
options.graphics = "none"
if not options.distro_variant:
options.distro_variant = "fedora27"
if not options.os_variant:
options.os_variant = "fedora27"
def main(conn=None):

View File

@ -55,11 +55,11 @@ def get_diff(origxml, newxml):
return ret
def set_distro_variant(options, guest):
if options.distro_variant is None:
def set_os_variant(options, guest):
if options.os_variant is None:
return
guest.set_os_name(options.distro_variant)
guest.set_os_name(options.os_variant)
def get_domain_and_guest(conn, domstr):
@ -181,7 +181,7 @@ 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:
if options.os_variant is not None:
fail(_("--os-variant is not supported with --edit"))
return cli.parse_option_strings(options, guest, inst, update=True)
@ -190,7 +190,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)
set_os_variant(options, guest)
devs = cli.parse_option_strings(options, guest, None)
devs = util.listify(devs)
for dev in devs:
@ -202,7 +202,7 @@ 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:
if options.os_variant is not None:
fail(_("--os-variant is not supported with --remove-device"))
devs = _find_objects_to_edit(guest, "remove-device",
@ -218,7 +218,7 @@ 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:
if options.os_variant is not None:
fail(_("--os-variant is not supported with --build-xml"))
guest = virtinst.Guest(conn)

View File

@ -857,7 +857,7 @@ def add_os_variant_option(parser, virtinstall):
"Example values: fedora29, rhel7.0, win10, ...\n"
"See 'osinfo-query os' for a full list.")
osg.add_argument("--os-variant", dest="distro_variant", help=msg)
osg.add_argument("--os-variant", help=msg)
return osg