The commit c5a46646 asks libvirt to fill in a default panic model for us.
Now libvirt domcaps can advertise panic models, Let's fill in the panic
model combo with the advertised values.
Signed-off-by: Lin Ma <lma@suse.de>
The reason we fork by default, is to force ssh to invoke
ssh-askpass when a password is required, rather than prompt on
a terminal no one is looking at. There's a more thorough
explanation here:
https://github.com/virt-manager/virt-manager/issues/731
With SSH_ASKPASS_REQUIRE=force, we now have a way to force ssh
to use askpass in the above scenario, when ssh and libvirt are new
enough.
The default forking behavior has caused maintenance pain in the
past, and is currently causing issues on macos:
https://github.com/virt-manager/virt-manager/issues/620
Let's flip the default to `--no-fork`. The VIRT_MANAGER_DEFAULT_FORK
env variable is there as an escape hatch incase I really miscalculated.
I don't expect many people are depending on use of askpass either
way, or if they are, they are launching virt-manager from their
desktop and not a terminal, which already gives us the correct
behavior AFAICT>
My suspicion is barely anyone will notice, which is why
I'm ok with changing this now, despite the libvirt support being
brand new.
If this doesn't raise any issues, then we can eventually drop
the forking behavior all together.
Signed-off-by: Cole Robinson <crobinso@redhat.com>
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>
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>
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>
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>
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>
_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>
* 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>
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>
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>
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>
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>
+ 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>
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>
Spice has maintained aspect ratio for us forever.
GtkVnc was added in previous commit, provided since May 2021.
If user is running on an old GtkVnc, they just get potentially
stretched out viewing when scaling is enabled, so the fallback
scenario is no big deal IMO
Signed-off-by: Cole Robinson <crobinso@redhat.com>
Right now you can select the option for an offline VM, but once
it starts up, and no spice agent is detected, the option is
set insensitive. This is a pain.
Keep the tooltip, but keep the option always selectable
Signed-off-by: Cole Robinson <crobinso@redhat.com>
We can use this signal to be notified when VM resolution changes.
Log when we actually detect a resolution change
Signed-off-by: Cole Robinson <crobinso@redhat.com>
Current code will take a screenshot when the 'New Snapshot'
dialog is initially launched, and then use that cached content
as the screenshot for the snapshot... which may be totally out
of date by the time the user enters all the snapshot info.
Instead, drop the snapshot preview UI in the 'New Snapshot' wizard
entirely, and use a screenshot that is fetched after the user actually
clicks 'Finish'
Signed-off-by: Cole Robinson <crobinso@redhat.com>
This is from when we used to support directly connecting to
serial console /dev/pty devices. Nowadays all serial connections
are mediated through libvirt stream APIs and we don't need to
care about SIGHUP
Signed-off-by: Cole Robinson <crobinso@redhat.com>
If the VM has implicit TPM state, use the VIR_DOMAIN_UNDEFINE_KEEP_TPM
flag to preserve that state when renaming the VM (if libvirt is new
enough).
The state is stored based on VM UUID and nothing else, and the UUID
is preserved during rename, so we don't need to do any of the same
trickery that's required for nvram duplication.
Signed-off-by: Cole Robinson <crobinso@redhat.com>
Fix console config validation for an edge case where both libvirt and
Spice/VNC TCP connection are on localhost. Transport over TCP does not
necessarily mean that libvirt connection is to a remote host.
Compare libvirt and graphics device addresses to localhost individually.
Raise an error only when guest device is bound to localhost but libvirt
connection is non-local (remote).
Validation that prevents fully local TCP seems to go back all the way to
bc13c302de ("console: Warn if qemu+tcp URI and listen == 127.0.0.1").
Signed-off-by: Sami Loone <sloone@forcepoint.com>
* add_q35_pcie_controllers already skips adding controllers if
any type=pci already exist, so delete the extra checking
* be more paranoid and only run the live edits when the machine
type actually changed from an expected config
Signed-off-by: Cole Robinson <crobinso@redhat.com>
The commit db8305ad explicitly adds pcie-root and pcie root ports for q35.
If the user selects i440FX chipset instead of Q35(default) from customize
dialog, The pre-defined pcie-root and ports cause failure when starting
i440fx VM installation because they're not applicable to i440fx.
It fails with below error message:
summary=Unable to complete install: 'XML error: The PCI controller with index='0'
must be model='pci-root' for this machine type, but model='pcie-root' was found instead'
details=Traceback (most recent call last):
File "/usr/share/virt-manager/virtManager/asyncjob.py", line 72, in cb_wrapper
callback(asyncjob, *args, **kwargs)
File "/usr/share/virt-manager/virtManager/createvm.py", line 2088, in _do_async_install
installer.start_install(guest, meter=meter)
File "/usr/share/virt-manager/virtinst/install/installer.py", line 737, in start_install
domain = self._create_guest(
File "/usr/share/virt-manager/virtinst/install/installer.py", line 679, in _create_guest
domain = self.conn.createXML(initial_xml or final_xml, 0)
File "/usr/lib64/python3.10/site-packages/libvirt.py", line 4442, in createXML
raise libvirtError('virDomainCreateXML() failed')
libvirt.libvirtError: XML error: The PCI controller with index='0' must be
model='pci-root' for this machine type, but model='pcie-root' was found instead
This patch fixes it by removing the pcie-root and ports for i440fx in
apply_overview.
Resolves: https://github.com/virt-manager/virt-manager/issues/444
Signed-off-by: Lin Ma <lma@suse.com>
internal snapshots largely only work if the VM is backed by a single
qcow2 disk. But newly supported external snapshots support other
disk formats, and multiple disks.
Drop the old validation checking. Let's just leave it up to libvirt
to give us an error at snapshot creation time
Signed-off-by: Cole Robinson <crobinso@redhat.com>
Currently, View->Consoles disables the menu items for serial devices
when the VM is offline. This changes that behavior. This is useful,
since it allows you to pre-select serial console before starting the
VM, which can help ensure you don't miss any serial boot output.
It also makes the UI interaction more intuitive.
Signed-off-by: Cole Robinson <crobinso@redhat.com>
Reproducer:
+ Start VM with 1 graphical and 1 serial console
+ Select serial console
+ Power off VM
+ Open console menu, select 'Graphical' option
+ See errors
Signed-off-by: Cole Robinson <crobinso@redhat.com>