Commit Graph

1367 Commits

Author SHA1 Message Date
Eduardo Lima (Etrunko)
5ba2f8ff1b build: Update govirt and rest requirements
With these new values, 0.3.3 for libgovirt and 0.8 for librest, we can
remove checks for OVIRT_REST_CALL_ERROR_CANCELLED and correspondent
rest_proxy_auth_cancel().

Distros that already ship these versions, such as Fedora, RHEL 7.4
onwards, and Ubuntu since 17.10.

Acked-by: Christophe Fergeau <cfergeau@redhat.com>
Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2018-09-12 10:52:04 +02:00
Victor Toso
7ffb7f9cf4 app: Always add guest name comment
Even when the user adds comments, we should place the guest's name
unless it is present already.

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

Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-09-03 07:09:21 +02:00
Christophe Fergeau
71dc30571e ovirt: Filter everything which does not end in .iso
oVirt REST API does not provide a way to know what is a valid ISO image
which can be assigned to a running VM. I've seen floppy disk images
(.vfd) in a domain, which is already filtered. Now I've seen an ISO
domain with .qcow2 files in it, which can't be assigned to a VM either.
This commit filters every file which does not have a .iso extension as
it's unlikely to be possible to use it.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2018-08-31 15:12:18 +02:00
Christophe Fergeau
1b45241a66 ovirt: Improve handling of g_strv_contains()
The ovirt code uses g_strv_contains() with fallback code in
glib-compat.h when we are using a glib version where it's not available.
However, when we use a glib version where g_strv_contains is available,
we get a compilation warning since we are compiling GLIB_VERSION_MAX_ALLOWED
set to 2.38.

This commit wraps both the compat code and the g_strv_contains() call in
a strv_contains() helper where we can hide the magic needed to avoid
deprecation warnings.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2018-08-07 17:41:37 +02:00
Christophe Fergeau
feea9ccd73 window: Adjust get_image_format() prototype
This adds an unused parameter, but lets us get rid of this new warning
with gcc 8:

virt-viewer-window.c: In function 'get_image_format':
virt-viewer-window.c:930:33: warning: cast between incompatible function types from 'GHashTable * (*)(void)' {aka 'struct _GHashTable * (*)(void)'} to 'void * (*)(void *)' [-Wcast-function-type]
     g_once(&image_formats_once, (GThreadFunc)init_image_formats, NULL);

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2018-08-07 17:41:37 +02:00
Christophe Fergeau
05c8b75113 app: Remove VirtViewerApp::has-focus
This is no longer needed since 140cb84
'remote-viewer: remove --spice-controller'

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2018-08-06 13:20:04 +02:00
Daniel P. Berrangé
e8b724a777 rpm: import spec changes from fedora
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-07-27 17:08:34 +01:00
Daniel P. Berrangé
d5b5e3cf06 Post release version bump to 8.0
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-07-27 15:41:14 +01:00
Daniel P. Berrangé
83a91985d6 Add NEWS for 7.0 release
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-07-27 11:50:19 +01:00
Daniel P. Berrangé
4590b50568 Bump min spice to 0.35 and address deprecation warnings
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-07-27 11:50:07 +01:00
Daniel P. Berrangé
23c0061ccb Disable -Wcast-function-type warning
Most glib function casts trigger this

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-07-27 11:50:07 +01:00
Victor Toso
c127a80fc6 remote-viewer-connect: centralize window
Instead of top-left corner.

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

Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2018-06-04 11:54:05 +02:00
Christophe Fergeau
afa5b45df8 win32: Look up translations relative to installation directory
On Windows, we can't use bindtextdomain(GETTEXT_PACKAGE, LOCALE_DIR); as
LOCALE_DIR is a compile-time constant, while the location of the
translations will be dependant on where the user installs virt-viewer.
This results in an untranslated virt-viewer UI on Windows. This commit
calls bindtextdomain() with a directory which is relative to the
installation path so that translation are properly found.
This is similar to what spice-gtk is doing:
https://cgit.freedesktop.org/spice/spice-gtk/tree/src/spice-glib-main.c

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
2018-05-02 13:20:13 +02:00
Daniel P. Berrange
55c4b04243 Refresh po files from zanata
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2017-12-04 16:39:45 +00:00
Eduardo Lima (Etrunko)
726db14cdb Fixes to spec file
- Use macros for paths instead of absolute paths.
- Remove dangling %{gtk_arg} macro in configure.
- Fix scope of enable_autotools macro to avoid warning during build.
  warning: Macro %enable_autotools defined but not used within scope

Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2017-11-23 11:51:00 -02:00
Eduardo Lima (Etrunko)
24fc358862 doc: Adjust reference to spice-gtk man page for remote-viewer
Similar to last commit, as noticed by reporter in bugzilla:

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

Man page should reference spice-client, not spice-gtk.

Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2017-11-22 16:17:27 -02:00
Christophe Fergeau
1b89efaa28 doc: Adjust reference to spice-gtk man page
The man page spice-gtk ships is named "spice-client", not "spice-gtk"

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>

https://bugzilla.redhat.com/show_bug.cgi?id=1477966
2017-11-17 15:14:44 -02:00
Marc-André Lureau
bf39970a1f virt-viewer.spec.in: fix build after spice-xpi-client removal
This fixes commit 140cb84c25, where we
removed the spice-xpi-client-remote-viewer.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
2017-11-17 08:39:14 +01:00
Marc-André Lureau
5d04a426db win32: remove debug-helper.exe
This helper was useful to debug spice controller & activex plugin. Now
that the controller is gone, it is no longer needed.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Victor Toso <victortoso@redhat.com>
2017-11-16 17:04:28 +01:00
Marc-André Lureau
140cb84c25 remote-viewer: remove --spice-controller
spice controller interface is being removed from spice-gtk.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Victor Toso <victortoso@redhat.com>
2017-11-16 17:04:05 +01:00
Marc-André Lureau
ce7fd6eb45 remote-viewer: learn '-' as URI for standard input connection file
Some users want the ability to set connection details without writing
to a file or passing command line arguments.

Learn to read the connection file from standard input for such use
case.

This allows a parent process to set the connection details without
intermediary file.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Victor Toso <victortoso@redhat.com>
2017-11-16 17:04:02 +01:00
Eduardo Lima (Etrunko)
b983b6bf29 remote-viewer: Pass guri to remote_viewer_session_connected
When connecting to a VM via oVirt instance, the original uri can not be
retrieved using virt_viewer_session_get_uri(). Consequently, it was
never saved, even though the connection succeeds and the actual callback
for "session-connected" signal, which saves the URI, is invoked.

To solve this problem, we always pass a copy of the guri as user-data
parameter for the callback, and if the call to
virt_viewer_session_get_uri() returns NULL, the parameter is used
instead.

Resolves: https://bugzilla.redhat.com/1459792

Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2017-11-14 15:27:07 -02:00
Eduardo Lima (Etrunko)
905d84bd22 foreign-menu: Check if storage domain is active for data center
This last patch of the series is where we actually check if the storage
domain is active in the data center the VM is associated with. It makes
use of g_strv_contains(), which is available only in glib version 2.44.
Compatibility code has been added if building against older versions
than required.

Related: https://bugzilla.redhat.com/show_bug.cgi?id=1427467
         https://bugzilla.redhat.com/show_bug.cgi?id=1428401

Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2017-10-06 17:05:58 -03:00
Eduardo Lima (Etrunko)
7459ecb66a ovirt-foreign-menu: Fetch host, cluster and data center information
It is possible that the data center the VM is associated with has more
than one storage domain associated with it as well, when only one is
active while the others are not.

The current ovir-foreign-menu code does not take it into consideration,
thus the ISO dialog may show invalid results with that scenario. We fix
this problem by making use of new functions in libgovirt, adding support
or hosts, clusters and data centers.

Related: https://bugzilla.redhat.com/show_bug.cgi?id=1427467
         https://bugzilla.redhat.com/show_bug.cgi?id=1428401

Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2017-10-06 17:05:58 -03:00
Eduardo Lima (Etrunko)
476be6bc58 foreign-menu: Use query for fetching virtual machines
This can save us some bandwidth, as we are searching for the specific
virtual machine instead of retrieving the collection with all VMs, and
then iterating over the results after the transfer finishes.

Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2017-10-06 17:05:58 -03:00
Eduardo Lima (Etrunko)
c2b0fd825c configure: check for new functions in libgovirt
These functions will be used in ovirt-foreign-menu code and guarded
by #ifdef blocks so that we can keep compatibility with older libgovirt
versions.

Related: https://bugzilla.redhat.com/show_bug.cgi?id=1427467
         https://bugzilla.redhat.com/show_bug.cgi?id=1428401

Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2017-10-06 17:05:58 -03:00
Marc-André Lureau
df42f78d46 remote-viewer: factor our remote_viewer_initial_connect()
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2017-10-06 17:05:58 -03:00
Marc-André Lureau
a437f35e96 session: remove virt_viewer_session_new() declaration
The function was removed in commit
05333f0e93.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2017-10-06 17:05:58 -03:00
Guido Günther
223836ee67 Make it clear that only running VMs are listed
this might otherwise be confusing.

Reference: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=873597#25
2017-09-14 10:48:05 -05:00
Daniel P. Berrange
fe2e7cb44f Post release version bump to 7.0
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2017-08-15 14:55:16 +01:00
Daniel P. Berrange
678a2d84ed Add NEWS for 6.0 release
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2017-08-15 12:21:51 +01:00
Daniel P. Berrange
2222f81ac7 Set LC_CTYPE=en_US.UTF-8 when running glib-mkenums
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2017-08-14 13:51:58 +01:00
Daniel P. Berrange
c49f648f92 Revert "Don't set LC_ALL=C during build as that breaks python apps"
This reverts commit 921e988db0.
2017-08-14 11:37:07 +01:00
Daniel P. Berrange
921e988db0 Don't set LC_ALL=C during build as that breaks python apps
Setting LC_ALL=C breaks python apps doing I/O on UTF-8 source
files. In particular this broke glib-mkenums

    Traceback (most recent call last):
      File "/usr/bin/glib-mkenums", line 669, in <module>
        process_file(fname)
      File "/usr/bin/glib-mkenums", line 406, in process_file
        line = curfile.readline()
      File "/usr/lib64/python3.6/encodings/ascii.py", line 26, in decode
        return codecs.ascii_decode(input, self.errors)[0]
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 849: ordinal not in range(128)

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2017-07-25 13:45:09 +01:00
Jonathon Jongsma
761149ea71 Screenshot: reject unknown image type filenames
If the image format cannot be determined for a screenshot filename,
simply return an error informing the user that this is not a valid image
format.

In the past, if we couldn't determine the file type, we simply saved it
as a PNG, and appended a ".png" file extension to the filename. This has
several problems. First, it can result in some oddly-named files (e.g. a
screenshot named 'Screenshot.pdf.png').

Second, modifying the filename that is returned from the GtkFileChooser
undermines the overwrite-confirmation functionality that is built into
the gtk file chooser. When the user specifies a filename in the file
chooser dialog, the chooser will automatically check whether a file of
that name exists, and if it does, it will display a dialog asking
whether the user wants to overwrite it. But if we then append a ".png"
extension to the filename and save it, we may be overwriting an existing
file without warning. By returning an error for unrecognized file types,
we avoid this problem.

Resolves: rhbz#1455832
2017-07-20 09:06:46 -05:00
Jonathon Jongsma
f1783c3a3f Report errors when saving screenshot
Currently, the user gets no feedback if the screenshot fails (e.g. if
they don't have permission to write in the chosen directory, etc). This
patch adds a simple dialog showing the error message when a screenshot
fails.
2017-07-19 16:46:12 -05:00
Jonathon Jongsma
a51ae4507d Change default screenshot name to "Screenshot.png"
Since the code attempts to append ".png" to filenames without an
extension, it doesn't make much sense to have the default filename be
extensionless.  Including the extension on the default filename makes
things more straightforward.

Related: rhbz#1455832
2017-07-19 16:45:02 -05:00
Victor Toso
58dd08f222 remote-viewer-connect: Keep the 'dialog' window on top
Otherwise, in kiosk mode, it'll be hidden from user.

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

Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2017-06-12 15:37:28 +02:00
Eduardo Lima (Etrunko)
0cd836dd17 remote-viewer: Show authentication dialog again if in kiosk mode and connecting to ovirt
Similar to previous commit 5d9e6d2338, now
dealing with the case of connecting directly to ovirt:// URIs, which was
left behind.

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

Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2017-06-08 18:45:53 -03:00
Victor Toso
fb14a8b300 vnc: do not show error on cancel/close of auth dialog
Mainly a kiosk mode issue, similar to the spice fix in 6480e52f62.

This patch saves the cancel/close state of auth dialog from
virt_viewer_auth_collect_credentials() in order to avoid an error
dialog to pop up to user in kiosk mode.

This happens due the fact that we call virt_viewer_app_disconnected()
twice:
- One with "session-cancelled" which is correct and well handled;
- The other with "session-disconnected" which is misleading as there
  was no connection at this time. This will trigger the error dialog
  with "Unable to connect to the graphic server %s".

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

Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2017-06-07 10:06:35 +02:00
Victor Toso
6480e52f62 spice: do not show error on cancel/close of auth dialog
Mainly an issue for kiosk mode due the fact that it'll not quit the
application on cancel. That means that authentication dialog can't
really be canceled and showing an input error such as "wrong password"
is misleading (no password should be taken in consideration on Cancel).

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

Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2017-06-05 15:46:46 +02:00
Eduardo Lima (Etrunko)
5d9e6d2338 kiosk: Show authentication dialog again if cancelled
Related: https://bugzilla.redhat.com/show_bug.cgi?id=1446161

Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2017-05-31 10:21:52 -03:00
Eduardo Lima (Etrunko)
8ab98eec20 window: Do not show fullscreen toolbar if in kiosk mode
Regression since commit cc455b7f91.

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

Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2017-05-31 10:20:41 -03:00
Victor Toso
75249df557 Make the progress bar smooth during file-transfer
When the transfer of a file finishes we stop considering that file's
size in the progress bar which makes it move back due the new
'transfer size' and 'transferred bytes' - for all the other files.

This patch aims to keep the progress smooth when a file is finished
using the notify::total-bytes from SpiceFileTransferTask to be aware
of all file's sizes.

Note that as we have only one progress bar for all files being
transferred, it is expected that it will go back when a new
file-transfer operation starts (e.g we drag-and-drop new files while
we are already transferring other files).

As requested, this patch also updates the string message to include the
amount of files that will be transferred in case we have more than one
file.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1449572
Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2017-05-18 15:28:55 +02:00
Pavel Grunt
209c80375b virt-viewer: Ensure to not close during migration
Take a look at the shutdown event detail before killing
the connection. Otherwise it breaks the SPICE seamless migration
feature.

Regression since commit a62827d28c

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1442929
Signed-off-by: Pavel Grunt <pgrunt@redhat.com>
Acked-by: Daniel P. Berrange <berrange@redhat.com>
2017-05-18 13:46:01 +02:00
Pavel Grunt
701d57742f window: Allow to control zoom using keypad
Support for more than one key combo for accelerator is available
since GTK 3.12 through GAction. It is currently not possible to
use mnemonics also for numpad keys, for more info see:
 https://bugzilla.gnome.org/show_bug.cgi?id=699823

Resolves: rhbz#1337575

Reviewed-by: Victor Toso <victortoso@redhat.com>
2017-05-10 13:46:29 +02:00
Pavel Grunt
633441631a util: Fix -Wsign-compare
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-04-25 10:40:28 +02:00
Victor Toso
bd16d6a958 Fix implicit fallthrough warning on new gcc
The option -Wimplicit-fallthrough was added to -Wall recently which
generates a few warnings. Based on the comment above the switch, the
fallthrough is on purpose so let's add a comment to avoid the following
warnings.

ovirt-foreign-menu.c: In function 'ovirt_foreign_menu_next_async_step':
ovirt-foreign-menu.c:293:12: warning: this statement may fall through
         if (menu->priv->api == NULL) {
            ^
 ovirt-foreign-menu.c:297:5: note: here
      case STATE_VM:
           ^~~~
ovirt-foreign-menu.c:298:12: warning: this statement may fall through
         if (menu->priv->vm == NULL) {
            ^
ovirt-foreign-menu.c:302:5: note: here
     case STATE_STORAGE_DOMAIN:
          ^~~~
ovirt-foreign-menu.c:303:12: warning: this statement may fall through
         if (menu->priv->files == NULL) {
            ^
ovirt-foreign-menu.c:307:5: note: here
     case STATE_VM_CDROM:
          ^~~~

ovirt-foreign-menu.c:308:12: warning: this statement may fall through
         if (menu->priv->cdrom == NULL) {
            ^
ovirt-foreign-menu.c:312:5: note: here
   case STATE_CDROM_FILE:
        ^~~~

Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2017-04-19 15:32:27 +02:00
Pavel Grunt
fe538a9296 app: Allow to connect to channel using unix socket
Only method for connecting to channel opened later was ssh, however
this method failes when unix socket is used:

    <graphics type='spice'>
      <listen type='socket' socket='/tmp/spice.sock'/>
    </graphics>

Related: rhbz#1335832, rhbz#1411765

Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-04-19 11:07:29 +02:00
Pavel Grunt
effa832ca5 virt-viewer: Support newer libvirt xml format
Since libvirt 0.9.4 there is a new listen element which can be used
to specify address instead of using the attributes of graphics element.

Also add support for listen type socket - available for Qemu since
libvirt 2.0.0

Resolves: rhbz#1411765

Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2017-04-19 11:06:58 +02:00