cli: Recommend --osinfo more over --os-variant
We are about to change the some defaults around os handling. Let's start recommending the nicer named --osinfo more, since new error messages are going to promote it a bit as well Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
parent
c2fb5ad402
commit
9c54c116fa
|
@ -46,9 +46,9 @@ Many arguments have sub options, specified like opt1=foo,opt2=bar, etc. Try
|
||||||
--option=? to see a complete list of sub options associated with that
|
--option=? to see a complete list of sub options associated with that
|
||||||
argument, example: virt-install --disk=?
|
argument, example: virt-install --disk=?
|
||||||
|
|
||||||
Most options are not required. If a suitable --os-variant value is specified
|
Most options are not required. If a suitable --osinfo value is specified
|
||||||
or detected, all defaults will be filled in and reported in the terminal
|
or detected, all defaults will be filled in and reported in the terminal
|
||||||
output. If an --os-variant is not specified. minimum required options, --memory,
|
output. If an --osinfo is not specified. minimum required options are --memory,
|
||||||
guest storage (--disk or --filesystem), and an install method choice.
|
guest storage (--disk or --filesystem), and an install method choice.
|
||||||
|
|
||||||
|
|
||||||
|
@ -974,16 +974,15 @@ GUEST OS OPTIONS
|
||||||
``--os-variant``, ``--osinfo``
|
``--os-variant``, ``--osinfo``
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
**Syntax:** ``--os-variant`` [OS_VARIANT|OPT1=VAL1,...]
|
**Syntax:** ``--osinfo`` [OS_VARIANT|OPT1=VAL1,...]
|
||||||
|
|
||||||
Optimize the guest configuration for a specific operating system (ex.
|
Optimize the guest configuration for a specific operating system (ex.
|
||||||
'fedora29', 'rhel7', 'win10'). While not required, specifying this
|
'fedora29', 'rhel7', 'win10'). While not required, specifying this
|
||||||
options is HIGHLY RECOMMENDED, as it can greatly increase performance
|
options is HIGHLY RECOMMENDED, as it can greatly increase performance
|
||||||
by specifying virtio among other guest tweaks.
|
by specifying virtio among other guest tweaks.
|
||||||
|
|
||||||
The simplest usage is ``--os-variant OS-NAME``, for example
|
The simplest usage is ``--os-variant OS-NAME`` or ``--osinfo OS-NAME``,
|
||||||
``--os-variant fedora32``. ``--os-variant`` supports explicit suboption
|
for example ``--osinfo fedora32``. The supported suboptions are:
|
||||||
syntax as well:
|
|
||||||
|
|
||||||
``name=``, ``short-id=``
|
``name=``, ``short-id=``
|
||||||
The OS name/short-id from libosinfo. Examples: ``fedora32``, ``win10``
|
The OS name/short-id from libosinfo. Examples: ``fedora32``, ``win10``
|
||||||
|
@ -1003,25 +1002,25 @@ syntax as well:
|
||||||
|
|
||||||
Some interesting examples:
|
Some interesting examples:
|
||||||
|
|
||||||
``--os-variant detect=on,require=on``
|
``--osinfo detect=on,require=on``
|
||||||
This tells virt-install to attempt detection from install media,
|
This tells virt-install to attempt detection from install media,
|
||||||
but explicitly fail if that does not succeed. This will ensure
|
but explicitly fail if that does not succeed. This will ensure
|
||||||
your virt-install invocations don't fallback to a poorly performing
|
your virt-install invocations don't fallback to a poorly performing
|
||||||
config
|
config
|
||||||
|
|
||||||
``--os-variant detect=on,name=OSNAME``
|
``--osinfo detect=on,name=OSNAME``
|
||||||
Attempt OS detection from install media, but if that fails, use
|
Attempt OS detection from install media, but if that fails, use
|
||||||
OSNAME as a fallback.
|
OSNAME as a fallback.
|
||||||
|
|
||||||
|
|
||||||
By default, virt-install will do ``--os-variant detect=on,name=generic``,
|
By default, virt-install will do ``--osinfo detect=on,name=generic``,
|
||||||
using the detected OS if found, and falling back to the stub ``generic``
|
using the detected OS if found, and falling back to the stub ``generic``
|
||||||
value otherwise, and printing a warning.
|
value otherwise, and printing a warning.
|
||||||
|
|
||||||
If any manual ``--os-variant`` value is specified, the default is
|
If any manual ``--osinfo`` value is specified, the default is
|
||||||
all settings off or unset.
|
all settings off or unset.
|
||||||
|
|
||||||
Use the command ``virt-xml --os-variant list`` to get the list of the
|
Use the command ``virt-install --osinfo list`` to get the list of the
|
||||||
accepted OS variants. See ``osinfo-query os`` for even more output.
|
accepted OS variants. See ``osinfo-query os`` for even more output.
|
||||||
|
|
||||||
|
|
||||||
|
@ -2100,7 +2099,7 @@ instance:
|
||||||
--name my-win10-vm \
|
--name my-win10-vm \
|
||||||
--memory 4096 \
|
--memory 4096 \
|
||||||
--disk size=40 \
|
--disk size=40 \
|
||||||
--os-variant win10 \
|
--osinfo win10 \
|
||||||
--cdrom /path/to/my/win10.iso
|
--cdrom /path/to/my/win10.iso
|
||||||
|
|
||||||
|
|
||||||
|
@ -2116,7 +2115,7 @@ of the default SPICE, and request 8 virtual CPUs and 8192 MiB of memory:
|
||||||
--memory 8192 \
|
--memory 8192 \
|
||||||
--vcpus 8 \
|
--vcpus 8 \
|
||||||
--graphics vnc \
|
--graphics vnc \
|
||||||
--os-variant centos7.0 \
|
--osinfo centos7.0 \
|
||||||
--location http://mirror.centos.org/centos-7/7/os/x86_64/
|
--location http://mirror.centos.org/centos-7/7/os/x86_64/
|
||||||
|
|
||||||
|
|
||||||
|
@ -2129,7 +2128,7 @@ Create a VM around an existing debian9 disk image:
|
||||||
--import \
|
--import \
|
||||||
--memory 512 \
|
--memory 512 \
|
||||||
--disk /home/user/VMs/my-debian9.img \
|
--disk /home/user/VMs/my-debian9.img \
|
||||||
--os-variant debian9
|
--osinfo debian9
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -191,10 +191,10 @@ GUEST OS OPTIONS
|
||||||
have been stored in the guest configuration during installation and virt-xml
|
have been stored in the guest configuration during installation and virt-xml
|
||||||
will retrieve it from there automatically.
|
will retrieve it from there automatically.
|
||||||
|
|
||||||
Use the command ``virt-xml --os-variant list`` to get the list of the
|
Use the command ``virt-xml --osinfo list`` to get the list of the
|
||||||
accepted OS variants. See ``osinfo-query os`` for even more output.
|
accepted OS variants. See ``osinfo-query os`` for even more output.
|
||||||
|
|
||||||
See virt-install(1) documentation for more details about ``--os-variant``
|
See virt-install(1) documentation for more details about ``--os-variant/--osinfo``
|
||||||
|
|
||||||
|
|
||||||
XML OPTIONS
|
XML OPTIONS
|
||||||
|
@ -378,7 +378,7 @@ for the guest OS by providing information about it on the command line:
|
||||||
|
|
||||||
.. code-block::
|
.. code-block::
|
||||||
|
|
||||||
# virt-xml fedora18 --os-variant fedora18 --add-device \
|
# virt-xml fedora18 --osinfo fedora18 --add-device \
|
||||||
--disk /var/lib/libvirt/images/newimage.qcow2,format=qcow2,size=10
|
--disk /var/lib/libvirt/images/newimage.qcow2,format=qcow2,size=10
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -900,9 +900,9 @@ c.add_compare("--location https://foobar.com --os-variant detect=no", "fake-http
|
||||||
c.add_compare("--location https://foobar.com --os-variant detect=yes,name=win7", "os-detect-success-fallback") # os detection succeeds, so fallback should be ignored
|
c.add_compare("--location https://foobar.com --os-variant detect=yes,name=win7", "os-detect-success-fallback") # os detection succeeds, so fallback should be ignored
|
||||||
c.add_compare("--pxe --os-variant detect=yes,name=win7", "os-detect-fail-fallback") # os detection succeeds, so fallback should be ignored
|
c.add_compare("--pxe --os-variant detect=yes,name=win7", "os-detect-fail-fallback") # os detection succeeds, so fallback should be ignored
|
||||||
c.add_compare("--connect %(URI-KVM-X86)s --install fedora26", "osinfo-url") # getting URL from osinfo
|
c.add_compare("--connect %(URI-KVM-X86)s --install fedora26", "osinfo-url") # getting URL from osinfo
|
||||||
c.add_invalid("--pxe --os-variant detect=yes,require=yes", grep="An --os-variant is required") # No os-variant detected, but require=yes
|
c.add_invalid("--pxe --os-variant detect=yes,require=yes", grep="--os-variant/--osinfo OS name is required") # No os-variant detected, but require=yes
|
||||||
c.add_invalid("--pxe --virt-type foobar", grep="Host does not support domain type")
|
c.add_invalid("--pxe --virt-type foobar", grep="Host does not support domain type")
|
||||||
c.add_invalid("--pxe --os-variant farrrrrrrge", grep="Unknown OS name") # Bogus --os-variant
|
c.add_invalid("--pxe --os-variant farrrrrrrge", grep="Unknown OS name")
|
||||||
c.add_invalid("--pxe --boot menu=foobar", grep="menu must be 'yes' or 'no'")
|
c.add_invalid("--pxe --boot menu=foobar", grep="menu must be 'yes' or 'no'")
|
||||||
c.add_invalid("--cdrom %(EXISTIMG1)s --extra-args console=ttyS0", grep="Kernel arguments are only supported with") # cdrom fail w/ extra-args
|
c.add_invalid("--cdrom %(EXISTIMG1)s --extra-args console=ttyS0", grep="Kernel arguments are only supported with") # cdrom fail w/ extra-args
|
||||||
c.add_invalid("--hvm --boot kernel=%(TREEDIR)s/pxeboot/vmlinuz,initrd=%(TREEDIR)s/pxeboot/initrd.img,kernel_args='foo bar' --initrd-inject virt-install", grep="Install method does not support initrd inject")
|
c.add_invalid("--hvm --boot kernel=%(TREEDIR)s/pxeboot/vmlinuz,initrd=%(TREEDIR)s/pxeboot/initrd.img,kernel_args='foo bar' --initrd-inject virt-install", grep="Install method does not support initrd inject")
|
||||||
|
@ -1207,7 +1207,7 @@ vixml = App("virt-xml")
|
||||||
c = vixml.add_category("misc", "")
|
c = vixml.add_category("misc", "")
|
||||||
c.add_valid("--help") # basic --help test
|
c.add_valid("--help") # basic --help test
|
||||||
c.add_valid("--sound=? --tpm=?") # basic introspection test
|
c.add_valid("--sound=? --tpm=?") # basic introspection test
|
||||||
c.add_valid("--os-variant list", grep="ubuntu10.10, ubuntumaverick") # --os-variant list
|
c.add_valid("--os-variant list", grep="ubuntu10.10, ubuntumaverick")
|
||||||
c.add_valid("test-state-shutoff --edit --update --boot menu=on", grep="The VM is not running") # --update with inactive VM, should work but warn
|
c.add_valid("test-state-shutoff --edit --update --boot menu=on", grep="The VM is not running") # --update with inactive VM, should work but warn
|
||||||
c.add_valid("test-state-shutoff --edit --boot menu=on", grep="XML did not change after domain define") # menu=on is discarded because <bootloader> is specified
|
c.add_valid("test-state-shutoff --edit --boot menu=on", grep="XML did not change after domain define") # menu=on is discarded because <bootloader> is specified
|
||||||
c.add_valid("test-for-virtxml --edit --graphics password=foo --update --confirm", input_text="no\nno\n") # prompt exiting
|
c.add_valid("test-for-virtxml --edit --graphics password=foo --update --confirm", input_text="no\nno\n") # prompt exiting
|
||||||
|
@ -1215,9 +1215,9 @@ c.add_valid("test-for-virtxml --edit --cpu host-passthrough --no-define --start
|
||||||
c.add_valid("test-for-virtxml --edit --metadata name=test-for-virtxml", grep="requested changes will have no effect")
|
c.add_valid("test-for-virtxml --edit --metadata name=test-for-virtxml", grep="requested changes will have no effect")
|
||||||
c.add_valid("--print-diff test-for-virtxml --remove-device --disk boot.order=5", grep="boot order=\"5")
|
c.add_valid("--print-diff test-for-virtxml --remove-device --disk boot.order=5", grep="boot order=\"5")
|
||||||
c.add_invalid("test --edit 2 --events on_poweroff=destroy", grep="'--edit 2' doesn't make sense with --events")
|
c.add_invalid("test --edit 2 --events on_poweroff=destroy", grep="'--edit 2' doesn't make sense with --events")
|
||||||
c.add_invalid("test --os-variant fedora26 --edit --cpu host-passthrough", grep="--os-variant is not supported")
|
c.add_invalid("test --os-variant fedora26 --edit --cpu host-passthrough", grep="--os-variant/--osinfo is not supported")
|
||||||
c.add_invalid("test-for-virtxml --os-variant fedora26 --remove-device --disk 1", grep="--os-variant is not supported")
|
c.add_invalid("test-for-virtxml --os-variant fedora26 --remove-device --disk 1", grep="--os-variant/--osinfo is not supported")
|
||||||
c.add_invalid("--build-xml --os-variant fedora26 --disk path=foo", grep="--os-variant is not supported")
|
c.add_invalid("--build-xml --os-variant fedora26 --disk path=foo", grep="--os-variant/--osinfo is not supported")
|
||||||
c.add_invalid("domain-idontexist --edit --cpu host-passthrough --start", grep="Could not find domain")
|
c.add_invalid("domain-idontexist --edit --cpu host-passthrough --start", grep="Could not find domain")
|
||||||
c.add_invalid("test-state-shutoff --edit --update --boot menu=on --start", grep="Cannot use --update")
|
c.add_invalid("test-state-shutoff --edit --update --boot menu=on --start", grep="Cannot use --update")
|
||||||
c.add_invalid("test --edit --update --events on_poweroff=destroy", grep="Don't know how to --update for --events")
|
c.add_invalid("test --edit --update --events on_poweroff=destroy", grep="Don't know how to --update for --events")
|
||||||
|
|
|
@ -928,7 +928,7 @@ def add_os_variant_option(parser, virtinstall):
|
||||||
msg += "\n"
|
msg += "\n"
|
||||||
msg += _("This is used for deciding optimal defaults like VirtIO.\n"
|
msg += _("This is used for deciding optimal defaults like VirtIO.\n"
|
||||||
"Example values: fedora29, rhel7.0, win10, ...\n"
|
"Example values: fedora29, rhel7.0, win10, ...\n"
|
||||||
"Use '--os-variant list' to see a full list.")
|
"Use '--osinfo list' to see a full list.")
|
||||||
|
|
||||||
osg.add_argument("--os-variant", "--osinfo", help=msg)
|
osg.add_argument("--os-variant", "--osinfo", help=msg)
|
||||||
return osg
|
return osg
|
||||||
|
|
|
@ -108,7 +108,7 @@ class _OSDB(object):
|
||||||
if len(oslist) == 0:
|
if len(oslist) == 0:
|
||||||
if raise_error:
|
if raise_error:
|
||||||
raise ValueError(_("Unknown OS name '%s'. "
|
raise ValueError(_("Unknown OS name '%s'. "
|
||||||
"See `--os-variant list` for valid values.") % key)
|
"See `--osinfo list` for valid values.") % key)
|
||||||
return None
|
return None
|
||||||
return _OsVariant(oslist[0])
|
return _OsVariant(oslist[0])
|
||||||
|
|
||||||
|
|
|
@ -365,7 +365,7 @@ def show_guest_warnings(options, guest, osdata):
|
||||||
not osdata.is_generic_requested() and
|
not osdata.is_generic_requested() and
|
||||||
guest.os.is_x86() and guest.os.is_hvm()):
|
guest.os.is_x86() and guest.os.is_hvm()):
|
||||||
log.warning(_("No operating system detected, VM performance may "
|
log.warning(_("No operating system detected, VM performance may "
|
||||||
"suffer. Specify an OS with --os-variant for optimal results."))
|
"suffer. Specify an OS with --osinfo for optimal results."))
|
||||||
|
|
||||||
_show_memory_warnings(guest)
|
_show_memory_warnings(guest)
|
||||||
|
|
||||||
|
@ -529,7 +529,7 @@ def set_explicit_guest_options(options, guest):
|
||||||
def installer_detect_distro(guest, installer, osdata):
|
def installer_detect_distro(guest, installer, osdata):
|
||||||
os_set = False
|
os_set = False
|
||||||
try:
|
try:
|
||||||
# OS name has to be set firstly whenever --os-variant is passed,
|
# OS name has to be set firstly whenever --osinfo is passed,
|
||||||
# otherwise it won't be respected when the installer creates the
|
# otherwise it won't be respected when the installer creates the
|
||||||
# Distro Store.
|
# Distro Store.
|
||||||
if osdata.get_name():
|
if osdata.get_name():
|
||||||
|
@ -545,7 +545,7 @@ def installer_detect_distro(guest, installer, osdata):
|
||||||
fail(_("Error validating install location: %s") % str(e))
|
fail(_("Error validating install location: %s") % str(e))
|
||||||
|
|
||||||
if not os_set and osdata.is_require():
|
if not os_set and osdata.is_require():
|
||||||
fail(_("An --os-variant is required, but no value was set or detected."))
|
fail(_("--os-variant/--osinfo OS name is required, but no value was set or detected."))
|
||||||
|
|
||||||
|
|
||||||
def _build_options_guest(conn, options):
|
def _build_options_guest(conn, options):
|
||||||
|
|
|
@ -154,7 +154,7 @@ def action_edit(guest, options, parserclass):
|
||||||
{"option": options.edit,
|
{"option": options.edit,
|
||||||
"objecttype": parserclass.cli_arg_name})
|
"objecttype": parserclass.cli_arg_name})
|
||||||
if options.os_variant is not None:
|
if options.os_variant is not None:
|
||||||
fail(_("--os-variant is not supported with --edit"))
|
fail(_("--os-variant/--osinfo is not supported with --edit"))
|
||||||
|
|
||||||
return cli.parse_option_strings(options, guest, inst, editing=True)
|
return cli.parse_option_strings(options, guest, inst, editing=True)
|
||||||
|
|
||||||
|
@ -181,7 +181,7 @@ def action_remove_device(guest, options, parserclass):
|
||||||
fail(_("Cannot use --remove-device with --%s") %
|
fail(_("Cannot use --remove-device with --%s") %
|
||||||
parserclass.cli_arg_name)
|
parserclass.cli_arg_name)
|
||||||
if options.os_variant is not None:
|
if options.os_variant is not None:
|
||||||
fail(_("--os-variant is not supported with --remove-device"))
|
fail(_("--os-variant/--osinfo is not supported with --remove-device"))
|
||||||
|
|
||||||
devs = _find_objects_to_edit(guest, "remove-device",
|
devs = _find_objects_to_edit(guest, "remove-device",
|
||||||
getattr(options, parserclass.cli_arg_name)[-1], parserclass)
|
getattr(options, parserclass.cli_arg_name)[-1], parserclass)
|
||||||
|
@ -204,7 +204,7 @@ def action_build_xml(conn, options, parserclass, guest):
|
||||||
fail(_("--build-xml not supported for --%s") %
|
fail(_("--build-xml not supported for --%s") %
|
||||||
parserclass.cli_arg_name)
|
parserclass.cli_arg_name)
|
||||||
if options.os_variant is not None:
|
if options.os_variant is not None:
|
||||||
fail(_("--os-variant is not supported with --build-xml"))
|
fail(_("--os-variant/--osinfo is not supported with --build-xml"))
|
||||||
|
|
||||||
inst = parserclass.lookup_prop(guest)
|
inst = parserclass.lookup_prop(guest)
|
||||||
if parserclass.prop_is_list(guest):
|
if parserclass.prop_is_list(guest):
|
||||||
|
|
Loading…
Reference in New Issue