Commit Graph

2085 Commits

Author SHA1 Message Date
Lin Ma
f9ceec2b14 tests: Update capabilities for advertisting panic device models
Signed-off-by: Lin Ma <lma@suse.de>
2024-12-10 14:05:20 +01:00
Andrea Bolognani
8af438dd58 cpu: Prefer maximum mode for many emulated guests
The actual default CPU at the QEMU level is often a relatively
poor choice, which is stuck with just baseline functionality
and can sometimes not run modern guests at all.

Whenever possible, prefer maximum mode for a much nicer out of
the box experience.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2024-12-10 14:01:32 +01:00
Andrea Bolognani
fca41cfaa9 cli: Support --cpu maximum
This mode has been introduced in libvirt 7.1.0 (March 2021) and
can be already used today with

  --cpu mode=maximum

This is however slightly inconvenient to type and is not
consistent with the special treatment that the other modes
(host-passthrough, host-model) get.

Introduce a proper special mode for it.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2024-12-10 14:01:32 +01:00
Pavel Hrdina
cb2e5aa782 tests: urls: update old and obsolete OS versions
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2024-11-26 15:57:05 +01:00
Pavel Hrdina
06265f8013 tests: urls: replace Scientific Linux with AlmaLinux
Scientific Linux is no longer supported as it ended with version 7 so
change it to AlmaLinux that is mentioned to be used instead.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2024-11-26 15:54:45 +01:00
Cole Robinson
17f171cdb7 cli: add --network passt,portForward=8080:80 convenience syntax
Roughly mirroring `podman run -p` syntax. Examples:

--network passt,portForward=8080:80
--network passt,portForward0=7000-8000/udp,portForward1=127.0.0.1:2222:22

Resolves: https://github.com/virt-manager/virt-manager/issues/751

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-11-21 21:59:44 +01:00
Cole Robinson
2f8f0e8151 virt-xml: implement --edit --boot uefi=off
Disable all UEFI config bits for an existing VM

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-11-21 21:51:24 +01:00
Cole Robinson
cfcd63b74e virt-install: implement --boot uefi=off
Tells virt-install to not use UEFI, if it would normally default
to it.

This likely isn't too useful in practice, since all occasions we
default to UEFI require it. But it future proofs opt out in case
we ever start defaulting to UEFI in cases where BIOS still works.

Resolves: https://github.com/virt-manager/virt-manager/issues/692

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-11-21 21:51:24 +01:00
Cole Robinson
f082087348 cli: Add stub support for --boot uefi=on|off
The way `--boot uefi` is implemented allows a value to be passed,
but the value is completely ignored. So `--boot uefi=off` or
`--boot uefi=FOOBAR` is treated the same as `--boot uefi`

Lets fix this by making `--boot uefi` and `--boot uefi=on` the same,
`--boot uefi=off` will be implemented later, but any other value
throws an error. This is technically an CLI break but I don't
think it's anything to worry about

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-11-21 21:51:24 +01:00
Cole Robinson
f3aa24bd5d virt-install: use default --cpu mode more often
Currently we will only apply the default `--cpu mode=host-passthrough`
config when _no_ `--cpu` config is passed. But this means if a user
configures ex. cpu `<topology>`, we don't set `host-passthrough` and
they get the libvirt/qemu default baseline CPU.

Instead, only skip the default config if the user manually
specified a `mode` or `model` value directly

https://issues.redhat.com/browse/RHEL-65371

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-11-19 21:21:25 +01:00
Cole Robinson
8fb78739e7 virt-clone: try harder to allow nonexisting images with --preserve
Input XML can have non-existent disk images as long as `--preserve`
is used, or those disks are skipped for any reason. We already
handle that correctly in some cases, but others we fail. This
covers another one.

Resolves: https://github.com/virt-manager/virt-manager/issues/563

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-11-19 21:19:25 +01:00
Cole Robinson
058d8b4ccd storage: Add testsuite way to trigger StoragePool.install error
With the libvirt testdriver, we can create+start a directory
pool that points to any arbitrary host path. But this doesn't
match the behavior of the real storage driver, where pool start
will fail if the source directory doesn't exist.

Let's mock this by raising an exception if we are inside the
test suite and we see a special string in the pool XML

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-11-19 21:19:25 +01:00
Cole Robinson
8eb87af411 cloner: Handle .qcow2 nvram extension
We were hardcoding .fd extension, but it can be different nowadays

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-11-19 21:19:25 +01:00
Cole Robinson
276aa4a72e virt-clone: only attempt --reflink for raw images
--reflink only works with raw images, since copying anything else
will hit the qemu-img code path in libvirt storage driver.
This can pop up more nowadays since UEFI support is using qcow2 as
well.

Let's only attempt --reflink for raw disk images. It's basically
an optimization anyways

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

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-11-19 21:19:25 +01:00
Cole Robinson
2835c250c7 virt-install: support --input none
Disables adding any default input devices

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-11-19 19:41:19 +01:00
Cole Robinson
c78ec96933 virt-install: let libvirt handle --input bus=default
Our logic here is poorly duplicating libvirt's postparse logic.
Notably it will try to add bus=ps2 on non-x86, and misses obscure
cases like parallels.

https://issues.redhat.com/browse/RHEL-66768

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-11-19 19:41:19 +01:00
Lin Ma
301423b83a virt-install: Fix the active_pcr_banks issue for TPM emulator
The commit 6baa327d added active_pcr_banks support, but put it under the child
element <tpm>, which is wrong, It should be under sub child element <backend>.

Before:
  --tpm model=tpm-tis,backend.type=emulator,backend.version=2.0,\
      active_pcr_banks.sha1=on,\
	  active_pcr_banks.sha256=yes,\
	  active_pcr_banks.sha384=yes,\
	  active_pcr_banks.sha512=yes

  It results in the following domain xml:
    <tpm model='tpm-tis'>
      <backend type='emulator' version='2.0'/>
      <alias name='tpm0'/>
    </tpm>

After:
  --tpm model=tpm-tis,backend.type=emulator,backend.version=2.0,\
      backend.active_pcr_banks.sha1=on,\
	  backend.active_pcr_banks.sha256=yes,\
	  backend.active_pcr_banks.sha384=yes,\
	  backend.active_pcr_banks.sha512=yes

  It results in the following domain xml:
    <tpm model='tpm-tis'>
      <backend type='emulator' version='2.0'>
        <active_pcr_banks>
          <sha1/>
          <sha256/>
          <sha384/>
          <sha512/>
        </active_pcr_banks>
      </backend>
      <alias name='tpm0'/>
    </tpm>

Signed-off-by: Lin Ma <lma@suse.de>
2024-11-13 11:29:09 +01:00
Lin Ma
fd48e0be57 virt-install: Add --tpm backend.source support
E.g.
    virt-install \
    ... \
    --tpm model=tpm-tis,backend.type=emulator,backend.version=2.0,\
          backend.source.type=dir,backend.source.path=/some/dir

  It results in the following domain xml:
  <backend type="emulator" version="2.0">
    <source type="dir" path="/some/dir"/>
  </backend>

Signed-off-by: Lin Ma <lma@suse.de>
2024-11-13 11:29:09 +01:00
Lin Ma
7e4f7ae3d8 virt-install: Add support for 'debug' parameter on TPM emulator
E.g.
    virt-install \
    ... \
    --tpm model=tpm-tis,backend.type=emulator,backend.version=2.0,backend.debug=3

  It results in the following domain xml:
  <tpm model="tpm-tis">
    <backend type="emulator" version="2.0" debug="3"/>
  </tpm>

Signed-off-by: Lin Ma <lma@suse.de>
2024-11-13 11:29:09 +01:00
Lin Ma
1219030319 virt-install: Add support for streams attribute for 'virtio' sound card
E.g.
    virt-install \
    ... \
    --sound model=virtio,streams=4

  It results in the following domain xml:
  <sound model="virtio" streams="4"/>

Signed-off-by: Lin Ma <lma@suse.de>
2024-11-13 11:29:09 +01:00
Lin Ma
e883e7d525 virt-install: Add support for multi-channel mode for 'usb' sound card
E.g.
    virt-install \
    ... \
    --sound model=usb,multichannel=yes

  It results in the following domain xml:
  <sound model="usb" multichannel="yes"/>

Signed-off-by: Lin Ma <lma@suse.de>
2024-11-13 11:29:09 +01:00
Lin Ma
1c0f7f62e8 virt-install: Add support for blockio.discard_granularity
E.g.
    virt-install \
    ... \
    --disk /tmp/disk0.qcow2,size=16,driver.type=qcow2,blockio.discard_granularity=4096

  It results in the following domain xml:
  <disk type='file' device='disk'>
    <driver name='qemu' type='qcow2' discard='unmap'/>
    <source file='/tmp/disk0.qcow2'/>
    <target dev='vda' bus='virtio'/>
    <blockio discard_granularity="4096"/>
  </disk>

Signed-off-by: Lin Ma <lma@suse.de>
2024-11-13 11:29:09 +01:00
Pavel Hrdina
cbd2a7ef92 update setup.py usage and docs to meson
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2024-11-12 23:18:32 +01:00
Pavel Hrdina
5f34dea0ed meson: add tests
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2024-11-12 23:18:32 +01:00
Cole Robinson
0755711372 tests: uitests: cover cli changes
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-11-12 23:12:36 +01:00
Pavel Hrdina
5126c007ec tests: update tests to reflect the latest panic device changes
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2024-11-12 19:15:04 +01:00
Cole Robinson
48ec63cce2 tests: uitests: tweak for panic dev changes
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-11-12 09:57:47 -05:00
Cole Robinson
ebeb80073e devices: panic: let libvirt fill in model default
Currently `--panic default` for aarch64 doesn't even request
a `<panic/>` device due to quirky xmlbuilder behavior. Fix that,
but more generally just leave model empty and let libvirt fill it
in for us.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-11-12 09:44:37 -05:00
Cole Robinson
afa8231525 virt-install: add --network hostdev=HOSTDEV
This is a special convenience option for filling in `type=hostdev`
config using the same format of lookup string that can be
passed to `--hostdev`

Fixes: https://github.com/virt-manager/virt-manager/issues/500

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-11-11 15:30:25 -05:00
Cole Robinson
300f934cae virt-install: add --network type=hostdev,source.address.X= pci options
This just covers the common PCI case with these new options

source.address.type=
source.address.domain=
source.address.bus=
source.address.slot=
source.address.function=

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-11-11 14:26:47 -05:00
Cole Robinson
315b340fc4 virt-install: add --features msrs.unknown=ignore
Fixes: https://github.com/virt-manager/virt-manager/issues/570

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-11-11 14:13:59 -05:00
Cole Robinson
7dd7383bcb tests: uitests: cover serial autoconnect bug fix
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-11-11 14:06:42 -05:00
Cole Robinson
97ab16a73d uitests: fix coverage with scaling default change
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-11-11 14:55:26 +01:00
Jose
5875019b2d Update installertreemedia.py
Removing duplicated verb "be"
2024-11-11 14:27:22 +01:00
Cole Robinson
8f75ac4e6e virt-install: implement --osinfo require=no as fallback name=generic
This is essentially what it has always behaved as, but making it
explicit in the code will now trigger the extra warnings when
detect=on is also used.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-10-14 15:21:15 +02:00
Cole Robinson
e02607766c virt-install: Warn if --osinfo detect=on,name=OSNAME detection fails
Using `detect=on,name=OSNAME` is good for CI safety, incase
a new distro tree has a regression with detection, or if testing
against a new distro that osinfo-db doesn't know about.

But virt-install should still try to inform the user that detection
failed, and suggest filing a bug if the user expected it to work.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-10-14 15:21:15 +02:00
Cole Robinson
e3da4337f6 cli: --osinfo detect=on shouldn't default to require=off
The require= behavior should be AUTO for this case, but the
way we were previously initializing variables made this OFF.
I don't think this was intentional. We should have changed
this when we started defaulting to `detect=on`

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-10-14 15:21:15 +02:00
Cole Robinson
a28401cb12 tests: Test that --osinfo detect=on implies require=off
This is current behavior, but it was unintentional and we will
change it.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-10-14 15:21:15 +02:00
Pavel Hrdina
31eab9b46a pylint: fix false positive errors
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2024-10-13 17:11:06 +02:00
Pavel Hrdina
d4194c134b misc: codespell fixes
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2024-10-13 15:26:08 +02:00
Cole Robinson
d231e66a96 console: Fix resize_to_vm with host fractional scaling
Trying to size the window based on VM desktop resolution does
not do the correct thing when host fractional scaling is enabled
and using spice.

The best we can do here is ask the viewer widget for its
preferred size

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-10-10 11:15:35 -04:00
Cole Robinson
51c3f1c687 virt-xml: Add --edit --convert-to-vnc
This wires up the guest.convert_to_vnc function to command line,
and documents it.

There's one suboption `qemu-vdagent=on|off`, defaulting to `off`

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-10-09 11:03:43 +02:00
Cole Robinson
f7988a94e6 guest: convert_to_vnc: optionally add qemu-vdagent
Disabled by default, but maybe we turn it on in the future
when qemu-vdagent supports migration.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-10-09 11:03:43 +02:00
Cole Robinson
d58299ee6b guest: convert_to_vnc: convert video device
This is mostly about stripping out spice references. All qxl devices
are converted to app defaults

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-10-09 11:03:43 +02:00
Cole Robinson
f0078a179d guest: remove spiceport devices when spice is removed
serial/console type='spiceport' is another spice specific device,
so remove that too

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-10-09 11:03:43 +02:00
Cole Robinson
229b905053 guest: add convert_to_vnc()
This is the beginnings of support for a `virt-xml --convert-to-vnc`
option. Take an existing VM, strip out most of the previous graphics
config, and add VNC graphics.

We try to convert over some of the shared graphic bits, like listen
and port settings, if they were previously specified.

If spice GL was enabled, we convert to egl-headless config

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-10-09 11:03:43 +02:00
Cole Robinson
dd354e8b72 virt-xml: add --edit --convert-to-q35
Wire up guest.convert_to_q35 to the CLI. We add one suboptions,
`num_pcie_root_ports=X`, matching the pre-existing
`--controller num_pcie_root_ports=X` option

Nothing fancy here. See man page docs for details

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-10-03 14:20:12 -04:00
Cole Robinson
454aad78a4 guest: add convert_to_q35
This function converts a PC/i400FX XML config to Q35. Mostly
this is deleting any plain PCI addresses and controllers, adding
pcie-root-ports, convert IDE -> SATA, and let libvirt fill in
the rest.

This the implementation piece. CLI additions come later

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-10-03 14:20:12 -04:00
Cole Robinson
f66cca92a9 cli: Make --xml option parsing less special
We can make `--xml` fit the common xml cli option paradigm, which
less us drop a whole bunch of special handling in virt-xml

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-10-01 12:30:34 -04:00
Cole Robinson
4941bb922f testmock: Remove some console mocking that's no longer required
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-09-26 09:19:57 -04:00