Commit Graph

6344 Commits

Author SHA1 Message Date
Cole Robinson 6c28f53590 cli; Share --os-variant option registering
And improve the help message for both users
2019-01-08 12:44:53 -05:00
Cole Robinson 2a88d3a1af tests: clitest: Slim down virt-xml --os-variant tests
There's some redundancy here, and let's not depend on test-many-devices
which causes a lot of test suite churn
2019-01-08 12:24:50 -05:00
Cole Robinson 91dd6739c6 uitests: Cover vsock UI 2019-01-08 12:08:56 -05:00
Cole Robinson 0d3babe42b cli: Improve 'Unknown options' error
By mentioning the offending command line option, ex:

$ ./virt-install --boot disk
ERROR    Unknown --boot options: ['disk']
2019-01-08 11:50:36 -05:00
Cole Robinson 2f89ecf4a9 Remove Author lines from file headers
Similar to what was done in libvirt. See these commits:

600462834f
c99e954973
2019-01-08 11:45:35 -05:00
Cole Robinson d5d4a87723 about: copyright year is 2019 2019-01-08 11:33:58 -05:00
Povilas Kanapickas 23c489e220 console: Extract fullscreen exit code to separate class
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2019-01-07 18:12:29 -05:00
Marc Hartmayer 50633d3329 domain: add docstring for _convert_old_boot_order
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
2019-01-07 15:46:01 -05:00
Marc Hartmayer bf62001cfd domain: use else/elif since the conditions are mutually exclusive
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
2019-01-07 15:46:01 -05:00
Marc Hartmayer a5f5072b01 domain: remove indirection
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
2019-01-07 15:46:01 -05:00
Marc Hartmayer 29bfe2c682 domain: convert _change_boot_order to a instance method
This avoids the access of non-local variables of the closure.

Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
2019-01-07 15:46:01 -05:00
Marc Hartmayer c9d63546a3 netlist: use NamedTuple for storing a network device
This has the advantage that we can access the attributes by name and
it's immutable by design.

Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
2019-01-07 15:46:01 -05:00
Marc Hartmayer 0df18e29aa cli: refactor noset_cb
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
2019-01-07 15:46:01 -05:00
Marc Hartmayer 976a03c264 cli: don't use monkey patching
Instead we provide a meta class that can be used to customize the
subclass creation. It's similar to '__init_subclass__' (see
https://www.python.org/dev/peps/pep-0487/).

Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
2019-01-07 15:46:01 -05:00
Marc Hartmayer 4d33cb747d cli: use Python3 conventions: super()
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
2019-01-07 15:04:24 -05:00
Marc Hartmayer f555d3a2be cli: rename ParseMemdev to ParserMemdev
...since it meets the common naming scheme for VirtCLIParsers.

Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
2019-01-07 15:04:15 -05:00
Marc Hartmayer a8b1b5df0e cli: add register classmethod to each parser
Add a classmethod for registering the parser to each
VirtCLIParser. This allows us to register only those parsers that were
actually needed. Before this patch, each parser was registered when
the module 'virtinst.cli' was loaded. Now the parser will only be
registered if the corresponding CLI option is added,
e.g. 'add_gfx_option(...)' or the register method is called
explicitly.

Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
2019-01-07 15:01:54 -05:00
Marc Hartmayer 6e8a9cd963 cli: register a parser class only once
Make sure that a parser class can only be registered once.

Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
2019-01-07 14:52:15 -05:00
Marc Hartmayer 6476a6a489 test_urls: simplify the sorting
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
2019-01-07 14:46:00 -05:00
Marc Hartmayer b574beb668 xmlapi: refactor node_is_text function
...since it's used at least at three places.

Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
2019-01-07 14:45:53 -05:00
Fabiano Fidêncio 050acb68f1 virt-install: Default to libosnfo recommended disk size
If no disk options are passed, let's fallback to the libosinfo
recommended disk size for the OS variant.

The guest.set_capabilities_default(), build_installer() and the set of
the distro variant have been moved earlier in the code in order to fetch
the correct information from libosinfo and then set the recommended disk
size without changing much of build_guest_instance() logic.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-01-07 12:24:06 +01:00
Fabiano Fidêncio 5eb47bc00f guest: Default to libosinfo recommended resources
Let's create a new method that defaults to libosinfo's recommended
resources (when they're available) for memory and vcpus.

It'll help us to avoid erroring out whenever virt-install is called
without specifying the memory amount, as the recommended amount of
memory would come from libosinfo.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-01-07 12:24:06 +01:00
Cole Robinson 4336bdb92d cli: Fix --check completion
Make the completer functions fold in ParseCLICheck as well
2019-01-06 19:03:35 -05:00
Lin Ma a31bf70620 .gitignore: Remove the outdated path info of bashcompletion files
Commit 73f07c5 generates the bashcompletion files in build folder, The
'/data/bash-completion' no longer exists, So remove it in .gitignore.

Signed-off-by: Lin Ma <lma@suse.com>
2019-01-06 18:40:50 -05:00
Cole Robinson e66823a173 testdriver: Add vsock example 2019-01-06 18:27:17 -05:00
Slavomir Kaslev 021d2938af virt-manager: Add support for vsock devices to Add Hardware UI
This patch adds support for adding vsock devices to a VM.

Signed-off-by: Slavomir Kaslev <kaslevs@vmware.com>
2019-01-06 18:27:17 -05:00
Slavomir Kaslev a9092b6abe virt-manager: Add support for vsock device to Hardware Details UI
Add support for vsock devices to Hardware Details UI so that vsock devices can
be configured or removed.

Signed-off-by: Slavomir Kaslev <kaslevs@vmware.com>
2019-01-06 18:27:17 -05:00
Slavomir Kaslev 2afa06c128 virt-manager: Add vsock sockets details UI
Add vsock details UI which will be shared between Hardware Details and Add
Hardware UIs.

Signed-off-by: Slavomir Kaslev <kaslevs@vmware.com>
2019-01-06 18:27:17 -05:00
Slavomir Kaslev be1b5e6ebb virtinst: Add vsock device type
VSOCK sockets allow communication between virtual machines and the host they are
running on.

This patch adds vsock device support along with clitest for the new properties.

Signed-off-by: Slavomir Kaslev <kaslevs@vmware.com>
2019-01-06 18:04:26 -05:00
Cole Robinson e103c5fa81 tests: Skip completion tests if argcomplete isn't installed 2018-12-19 11:53:14 -05:00
Cole Robinson 91c274efbb cli: Make argcomplete optional
It's only invoked when bash completion is attempted. Will make it
a bit nicer for devs to just pull down and run the code
2018-12-18 15:39:08 -05:00
Cole Robinson eb85f8a887 cli: Centralize argcomplete completer hackery
This way it will be harder to miss a class when we add more commandlines
in the future
2018-12-18 15:39:08 -05:00
Cole Robinson b68656329d tests: Add argcomplete testing 2018-12-18 15:39:08 -05:00
Cole Robinson 705107bbb0 spec: install bashcompletion files 2018-12-18 14:23:01 -05:00
Cole Robinson 73f07c54ee setup: Generate bashcompletion files in builddir 2018-12-18 14:23:01 -05:00
Lin Ma a2850f345b setup.py: Install the bash completion files
Signed-off-by: Lin Ma <lma@suse.com>
2018-12-18 11:20:35 -05:00
Lin Ma ce0cad96ac Bash completion template
The most of content of this file comes from the output of the command '
register-python-argcomplete $MY-SCRIPT', plus some changes.
For the details about argcomplete, Please refer to
https://pypi.org/project/argcomplete/ or
https://github.com/kislyuk/argcomplete

With this patchset, Users can use completion in bash.
ex:

$ virt-xml --<TAB><TAB>
$ virt-install --disk <TAB><TAB>
$ virt-install --panic model=isa,<TAB><TAB>
$ virt-install --controller model=virtio-scsi,ty<TAB><TAB>

Signed-off-by: Lin Ma <lma@suse.com>
2018-12-18 11:20:35 -05:00
Lin Ma 2d38e22943 cli: Add auto complete support about sub options
With this patchset, the sub options completion is available. ex:

$ virt-install --disk <TAB><TAB>
...
bus=    cache=      format=     path=   serial=     size=
...

$ virt-install --disk path=test.qcow2,cache=none,<TAB><TAB>
...
bus=    format=     serial=     size=
...

$ virt-install --disk bu<TAB><TAB>
Then the sub option 'bus' will be auto completed with a '='
$ virt-install --disk bus=

Signed-off-by: Lin Ma <lma@suse.com>
2018-12-18 11:20:35 -05:00
Lin Ma e7e6f873cc virt-convert: Add auto complete support for the general options
Signed-off-by: Lin Ma <lma@suse.com>
2018-12-18 11:20:35 -05:00
Lin Ma 4b09a26578 virt-xml: Add auto complete support for the general options
Signed-off-by: Lin Ma <lma@suse.com>
2018-12-18 11:20:35 -05:00
Lin Ma 38f375cf27 virt-clone: Add auto complete support for the general options
Signed-off-by: Lin Ma <lma@suse.com>
2018-12-18 11:20:35 -05:00
Lin Ma f6076a0eb0 virt-install: Add auto complete support for the general options
With this patchset, the general options completion is available. ex:

$ virt-install -<TAB><TAB>
...
--arch      --check     --cpu       --dry-run   -h
--autostart --clock     --cputune   --events    --help
...

$ virt-install --a<TAB><TAB>
--arch       --autostart

Signed-off-by: Lin Ma <lma@suse.com>
2018-12-18 11:20:35 -05:00
Lin Ma d68f0f8867 cli: Add the generic completer function and validator function
The patch adds the generic completer and validator, Further patches use
them as completer/validator. The completer won't add already specified
options to the list.

Signed-off-by: Lin Ma <lma@suse.com>
2018-12-18 11:20:35 -05:00
Cole Robinson a8d4c7cb79 cli: Fix --security baselabel=X 2018-12-17 09:06:03 -05:00
Cole Robinson b91393e6c3 cli: s390x+graphics specified, use video=virtio (bz #1654994)
s390x doesn't support any of the PCI graphics cards

https://bugzilla.redhat.com/show_bug.cgi?id=1654994
2018-12-13 16:39:43 -05:00
Slavomir Kaslev 0889c7c7e4 virt-manager: Fix misspelling caught by codespell
Signed-off-by: Slavomir Kaslev <kaslevs@vmware.com>
2018-12-10 10:43:55 +08:00
Fabiano Fidêncio ee0ac5f2c7 osdict: adapt latest_os_version() to ignore "-unknown" distros
As some enterprise distros adopted the "unknown" approach in osinfo-db,
and those usually support different versions at the same time, there may
be different "unknown" entries (like rhel-unknown, rhel-8-unknown,
rhel-7-unknown, and so on) for the very same distro.

This situation can easily happen when some ISO matches, for exmaple,
"rhel-unknown" and then the latest one selected would be
"rhel-8-unknown".

In order to avoid this situation from happening, let's just ignore the
"unknown" entries when calling latest_regex().

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2018-12-05 15:04:59 +01:00
Fabiano Fidêncio fbcea0b63c osdict: adapt latest_regex() to openSUSE's versioning
Due to OpenSUSE's decision of versioning their OS as 11.x, 12.x, 42.x,
15.x, we have to add a specific check in latest_regex() in order to make
sure we skip the 42.x series in the sorted list of OSes when returning
the OS name to the user.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2018-12-05 15:04:59 +01:00
Fabiano Fidêncio 7612c5bdcd osdict: expand the "unknown" check for any distro
Currently osinfo-db has "unknown" entries for fedora, opensuse and
asianux. Considering this list may grow even more at some point, let's
just make the check more generic and use it for all of them instead of
keeping it for fedora only.

Changes have also been done in urldetect and tests_url, as those also
used latest_fedora_version().

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2018-12-05 15:04:59 +01:00
Miro Hrončok 5f5b49f289 https://fedoraproject.org/wiki/Changes/No_more_automagic_Python_bytecompilation_phase_2 2018-11-15 13:28:45 -05:00