Commit Graph

2153 Commits

Author SHA1 Message Date
Cole Robinson cfd6d6ead4 uitests: Finish vmmenu.py coverage
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-08-26 16:24:39 -04:00
Cole Robinson f15cdd732d graphics: Remove spice GL/rendernode version support warnings
The versions we are warning about are all over 4 years old, and
these warnings were initially just informative to help users know
when the config wasn't going to work. Drop most of it. Still warn
in the UI when a VM misconfig will prevent spice GL from working

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-08-26 15:20:05 -04:00
Cole Robinson bc9d6cf6d5 Drop some explicit openvz handling
I don't think many, if any, people are using virt-manager with
openvz. Drop the specific handling the filesystem UI, users can use
the raw XML editor if they need special behavior

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-08-26 15:20:05 -04:00
Cole Robinson f22e060190 Always assume objects support .isActive()
All drivers that support the listAll APIs, which we depend on,
also are new enough to support isActive, so stop checking support

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-08-26 15:20:05 -04:00
Pino Toscano 20c2f633d0 osdict: extend non-EOL distros range to 10 years
Commit d52d9885c8 added a logic to
consider as EOL a distribution with no EOL date set and release date
earlier than 5 years from the current day. This was done because there
were (and still are, even if fewer now) many old OSes in osinfo-db with
no EOL date set, which were thus considered "supported". Sadly, OSes
that are still supported, like Windows 10, Windows Server 2012, or
earlier versions of RHEL/CentOS/OL 6/7, are now considered "EOL".

As a hack on top of the initial hack, extend the range from 5 years to
10 years: this will consider some of the aforementioned OSes as
supported, without adding too many other OSes.

Of course the long term solution is to make sure all the OSes in
osinfo-db that are EOL upstream have a EOL date set, so there is no more
need to arbitrary exclusion logic.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Pino Toscano <ptoscano@redhat.com>
2020-08-18 13:50:59 -04:00
Cole Robinson bea401a2cf domcapabilities: Fix backtrace on python3.9
Apparently we can't set etree 'root.attrib = None' anymore

https://bugzilla.redhat.com/show_bug.cgi?id=1869046

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-08-18 13:49:16 -04:00
Cole Robinson 3e0155b055 osdict: Fix resource checking inheritance
-1 returned from osdict resource lookup means the value is unspecified.
When we encounter that value we should also check the 'all' arch
category, instead of stop processing.

This fixes some vcpus calculation for --os-variant rhel7.0 with
latest osdict

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-08-11 16:50:50 -04:00
Misono Tomohiro 8744e741d1 virtinst: Fix not to return duplicate entries from all_machine_names()
Since machine's canonical alias can be the same as other machine's
name, current all_machine_names() may return duplicates entries.
This causes the problem that the entry of "virt-5.0" appears twice in
machine selection menu when aarch64 is used.

So, fix this by just not adding the same entry twice.

Signed-off-by: Misono Tomohiro <misono.tm@gmail.com>
2020-07-24 20:12:38 +02:00
Cole Robinson fe1747e2fc tests: Add urldetect.py unit test coverage
Add data/urldetect with a bunch of distro tree content to trigger
full code coverage of virtinst/install/urldetect.py

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-07-18 19:28:04 -04:00
Cole Robinson 93c8e4aab3 urldetect: Drop attempt at sles9 distro detection
I can't find any publicly available media to test this case, I'm
not sure it does anything useful anyways, so just drop it

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-07-18 19:28:04 -04:00
Cole Robinson bf1fcdcd12 urldetect: Remove 'content' parsing for opensuse tumbleweed
tumbleweed uses treeinfo now, so this path shouldn't be hit in
the wild anymore

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-07-18 19:28:04 -04:00
Cole Robinson 25b3113ba9 osdict: Drop post_install driver bits
osinfo library doesn't return data for these with the fedora 32
version, so it's hard to get coverage testing. Since we aren't
even using this code yet anyways, let's remove it until it is needed

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-07-18 19:28:04 -04:00
Cole Robinson 2170efc9a5 virtinst: Unify test code paths when run as root
CI runs the code as root by default, fix up some of the differences

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-07-18 19:28:04 -04:00
Cole Robinson aa89a48371 xmlutil: Centralize all 'programming error' exceptions
Raise them directly instead of adding the hard to read conditional
into the function

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-07-17 19:08:27 -04:00
Cole Robinson 380a44318a virtinst: Centralize in_testsuite checking
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-07-17 19:08:27 -04:00
Cole Robinson 4f15e2d6eb cli: Fake fdopen to work around argcomplete bug with pytest
argcomplete will uncontionally try to take over fd=9 which causes
problems with pytest capturing

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-07-17 14:57:03 -04:00
Petr Benes 2862b68292 cli: Add --graphics websocket= support
Add a --graphics websocket option to configure VNC WebSocket port
as described in https://libvirt.org/formatdomain.html#elementsGraphics

Reviewed-by: Cole Robinson <crobinso@redhat.com>
2020-07-16 14:52:03 -04:00
Pino Toscano 2760b20c84 i18n: create single strings for texts/messages
Use single strings with proper placeholders for texts, so there is no
need to join together bits of translated texts.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Pino Toscano <ptoscano@redhat.com>
2020-07-15 10:22:26 -04:00
Pino Toscano 6f30ab2437 i18n: use plural forms where needed
Use plural forms for strings that depend on a runtime value, like a
count. This way they will get the proper string for the actual value.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Pino Toscano <ptoscano@redhat.com>
2020-07-14 11:24:14 -04:00
Pino Toscano cd15c72dfb i18n: fix string puzzle in waiting time string
Use two different strings in case there is a timeout and there is none.

Also add a "the" article to make it slightly better.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Pino Toscano <ptoscano@redhat.com>
2020-07-14 11:24:14 -04:00
Pino Toscano 6a28de0f22 i18n: globally install also the ngettext function
It will be used to translate strings with plural forms.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Pino Toscano <ptoscano@redhat.com>
2020-07-14 11:24:14 -04:00
Pino Toscano 353351458a i18n: fix Python format string
Fixes commit fec9f0b136.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Pino Toscano <ptoscano@redhat.com>
2020-07-14 11:24:14 -04:00
Pino Toscano 71f034d6b6 i18n: fix string puzzles in error messages
Do not split the error messages and the error details, but rather use a
single string with proper placeholders. This avoids string puzzles.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Pino Toscano <ptoscano@redhat.com>
2020-07-14 11:23:57 -04:00
Pino Toscano 523497085a i18n: fully translate "running console" messages
Create and pass the whole strings to the internal _run_console()
function: this way there is no need to second guess what the
%(console_type) placeholder is, and the types are actually translatable.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Pino Toscano <ptoscano@redhat.com>
2020-07-14 11:23:57 -04:00
Pino Toscano 6d970949f1 i18n: use "Generic OS" as label for generic
Change the label for a generic OS to "Generic OS", and making it
translatable.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Pino Toscano <ptoscano@redhat.com>
2020-07-13 15:37:00 -04:00
Pino Toscano 0145d9838b i18n: fix few spellings
"iSCSI", "KVM", "QEMU", "UNIX", "UUID", "VirtIO", "XML", "vCPU".

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Pino Toscano <ptoscano@redhat.com>
2020-07-13 15:37:00 -04:00
Charles Arnold 837bbf2bd3 Fix check for q35 machine type
This fix could be included independent of the other patches.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
2020-07-12 14:10:24 -04:00
Menno Lageman 25419db9ca virtinst: add support for configuring the IOMMU
Add a --iommu option to configure IOMMU parameters as described in
https://libvirt.org/formatdomain.html#elementsIommu

E.g. 'virt-install --iommu model=intel,driver.aw_bits=48,driver.iotlb=on ...'
will generate the following domain XML:

  <devices>
    <iommu model="intel">
      <driver aw_bits="48" iotlb="on"/>
    </iommu>
  </devices>

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Menno Lageman <menno.lageman@oracle.com>
2020-07-12 09:15:52 -04:00
Cole Robinson 35bfdc26a6 setup: Use xgettext --add-comments=translators
So in the code we can prefix comments with 'translators:' before
translated strings to have them show up in .pot file output

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-07-11 19:18:38 -04:00
Cole Robinson fec9f0b136 po: Fix message format warnings printed from xgettext
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-07-11 19:18:38 -04:00
Cole Robinson a8d2438d5a devices: interface: Rename is_conflict_net -> check_mac_in_use
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-07-06 10:17:10 -04:00
Cole Robinson f27e203732 cli: Skip MAC collision error with --check mac_in_use=
There's valid cases where a VM can be defined with a conflicting MAC
address. Prior to  ebd6091cc8 and related refactorings we were more
lax here if the conflicting VM wasn't running, but now we are blocking
some valid usage.

Hoist the validation check up to cli.py and add --check mac_in_use=off
to skip the validation. Advertise it like we do for other checks, so
now a collision error will look something like:

The MAC address '22:11:11:11:11:11' is in use by another virtual
machine. (Use --check mac_in_use=off or --check all=off to override)

Reported-by: Pino Toscano <ptoscano@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-07-06 10:17:10 -04:00
Cole Robinson 6a74a6a548 urldetect: Fix SafeConfigParser deprecation warning
It is an alias for ConfigParser in python 3.2+ plus

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-07-05 08:12:47 -04:00
Cole Robinson 3ea9a96961 tests: pylint: Silence some false positives
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-07-04 18:05:27 -04:00
Han Han 0af0f8fa2f disk: Remove unused constant IO_MODE_THREADS
Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Han Han <hhan@redhat.com>
2020-07-04 18:05:27 -04:00
Daniel Henrique Barboza ae3e92f0f5 tpm.py: make MODEL_SPAPR the default when running in ppc64
Users are fond of using "--tpm /dev/tpm0" to create a TPM device
for their VMs. ppc64 users, however, are experiencing errors because
the default TPM model is 'tpm-tis', which does not work in ppc64, and
they need to specify 'model=tpm-spapr' to work around that.

This patch makes the default TPM model change to 'tpm-spapr' when
running virt-install on a ppc64 host. A new test was added in test_cli.py
to test this new condition. This also keeps the 100% coverage of
the tpm.py file.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
CC: Satheesh Rajendran <sathnaga@linux.vnet.ibm.com>
CC: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-07-04 17:56:57 -04:00
Daniel Henrique Barboza 29963ac986 virtinst/progress.py: change 'fo' to make codespell happy
'codespell' returns errors on this file in the format of:

virtinst/progress.py:527: fo  ==> of, for

This has to do with the 'fo' instance variable of the TextMeter
class. The code was introduced in commit v1.2.1-131-gd5d6cfff,
when parts of the urlgrabber code were copied to avoid dependency
on python-urlgrabber.

Looking at how 'fo' is used, an alternative would be rename it to
'output', so let's make codespell and ourselves happier with less
lint errors.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-07-04 17:56:57 -04:00
Daniel Henrique Barboza bdb2bed3e9 virtinst: trivial codespell fixes
Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-07-04 17:56:57 -04:00
Fabiano Fidêncio b55b7e9462 urldetect: Deal with ubuntu 20.04 legacy installer
Ubuntu 20.04 has a new installer, which is yet not supported by
virt-install / osinfo-db, and this made ubuntu switch their URLs
for the old installer to current/legacy-images/... instead of
current/images/...

Let's adapt URL detect so it can deal with this new "legacy"
style.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2020-05-27 14:42:37 -04:00
Han Han f34f73622d rng: add builtin rng backend model
The builtin rng backend uses getrandom syscall to generate random, no
external rng source needed, introduced from libvirt v6.1.0.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Han Han <hhan@redhat.com>
2020-04-21 13:05:42 -04:00
Cole Robinson e79b550419 Fix pylint with latest pylint version
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-03-30 16:04:12 -04:00
Stefan Berger cd1713c6f2 tpm: add SPAPR (ppc64) device model
Add support for the tpm-spapr device model for pSeries VMs.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-03-30 15:59:37 -04:00
Cole Robinson 1afdc7ae32 createvm: Rework to track all Guest/Installer params explicitly
Rather than build a guest and installer instance depending on where
we are in the UI, track each input property in an explicit class, so
we can rebuild the guest/installer on demand with data accumulated
up to that point.

This makes the flow easier to follow and simplifies a lot of hacks we
have to do when backing up through the wizard, because we are trying
to unwind changes from an existing object, rather than just blowing
it away and easily reassembling it with updated info.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-02-05 19:39:45 -05:00
Cole Robinson 01eb65bd61 tests: Don't report UID/GID in fake caps data
Otherwise uitests can have different behavior depending on host state

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-02-05 19:39:45 -05:00
Cole Robinson 150b6ac95e virt-install: Add --reinstall=DOMAIN option
This allows using virt-install's install logic on an existing VM

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-02-03 09:03:02 -05:00
Cole Robinson 9385e8689b cli: Move some domain helpers from virt-xml to cli
We will need these elsewhere for upcoming patches

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-02-03 08:41:46 -05:00
Cole Robinson 8732b2d52b virtinst: installer: Add _make_cdrom_device helper
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-02-03 08:41:46 -05:00
Cole Robinson bea5e56c26 virtinst: connection: Add is_privileged
Replace the is_session and is_system distinction with variants
of is_privileged. This matches what libvirt uses internally, and
will help with supporting qemu:///embed at some point

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-02-03 07:05:11 -05:00
Cole Robinson 9a0d49a718 virtinst: uri: Rework MagicURI to work with passed in fakeuri
Rather than individual options for each possible hypervisor,
and annotations like 'remote' or 'session', just have it take a
fake URI to mock

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-02-03 07:05:11 -05:00
Cole Robinson f380d43e58 cli: Print more info about console commands
Googling for 'Graphics requested but DISPLAY is not set' shows there's
some confusion about virt-install's behavior in this area. This gives
more output in several related cases about what commands we are
running and the state of the VM

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-02-03 07:05:11 -05:00