virt-xml: Accept --os-variant option

We're not doing anything with it yet, but having the
parser accept it means we can write tests and see how
their output changes once we wire it up in earnest.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
This commit is contained in:
Andrea Bolognani 2018-11-09 16:36:38 +01:00 committed by Pavel Hrdina
parent 751fb88c58
commit ade53764fc
2 changed files with 35 additions and 0 deletions

View File

@ -160,6 +160,30 @@ Before defining or updating the domain, show the generated XML diff and interact
=head1 GUEST OS OPTIONS
=over 4
=item B<--os-variant> OS_VARIANT
Optimize the guest configuration for a specific operating system (ex.
'fedora29', 'rhel7', 'win10'). While not required, specifying this
options is HIGHLY RECOMMENDED, as it can greatly increase performance
by specifying virtio among other guest tweaks.
If the guest has been installed using virt-manager version 2.0.0 or newer,
providing this information should not be necessary, as the OS variant will
have been stored in the guest configuration during installation and virt-xml
will retrieve it from there automatically.
Use the command "osinfo-query os" to get the list of the accepted OS
variants.
=back
=head1 XML OPTIONS =head1 XML OPTIONS
=over 4 =over 4
@ -331,6 +355,12 @@ Create a 10G qcow2 disk image and attach it to 'fedora18' for the next VM startu
# virt-xml fedora18 --add-device \ # virt-xml 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
Same as above, but ensure the disk is attached to the most appropriate bus
for the guest OS by providing information about it on the command line:
# virt-xml fedora18 --os-variant fedora18 --add-device \
--disk /var/lib/libvirt/images/newimage.qcow2,format=qcow2,size=10
Hotunplug the disk vdb from the running domain 'rhel7': Hotunplug the disk vdb from the running domain 'rhel7':
# virt-xml rhel7 --update --remove-device --disk target=vdb # virt-xml rhel7 --update --remove-device --disk target=vdb

View File

@ -360,6 +360,11 @@ def parse_args():
outg.add_argument("--confirm", action="store_true", outg.add_argument("--confirm", action="store_true",
help=_("Require confirmation before saving any results.")) help=_("Require confirmation before saving any results."))
osg = parser.add_argument_group(_("OS options"))
osg.add_argument("--os-variant", dest="distro_variant",
help=_("The OS variant installed in the guest, "
"e.g. 'fedora29', 'rhel7', 'win10 etc."))
g = parser.add_argument_group(_("XML options")) g = parser.add_argument_group(_("XML options"))
cli.add_disk_option(g, editexample=True) cli.add_disk_option(g, editexample=True)
cli.add_net_option(g) cli.add_net_option(g)