Commit Graph

32 Commits

Author SHA1 Message Date
Cole Robinson
014d1ef99b console: Cleanup and improve console menu handling
- Rework the ConsolePages abstraction to carry the Gtk.Menu. makes
  it all less messy

- Make the console menu the single source of truth for console
  embeddability, and error message reporting

- Small misc cleanups here and there

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-03-03 12:52:37 -05:00
Feng Jiang
409e4bf2d1 console: Select the first embeddable graphics device as graphical console
Currently, when there are multiple graphics devices, the first graphics
device is always selected as the graphical console. For the following
configuration:

    <graphics type="egl-headless">
      <gl rendernode="/dev/dri/renderD128"/>
    </graphics>
    <graphics type="spice" autoport="yes">
      <listen type="address"/>
      <image compression="off"/>
      <gl enable="no"/>
    </graphics>

virt-manager will report an error:

    Cannot display graphical console type 'egl-headless'

The patch will iterate through all graphics devices to try to select the
first embeddable graphics device as graphical console.

Signed-off-by: Feng Jiang <jiangfeng@kylinos.cn>
Signed-off-by: Liming Sun <sunliming@kylinos.cn>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
2024-03-03 12:52:20 -05:00
Feng Jiang
d83074a001 domain: Add idx parameter to open_graphics_fd()
Now open_graphics_fd() always opens the 1st graphic device, when
there are multiple graphic devices (e.g. spice + egl-headless),
we need to specify the index number for libvirt.

Signed-off-by: Feng Jiang <jiangfeng@kylinos.cn>
Signed-off-by: Ming Xie <xieming@kylinos.cn>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
2024-03-03 12:52:20 -05:00
Feng Jiang
9c242ef79c console: Move embeddable_graphics() to console.py
Signed-off-by: Feng Jiang <jiangfeng@kylinos.cn>
Signed-off-by: Weishi Li <liweishi@kylinos.cn>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
2024-03-03 12:52:20 -05:00
Cole Robinson
1aaa28e26a tests: uitests: Add coverage for when spice is missing
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-02-27 14:23:09 -05:00
Cole Robinson
382391eadb Clean up gtk STOCK and various image usage
- Remove most use of deprecated stock icons. Without it the UI will
  be a lot more ugly in Fedora 36
- Remove deprecated ImageMenuItem usage, convert to regular MenuItem
- Remove most embedded button images

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-02-19 15:33:42 -05:00
Cole Robinson
87e0ed5de0 Revert "details: console: drop hardcoding background color as black"
This reverts commit aaabb44ac7.

I figured out how to trigger this: it's when scaling is enabled.
To maintain VM aspect ratio, we have to constrain the size of the
viewer widget. When the widget is smaller than the VM window, the
viewport widget is visible. This change made the viewport the default
theme color, rather than black.

Problem is, in the non-scaling case, we don't shrink the viewer
widget but let it expand to fill the whole area. This is necessary
to get the 'Autoresize VM with window' option to work, but is also
simpler in the cdoe. The viewport widget is not visible, and gtk-vnc
and spice-gtk paint the non VM owned areas as black. AFAICT that's not
configurable in any way.

So after this change we have differing behavior for scaled and
non-scaled cases, which is confusing and visually kinda comes off as
a bug.

So this reverts back to the old behavior and explains all this in
a comment.
2022-01-27 11:07:31 -05:00
Cole Robinson
28af0f02f6 console: Clarify some error labels and debug messages
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-01-21 11:03:23 -05:00
Cole Robinson
bd4ca8a55e console: Add _cb suffix to viewer callback function names
And use _src for the first parameter name, which appeases pylint
but is more descriptive

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-01-21 11:03:23 -05:00
Cole Robinson
8bb64ad5af console: Don't block console reconnect for non-error
https://listman.redhat.com/archives/virt-tools-list/2022-January/msg00012.html

On xen, a guest reboot will trigger a non-error viewer-disconnected
signal, but we treat it like an error, which makes it difficult to
reconnect to the VM console.

If there's no error message raised, treat the disconnect like a
non-error cases.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-01-21 11:03:23 -05:00
Cole Robinson
aaabb44ac7 details: console: drop hardcoding background color as black
Submitted in https://github.com/virt-manager/virt-manager/pull/241

I couldn't get this code to change the output, tested with VNC and
spice-gtk on Fedora 34 gnome-shell x11 and XFCE. Maybe it's something
theme related. But either way this doesn't seem to be useful for the
default case anyways, so let's drop it

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2021-07-31 16:27:15 -04:00
Cole Robinson
a53f35e425 viewers: Absorb resizeguest support check
This let's us move the gtkvnc import back
to be solely in viewers.py

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2021-05-22 14:56:10 -04:00
Daniel P. Berrangé
499739cee3 details: enable resizing of displays with new GtkVnc
The 1.2.0 release of GtkVnc introduces support for remote desktop
resize. This is also supported in QEMU >= 6.0.0 when using virtio-gpu.

This introduces support for resize without forcing a new min version of
GtkVnc by just checking for existance of the new API. We don't attempt
to check if the current QEMU instance supports resize, as we gracefully
degrade - the guest simply won't resize and will be rendered as before.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-05-19 16:30:00 -04:00
Pavel Hrdina
cf93e2dbff console: fix error with old pygobject
The code doesn't work as expected. From python documentation:

    x and y

is the same as

    x if not x or y

so in the code if for some reasone `dev` is None the value stored in
`sensitive` will be None as well.

No the code itself works with pygobject >= 3.31.3 where they allowed
None as a valid boolean value, but with older versions it will fail
with this error message:

    TypeError: Argument 1 does not allow None as a value

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2021-02-05 12:15:46 +01:00
Cole Robinson
e58cc956b5 vmwindow: vm state-changed update flow changes
* Don't process events when the window isn't showing
* Only update console/details if that tab is actually selected.
    Otherwise in some corner cases we can connect to the VM console
    while on the details page

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-21 09:06:18 -04:00
Cole Robinson
c0c704e1fa console: Move _change_title behavior to vmwindow
This is where it conceptually belongs

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-21 09:06:18 -04:00
Cole Robinson
78cd8c90ea console: Rework default page flow a bit
Move the VM status and viewer open checks into the default page
path as well, otherwise opening the details dialog for an offline
VM attempts to connect to the inactive VM console and logs backtraces

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-11 11:34:06 -04:00
Cole Robinson
ac8591192f console: Add option to disable autoconnect
As part of making virt-manager cooperate better with external viewers,
add an option to disable console autoconnect. When opening a VM window
for a running VM, you'll see a 'Connect to console' button in place
of the spice/vnc viewer. Click that and things proceed like normal.

This is useful to prevent virt-manager from disconnecting a virt-viewer
instance that's already attached to a VM

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

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-09 19:59:31 -04:00
Cole Robinson
43512302f7 vmwindow: Cleanup the interaction with vmmConsolePages
- Add ui/console.ui for console-pages and below
- Add move auth and graphics unavailable pages to a new subnotebook
- Move all the menubar handling up into vmwindow
- Clarify the control flow as much as I can come up with

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-09 19:37:11 -04:00
Cole Robinson
aafb874c85 viewers: Enable window modifiers when viewer doesn't have keyboard
Right now this is tied to widget focus, which is too strong. This
changes it so that say clicking on the window title or toolbar then
allows the user to use Alt+F to trigger the File menu for example.
This roughly matches how virt-viewer works

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

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-09 11:25:50 -04:00
Cole Robinson
33a61f7f30 prefs: Remove 'Force console accels' option
This is very obscure and definitely not in line with our DESIGN.md
nowadays

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-09 09:15:53 -04:00
Cole Robinson
b88e755a52 console: Text console submenu improvements
* Move all the menu building to its own class, for clarity
* Rename the menu 'Consoles' since it contains graphical choice as well
* Strip out the VM console duplicate if it exists
* Simplify the code a bit

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-09 08:49:12 -04:00
Cole Robinson
c36f232370 uitests: Finish console.py and viewers.py coverage
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-08-30 10:34:44 -04:00
Cole Robinson
940bd3873e console: Replace auth-rejected with auth-error signal
Should be similar here. auth-rejected is hard to trigger anyways

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-08-29 16:17:45 -04:00
Cole Robinson
64e3ff1d08 uitests: console/keyring/viewer coverage work
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-08-29 13:23:34 -04:00
Cole Robinson
301892f6b9 serialcon: Modernize code style
* Privatize a bunch of stuff
* Make public API explicit
* Add a few minor public APIs to avoid accessing internal state

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-08-29 12:37:12 -04:00
Cole Robinson
e9c937691d uitests: Finish serialcon.py coverage
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-08-29 12:37:12 -04:00
Cole Robinson
f06cc11546 config: Move more password handling to keyring.py
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-08-28 08:47:20 -04:00
Pino Toscano
8872e1e962 i18n: show localized accelerators in Send key menu
Turn the menu labels into GTK accelerator strings, so we can parse them
to convert them into a proper user representation.

There is a small behaviour change: the menu items do not have mnemonics
anymore by default.

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
Florian Ludwig
ae19d6d6ec fix resizing of spice clients with guest resizing enabled
Fixes 1414718
2019-11-12 11:46:35 -05:00
Cole Robinson
16a608c37b virtManager: move vmwindow components to virtManager/details 2019-06-17 00:12:32 -04:00