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>
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>
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>
...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>
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>
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>
...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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>