Commit Graph

8648 Commits

Author SHA1 Message Date
Cole Robinson
7ff899b85e virt-manager: Add --fork option
This is a no-op for now, since this is already the default behavior

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-11-12 23:12:36 +01:00
Cole Robinson
17e39de021 virt-manager: Set SSH_ASKPASS_REQUIRE=force
openssh 8.4p1 released in Sep 2020 finally added a feature
to force using SSH_ASKPASS instead of prompting on the commandline
for password, if a password would be required.

https://man.openbsd.org/ssh.1#SSH_ASKPASS_REQUIRE

Getting this behavior is basically what our whole fork dance is
about. Now we can do it with an environment variable

Let the user override it from the environment though, so there's
an escape hatch incase this causes unforseen problems

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-11-12 23:12:36 +01:00
Pino Toscano
6c9842a158 ci: tweak Packit configuration
- drop all the architectures (and thus building only on x86_64):
  virt-manager has no architecture-specific installation bits, and thus
  it builds in the same way on every architecture; hence no need to
  explicitly test on various architectures
- test on all the supported Fedora versions (Rawhide included): this way
  it is possible to check that older versions are still supported, at
  least when building

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
2024-11-12 22:37:39 +01:00
Pino Toscano
d46674b822 fix: improve translatable message
- use a single translatable message, instead of splitting the text in
  two; it helps translators to have the full context/text
- improve the language a bit

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
2024-11-12 22:36:00 +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
Pavel Hrdina
2ce04b7cf6 virtinst.cli: replace DevicePanic.MODEL_ISA with "isa"
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2024-11-12 19:14:51 +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
c5a4664676 addhardware: panic: default to asking libvirt for default model
Drop our hardcoded model lists, and just ask libvirt to fill in
a model for us. Add an entry to the combo box so users can type
in a non-default value if they want one.

Long term libvirt should be providing all this info to us via
domcapabilities

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-11-12 09:55:20 -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
dc1c998265 console: Handle autoconnect=off for serial console too
Fixes: https://github.com/virt-manager/virt-manager/issues/584

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
Cole Robinson
715acbf541 console: Default to scaling=Always
I think this is a better default than the current `Only when
Fullscreen`, which is the same as `Never` for VM windowed mode.

I wrote my reasoning here:
https://github.com/virt-manager/virt-manager/issues/747

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
Grzegorz Szymaszek
c99b64725c man: update libvirt.org links
Fix no longer valid URL fragments, wrap at 80th column, remove dots that
follow only a few links.

Signed-off-by: Grzegorz Szymaszek <gszymaszek@short.pl>
2024-10-29 07:57:56 +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
1487dbd200 cli: --osinfo: clean up require= handling
It's kinda hard to follow the logic here. cli require= can only be
on|off or unset, but we use an internal 'auto' value which seems
like it can come from the cli.

Try to clean it up with enum like values.

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
3006c5a1d5 virtManager: drop libappindicator usage
Latest upstream release was back in 2012 and the new
libayatana-appindicator project is present in all distribution supported
by libvirt.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2024-10-14 08:51:07 +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
a9a78f45cf installer: rename has_install_phase to requires_postboot_xml_changes
has_install_phase is an ambiguous name for its intended purpose.
Really this is so API users have a way of knowing if the VM `install`
process requires 2 XML phases or not. Make that naming explicit

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-10-11 14:40:03 +02:00
Cole Robinson
1c8e6f8428 virt-install: Make --cloud-init reboot by default (again)
This basically reverts this commit from virt-manager 4.0.0

```
commit 825ec644b8
Author: Cole Robinson <crobinso@redhat.com>
Date:   Tue Mar 1 10:32:01 2022 -0500

    installer: Do not force reboot with --cloud-init

    Resolves: https://github.com/virt-manager/virt-manager/issues/189
```

After that commit, using `--cloud-init` or `--unattended` would
basically imply `--noreboot`

For some usage of `--cloud-init`, like in the initial report, this
makes sense to do. virt-install will drop you into the cloud image,
you mess without, run `poweroff`, and are surprised when virt-install
reboots the VM. I agreed, and made the change

But changing this was a bad idea.

cloud-init and unattended VMs have 2 XML phases. First XML is booting
off temporary media (the generated cloudinit iso), second XML is the
permanent boot config (booting off disk). We need to force the VM
to fully poweroff, so that the second XML config takes effect. We
make that happen with `<on_reboot>destroy</on_reboot>`, which tells
libvirt/qemu to poweroff the VM when it receives a guest reboot
notification. virt-install then defaults to restarting the VM when
it detects shutdown, to manually replicate the VM requested reboot,
but still get the second XML config to take effect.

The perennial problem with this is that, from outside the VM, we
don't know if the user inside the VM requested `poweroff` or `reboot`.
virt-install emulates the reboot behavior, and provides `--noreboot`
to override it. It's still confusing if a user puts a `poweroff`
command at the end of an anaconda kickstart file, and sees the VM
reboot, but it's been that way forever.

Except with that commit above, we flipped it for --cloud-init and
--unattended. Now, users who do `poweroff` are getting expected
behavior, but users who request `reboot` are not.

We could go further and add a `--yesreboot` option or similar. But
for consistency sake I think we should just revert that behavior,
and tell users to use --noreboot like usual.

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

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-10-11 14:40:03 +02:00
Cole Robinson
351233f8ec vmwindow: Default new window viewer size to 1280x800
This is qemu's default nowadays for modern video configs

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-10-10 11:21:56 -04: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
2ee224193d console: drop manual size request, let widgets do it for us
_adjust_viewer_size has one remaining function: when scaling and
resizeguest is disabled, do
viewer.set_size_request(*desktop_resolution), so the viewer fills
out the scrolled window and scrollbars show up.

After playing with this all a bunch, I discovered two things

* spice already behaves the way we want, so we don't need to
  manually intervene. so all that is unnecessary
* vnc has an option to behave the way we want, via the
  set_force_size knob

So instead lets rip it all out, and implement the VNC piece by
toggling set_force_size based on whether scaling+resizeguest is
enabled.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-10-10 11:15:35 -04:00
Cole Robinson
1d7fcac3df viewers: simplify shared self._display handling
* Move shared init to `_set_display`
* Move per class init to `_init_display`
* Move per class signal setup to `_connect_display_signals`
* Make base class call cleanup of child class via `_close`
* Drop unnecessary spice `_display_channel` handle

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-10-10 11:15:35 -04:00
Cole Robinson
7e79023b09 viewers: Share most of _refresh_grab_keys implementation
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
c498c519ed virt-install: Exit gracefully when VM is undefined behind our back
We still error, but don't throw a traceback.

Resolves: #455

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-10-08 13:40:30 -04: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
fe09e8f47e viewers: add explicit signal for desktop resize
this doesn't change any behavior, but it makes things cleaner
by not overloading the size-allocate signal

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-10-02 13:34:47 -04:00
Cole Robinson
f140ff1836 console: drop the scroll size-allocate callback
This does not seem to be required anymore. We get notified on
viewer size-allocate already, which seems like enough.

Rename the function to _adjust_viewer_size which is more accurate
to what it does, and adjust the callers

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-10-02 13:34:47 -04:00
Cole Robinson
e5208adc32 console: drop the console_size_allocate call
This mattered when we were doing widget adjustments to maintain
scaling ratio. But nowadays it seems totally redundant: we are
basically trying to set an allocation that already happened via
the normal chain of widget events, so it's a no-op.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-10-02 13:34:47 -04:00
Cole Robinson
24324bb6f5 console: Leave scroll policy as AUTOMATIC
We shouldn't need to forcibly set it to NEVER. It doesn't seem to
be required in my testing

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-10-02 13:34:47 -04:00
Cole Robinson
95006f42ba console: Clean up get_desktop_resolution usage
Checking for resolution = None is a roundabout way to check if
the console was already opened. Make that more clear

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-10-02 13:34:47 -04:00
Cole Robinson
371cd1ad60 console: Simplify usbredir menu handling
+ Don't check for redirdev devices, let the spice widget tell
  us if things aren't configured correctly.

+ Remove some duplication

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-10-02 13:34:47 -04:00
Cole Robinson
4cc52de8bb console: Fix widget size with scaling=never and host fractional scaling
We can not reliably use VM desktop resolution for host widget
sizes when the host is using desktop scaling, so don't even try.

This fixes the black bars around the VM console when scaling=never
and autoresize is disabled

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-10-02 13:34:47 -04:00
Cole Robinson
6b944ef6b8 console: Add a comment about _set_size_to_vm and fractional scaling
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-10-02 13:34:47 -04:00
Cole Robinson
bd0d0920ec console: Add logging to _set_size_to_vm
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-10-02 13:34:47 -04:00