virt-*: Unify handling of --os-variant
And hide --os-type from the cli since it is long since redundant.
This commit is contained in:
parent
f1cb3dfa04
commit
45d2db887d
|
@ -87,19 +87,13 @@ General configuration parameters that apply to all types of guest installs.
|
|||
Architecture of the virtual machine (i686, x86_64, ppc). Defaults to
|
||||
that of the host machine.
|
||||
|
||||
=item --os-type=OS_TYPE
|
||||
|
||||
Optimize the guest configuration for a type of operating system (ex. 'linux',
|
||||
'windows'). This will attempt to pick the most suitable ACPI & APIC settings,
|
||||
optimally supported mouse drivers, virtio, and generally accommodate other
|
||||
operating system quirks. See L<virt-install(1)> for valid values.
|
||||
|
||||
=item --os-variant=OS_VARIANT
|
||||
|
||||
Further optimize the guest configuration for a specific operating system
|
||||
variant (ex. 'fedora8', 'winxp'). This parameter is optional, and does not
|
||||
require an C<--os-type> to be specified. See L<virt-install(1)> for valid
|
||||
values.
|
||||
Optimize the guest configuration for a specific operating system (ex.
|
||||
'fedora18', 'rhel7', 'winxp'). While not requires, specifying this
|
||||
options is HIGHLY RECOMMENDED, as it can greatly increase performance
|
||||
by specifying virtio among other guest tweaks.
|
||||
See L<virt-install(1)> for valid values.
|
||||
|
||||
=item --noapic
|
||||
|
||||
|
|
|
@ -82,19 +82,13 @@ L<virt-install(1)> for more info.
|
|||
|
||||
Check that vcpus do not exceed physical CPUs and warn if they do.
|
||||
|
||||
=item --os-type=OS_TYPE
|
||||
|
||||
Optimize the guest configuration for a type of operating system (ex. 'linux',
|
||||
'windows'). This will attempt to pick the most suitable ACPI & APIC settings,
|
||||
optimally supported mouse drivers, virtio, and generally accommodate other
|
||||
operating system quirks. See L<virt-install(1)> for valid values.
|
||||
|
||||
=item --os-variant=OS_VARIANT
|
||||
|
||||
Further optimize the guest configuration for a specific operating system
|
||||
variant (ex. 'fedora8', 'winxp'). This parameter is optional, and does not
|
||||
require an C<--os-type> to be specified. See L<virt-install(1)> for valid
|
||||
values.
|
||||
Optimize the guest configuration for a specific operating system (ex.
|
||||
'fedora18', 'rhel7', 'winxp'). While not requires, specifying this
|
||||
options is HIGHLY RECOMMENDED, as it can greatly increase performance
|
||||
by specifying virtio among other guest tweaks.
|
||||
See L<virt-install(1)> for valid values.
|
||||
|
||||
=back
|
||||
|
||||
|
|
|
@ -307,24 +307,12 @@ file:
|
|||
|
||||
--initrd-inject=/path/to/my.ks --extra-args "ks=file:/my.ks"
|
||||
|
||||
=item --os-type=OS_TYPE
|
||||
|
||||
Optimize the guest configuration for a type of operating system (ex. 'linux',
|
||||
'windows'). This will attempt to pick the most suitable ACPI & APIC settings,
|
||||
optimally supported mouse drivers, virtio, and generally accommodate other
|
||||
operating system quirks.
|
||||
|
||||
By default, virt-install will attempt to auto detect this value from
|
||||
the install media (currently only supported for URL installs). Autodetection
|
||||
can be disabled with the special value 'none'
|
||||
|
||||
See C<--os-variant> for valid options.
|
||||
|
||||
=item --os-variant=OS_VARIANT
|
||||
|
||||
Further optimize the guest configuration for a specific operating system
|
||||
variant (ex. 'fedora18', 'winxp'). This parameter is optional, and does not
|
||||
require an C<--os-type> to be specified.
|
||||
Optimize the guest configuration for a specific operating system (ex.
|
||||
'fedora18', 'rhel7', 'winxp'). While not requires, specifying this
|
||||
options is HIGHLY RECOMMENDED, as it can greatly increase performance
|
||||
by specifying virtio among other guest tweaks.
|
||||
|
||||
By default, virt-install will attempt to auto detect this value from
|
||||
the install media (currently only supported for URL installs). Autodetection
|
||||
|
|
14
virt-convert
14
virt-convert
|
@ -69,20 +69,15 @@ def parse_args():
|
|||
cfgg.add_option("-a", "--arch", dest="arch",
|
||||
default=get_default_arch(),
|
||||
help=_("Machine Architecture Type (i686/x86_64/ppc)"))
|
||||
cfgg.add_option("", "--os-type", dest="os_type",
|
||||
help=_("The OS type for fully virtualized guests, e.g. "
|
||||
"'linux', 'unix', 'windows'"))
|
||||
cfgg.add_option("", "--os-variant", dest="os_variant",
|
||||
help=_("The OS variant for fully virtualized guests, e.g. "
|
||||
"'fedora6', 'rhel5', 'solaris10', 'win2k', 'vista'"))
|
||||
cli.add_distro_options(cfgg)
|
||||
cfgg.add_option("", "--noapic", action="store_true", dest="noapic",
|
||||
default=False,
|
||||
help=_("Disables APIC for fully virtualized guest "
|
||||
"(overrides value in os-type/os-variant db)"))
|
||||
"(overrides value in os-variant db)"))
|
||||
cfgg.add_option("", "--noacpi", action="store_true", dest="noacpi",
|
||||
default=False,
|
||||
help=_("Disables ACPI for fully virtualized guest "
|
||||
"(overrides value in os-type/os-variant db)"))
|
||||
"(overrides value in os-variant db)"))
|
||||
opts.add_option_group(cfgg)
|
||||
|
||||
misc = OptionGroup(opts, "Miscellaneous Options")
|
||||
|
@ -204,8 +199,7 @@ def main():
|
|||
vmdef.type = vmcfg.VM_TYPE_HVM
|
||||
|
||||
vmdef.arch = options.arch
|
||||
vmdef.os_type = options.os_type
|
||||
vmdef.os_variant = options.os_variant
|
||||
cli.set_os_variant(vmdef, options.distro_type, options.distro_variant)
|
||||
vmdef.noapic = options.noapic
|
||||
vmdef.noacpi = options.noacpi
|
||||
|
||||
|
|
|
@ -66,12 +66,7 @@ def parse_args():
|
|||
geng.add_option("-u", "--uuid", dest="uuid",
|
||||
help=_("UUID for the guest."))
|
||||
cli.vcpu_cli_options(geng)
|
||||
geng.add_option("", "--os-type", dest="distro_type",
|
||||
help=_("The OS type being installed, e.g. "
|
||||
"'linux', 'unix', 'windows'"))
|
||||
geng.add_option("", "--os-variant", dest="distro_variant",
|
||||
help=_("The OS variant being installed, "
|
||||
"e.g. 'fedora6', 'rhel5', 'solaris10', 'win2k'"))
|
||||
cli.add_distro_options(geng)
|
||||
parser.add_option_group(geng)
|
||||
|
||||
fulg = OptionGroup(parser, _("Full Virtualization specific options"))
|
||||
|
|
11
virt-install
11
virt-install
|
@ -928,12 +928,7 @@ def parse_args():
|
|||
insg.add_option("", "--initrd-inject", dest="initrd_injections",
|
||||
action="append",
|
||||
help=_("Add given file to root of initrd from --location"))
|
||||
insg.add_option("", "--os-type", dest="distro_type",
|
||||
help=_("The OS type being installed, e.g. "
|
||||
"'linux', 'unix', 'windows'"))
|
||||
insg.add_option("", "--os-variant", dest="distro_variant",
|
||||
help=_("The OS variant being installed guests, "
|
||||
"e.g. 'fedora6', 'rhel5', 'solaris10', 'win2k'"))
|
||||
cli.add_distro_options(insg)
|
||||
insg.add_option("", "--boot", dest="bootopts", default="",
|
||||
help=_("Optionally configure post-install boot order, "
|
||||
"menu, permanent kernel boot, etc."))
|
||||
|
@ -1002,11 +997,11 @@ def parse_args():
|
|||
virg.add_option("", "--noapic", action="store_true", dest="noapic",
|
||||
default=False,
|
||||
help=_("Disables APIC for fully virtualized guest "
|
||||
"(overrides value in os-type/os-variant db)"))
|
||||
"(overrides value in os-variant db)"))
|
||||
virg.add_option("", "--noacpi", action="store_true", dest="noacpi",
|
||||
default=False,
|
||||
help=_("Disables ACPI for fully virtualized guest "
|
||||
"(overrides value in os-type/os-variant db)"))
|
||||
"(overrides value in os-variant db)"))
|
||||
virg.add_option("-u", "--uuid", dest="uuid",
|
||||
help=_("UUID for the guest."))
|
||||
parser.add_option_group(virg)
|
||||
|
|
|
@ -751,17 +751,19 @@ def get_networks(guest, networks, macs):
|
|||
fail(_("Error in network device parameters: %s") % str(e))
|
||||
|
||||
|
||||
def set_os_variant(guest, distro_type, distro_variant):
|
||||
if not distro_type and not distro_variant:
|
||||
def set_os_variant(obj, distro_type, distro_variant):
|
||||
# This is used for both Guest and virtconv VM, so be careful
|
||||
if (not distro_type and
|
||||
not distro_variant and
|
||||
hasattr(obj, "os_autodetect")):
|
||||
# Default to distro autodetection
|
||||
guest.os_autodetect = True
|
||||
obj.os_autodetect = True
|
||||
return
|
||||
|
||||
if (distro_type and str(distro_type).lower() != "none"):
|
||||
guest.set_os_type(distro_type)
|
||||
|
||||
obj.os_type = distro_type
|
||||
if (distro_variant and str(distro_variant).lower() != "none"):
|
||||
guest.set_os_variant(distro_variant)
|
||||
obj.os_variant = distro_variant
|
||||
|
||||
|
||||
def digest_graphics(guest, options, default_override=None):
|
||||
|
@ -1043,6 +1045,17 @@ def add_fs_option(devg):
|
|||
"--filesystem template_name,/,type=template"))
|
||||
|
||||
|
||||
def add_distro_options(g):
|
||||
# Way back when, we required specifying both --os-type and --os-variant
|
||||
# Nowadays the distinction is pointless, so hide the less useful
|
||||
# --os-type option.
|
||||
g.add_option("", "--os-type", dest="distro_type",
|
||||
help=optparse.SUPPRESS_HELP)
|
||||
g.add_option("", "--os-variant", dest="distro_variant",
|
||||
help=_("The OS variant being installed guests, "
|
||||
"e.g. 'fedora18', 'rhel6', 'winxp', etc."))
|
||||
|
||||
|
||||
#############################################
|
||||
# CLI complex parsing helpers #
|
||||
# (for options like --disk, --network, etc. #
|
||||
|
|
|
@ -277,10 +277,6 @@ class Guest(XMLBuilder):
|
|||
raise ValueError(_("Unknown OS variant '%s'" % val))
|
||||
os_variant = property(get_os_variant, set_os_variant)
|
||||
|
||||
def get_os_distro(self):
|
||||
return self._lookup_osdict_key("distro")
|
||||
os_distro = property(get_os_distro)
|
||||
|
||||
|
||||
########################################
|
||||
# Device Add/Remove Public API methods #
|
||||
|
|
Loading…
Reference in New Issue