summaryrefslogtreecommitdiffstats
path: root/src/virt-viewer.c
Commit message (Collapse)AuthorAgeFilesLines
* virt-viewer: Avoid simple_message_dialog() when errors can be propagatedFabiano Fidêncio2015-03-271-10/+6
| | | | | | | | | | Remove all the dialogs used to report errors on extract_connect_info() and just propagate the errors we got from it. The only exception is virt_viewer_domain_event(), that is a callback that doesn't have GError as argument. In this specific case, we show the error dialog instead of propagating it. Related: rhbz#1085216
* virt-viewer-app: create_session() should return a booleanFabiano Fidêncio2015-03-271-1/+1
| | | | | | | By convention functions that take GError parameters should return FALSE (or NULL) or error. Related: rhbz#1085216
* virt-viewer-app: Add a GError arg to create_session()Fabiano Fidêncio2015-03-271-1/+1
| | | | | | | | | | | This is part of a small re-factoring that will have all connection errors, when we won't be able to connect regardless of what changes on the remote host, being treated by virt_viewer_app_initial_connect(), avoiding weird behaviors as we have nowadays (like more than one error dialog being shown or having the virt-viewer waiting forever for a guest that will never show up). Related: rhbz#1085216
* virt-viewer: Add a GError arg to update_display()Fabiano Fidêncio2015-03-271-4/+4
| | | | | | | | | | | This is part of a small re-factoring that will have all connection errors, when we won't be able to connect regardless of what changes on the remote host, being treated by virt_viewer_app_initial_connect(), avoiding weird behaviors as we have nowadays (like more than one error dialog being shown or having the virt-viewer waiting forever for a guest that will never show up). Related: rhbz#1085216
* virt-viewer: Add a GError arg to extract_connect_info()Fabiano Fidêncio2015-03-271-2/+19
| | | | | | | | | | | This is part of a small re-factoring that will have all connection errors, when we won't be able to connect regardless of what changes on the remote host, being treated by virt_viewer_app_initial_connect(), avoiding weird behaviors as we have nowadays (like more than one error dialog being shown or having the virt-viewer waiting forever for a guest that will never show up). Related: rhbz#1085216
* Do not use comments that are not in EnglishFabiano Fidêncio2015-03-261-1/+1
|
* virt-viewer: Clean up if no vm was chosenPavel Grunt2015-03-241-1/+1
| | | | | | | | It is safe to clean up when running virt-viewer without specifying vm name if no vm was chosen. It brings back behavior before 88f6341. The 'if (dom == NULL && err != NULL)' part was affected by commits 824c4b9, 1eaaf8c, 15c7d17 so the check for 'err' is not needed anymore.
* Report errors in one placePavel Grunt2015-03-231-17/+4
| | | | | | Since the error is propagated to the main, report the error there. To make it work GError VIRT_VIEWER_ERROR_FAILED is set for all failing states and it is reported using virt_viewer_app_simple_message_dialog().
* Exit normally when canceling dialogPavel Grunt2015-03-231-20/+28
| | | | | | | | | This applies for: libvirt authentication dialog (e.g. virt-viewer --attach guest) 'recent connection' dialog (e.g. remote-viewer) 'vm choose' dialog when connecting without specifying the vm name This is done by using a new GError VIRT_VIEWER_ERROR_CANCELLED.
* virt-viewer: Bring back debug log about nonexistent guestPavel Grunt2015-03-231-0/+2
| | | | | | | | Although commit 88f6341 allowed to use virt-viewer with a wrong guest name, the user is informed about the nonexistent guest only by a dialog showing the list of running machines or informing about the connection error. Resolves https://bugzilla.redhat.com/show_bug.cgi?id=1201177
* Take --direct into consideration when checking if a guest is reachableFabiano Fidêncio2015-03-121-6/+8
| | | | | | | | | | When connecting to a remote host (using qemu+ssh://...) that has a virtual machine listening to "127.0.0.1", virt_viewer_is_reachable() must take --direct into account, otherwise it can end up connecting to a local virtual machine listening to "0.0.0.0" instead of returning that the guest is not reachable. Resolves: rhbz#1085216
* Avoid 'Dereference of a null pointer'Fabiano Fidêncio2015-03-111-1/+1
| | | | Caught by Covscan.
* virt-viewer: set transient parent for connection's error dialogFabiano Fidêncio2015-01-081-1/+3
| | | | | Commit c3d24f8b sets transient parent for the most part of the GtkDialogs, but seems like this one was forgotten.
* virt-viewer: Don't connect to localhost displays with qemu+tcp://Christophe Fergeau2015-01-061-0/+57
| | | | | | | | | | | When connecting to a remote libvirt instance, a VM may only be listening on localhost for SPICE/VNC connections. In such a situation, virt-viewer then tries to connect to localhost, which is not correct as this 'localhost' referred to the remote libvirt host it connected to. This commit adds a couple of tests on the libvirt URI used and the <graphics> listen address to error out in this situation. Resolves: rhbz#1108523
* Set a transient parent for GtkDialogsPavel Grunt2014-12-191-3/+12
| | | | | Silence the Gtk 3.14 message: "GtkDialog mapped without a transient parent. This is discouraged."
* Do not show twice error dialog when no VM are foundMarc-André Lureau2014-12-011-1/+0
| | | | | When running virt-viewer without argument, and no VM are found, you get two error dialogs. Only one is enough.
* virt-viewer: allow connection to unix socket only serverMarc-André Lureau2014-11-251-7/+8
| | | | | Even when the server doesn't provide a display connection address, virt-viewer is able to connect to guest with libvirt attach.
* Report error in dialogMarc-André Lureau2014-11-251-3/+11
| | | | Use a UI dialog to inform of connection error.
* Simplify virt_viewer_initial_connect()Marc-André Lureau2014-11-251-6/+6
| | | | | | | - do not overwrite err if ->initial_connect() sets it - remove need for waitvm if the display server isn't yet started (note: this function might be untested, I am not sure relying on libvirt events is enough)
* Simplify virt_viewer_initial_connect()Marc-André Lureau2014-11-251-10/+3
| | | | | | - remove need for waitvm if the display server isn't yet started (note: this function might be untested, I am not sure relying on libvirt events is enough)
* Simplify virt_viewer_initial_connect()Marc-André Lureau2014-11-251-21/+21
| | | | | | | | Some refactoring to make the code easier to read, mostly code movement/reindenting and introduction of a "wait" label which has the same purpose as "done". This also adds a "goto wait" within an if block, but this does not change the initial code flow, just makes it more explicit.
* Remove VIRT_VIEWER_VM_CHOOSE_DIALOG_CANCELLEDMarc-André Lureau2014-11-251-4/+2
| | | | | | This error type isn't really an error, it is used to skip error report code. The functions can simply return FALSE on failure, without GError set, to indicate that program should quit normally.
* Limit HAVE_SOCKETPAIR to directly concerned codeMarc-André Lureau2014-11-251-3/+6
|
* Move libvirt reconnect polling to VirtViewerMarc-André Lureau2014-11-251-4/+37
| | | | | This is libvirt specific, no need to share it in the VirtViewerApp base class.
* Replace priv->withEvents usage for priv->domain_eventFabiano Fidêncio2014-11-201-9/+4
| | | | Once we have priv->domain_event, we don't need priv->withEvents anymore
* Prefer to use virConnectDomainEventRegisterAny()Fabiano Fidêncio2014-11-201-7/+13
| | | | | The usage of virConnectDomainEventRegister() is no longer recommended according to the libvirt's documentation.
* Set freed priv->dom to NULL in _dispose()Fabiano Fidêncio2014-11-201-1/+3
| | | | Avoid a possible use/free after the object has been freed.
* Make sure conn exists before use itFabiano Fidêncio2014-11-201-7/+9
| | | | | | Although all the used functions have a explicit check for a valid virConnPtr, let's be safe and only use priv->conn when its value is non-NULL.
* Don't use virGetLastErrorMessage()Christophe Fergeau2014-10-311-1/+2
| | | | This was introduced in libvirt 1.0.6 but we only require libvirt 0.10.0
* Avoid use of non-literal string with g_debugDaniel P. Berrange2014-10-271-1/+1
|
* Remove useless 'if (...)' before free()Daniel P. Berrange2014-10-271-3/+1
| | | | | The 'free()' function accepts NULL, so you should not check for NULL before calling it.
* Prefill the username in the authentication dialogFabiano Fidêncio2014-10-101-0/+4
| | | | | Lets prefill the username entry using the user name of the current user.
* Show VM chooser dialog when starting virt-viewer with no argPavel Grunt2014-10-101-8/+67
| | | | | | When user starts virt-viewer without specifying VM domain name or with a wrong name a list of running machines is shown and user may choose one of them.
* Prefer virDomainOpenGraphicsFD for --attachJán Tomko2014-10-011-1/+14
| | | | | | | | | | | | | | | The virDomainOpenGraphics API cannot label the socket we pass to it. Prefer virDomainOpenGraphicsFD (if building with libvirt 1.2.8 or later) which creates the socket for us and works with SELinux too. Fall back to the old API if the new one is unsupported (i.e. the libvirtd on the host is older than the libvirt version virt-viewer was compiled against). Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1141228 Signed-off-by: Ján Tomko <jtomko@redhat.com>
* Improve authentication error messagesFabiano Fidêncio2014-09-261-2/+35
| | | | | | | Adding a better error message to our default error message, based on the libvirt error. Also, the libvirt error is shown as debug. https://bugzilla.redhat.com/show_bug.cgi?id=1142742
* Simplify virt_viewer_auth_libvirt_credentials() return value logicFabiano Fidêncio2014-09-261-4/+4
| | | | | | | | | | As the function should return < 0 in error cases, let's explicitly return/set the return value to -1 in error cases. Otherwise, the function will return 0. This patch also fixes a regression introduced by (a5ce2ed3). https://bugzilla.redhat.com/show_bug.cgi?id=1142742
* Do not fail when the auth dialog is cancelledFabiano Fidêncio2014-09-231-7/+12
| | | | https://bugzilla.redhat.com/show_bug.cgi?id=1145460
* VirtViewer: Fix memory leaksJonathon Jongsma2014-09-111-0/+4
| | | | Don't leak priv->uri or priv->domkey from VirtViewer class
* Add a dialog showing details of the current guestJonathon Jongsma2014-08-071-1/+1
| | | | | | This allows the user to obtain the GUID and vm name of the currently-connected guest. Obviously, this only works with spice. In the future, it will allow them to set guest-specific configuration options (using a GUID as a key)
* util: get rid of ARRAY_CARDINALITYMarc-André Lureau2014-06-101-1/+1
|
* Replace DEBUG_LOG with g_debugMarc-André Lureau2014-06-101-19/+19
| | | | https://bugzilla.redhat.com/show_bug.cgi?id=1107518
* Don't connect to localhost when using --directChristophe Fergeau2014-06-101-1/+2
| | | | | | | | | | | | | | | | | | Trying to connect to a remote virtual machine using virt-viewer -c qemu+ssh://example.com/system --direct $vm_name will currently fail with an error message saying it's not possible to localhost. This happens with VMs which listen on a wildcard address (eg '0.0.0.0'). This was introduced by commit 74b1b62 which changes the host to connect to to 'localhost' when trying to connect through ssh to a VM listening on a wildcard address. This is only valid when using a ssh tunnel, and should not be done with --direct. The fallback code which uses the hostname from the libvirt URI is what makes the most sense in this situation (wildcard listen address + --direct). This commit introduces a virt_viewer_app_get_direct() so that this can be implemented. Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1079211
* Improve window title when connected to newer spice-serverJonathon Jongsma2014-02-111-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Recent spice servers send the guest vm name and uuid to the client. We can use these values to display the proper vm name in the window title if a title is not specified on the commandline. We can also be smarter about the title in virt-viewer as well. If a title is specified on the comamndline (-t/--title=foo), we use that. If not, we fall back to the vm name. If that is empty, we fall back to the uri of the connection. Comparison between old behavior and new behavior Using new spice-server Command Old title New title ------- --------- --------- remote-viewer -t xyz spice://host:port xyz xyz remote-viewer spice://host:port spice://host:port <vmname> virt-viewer <vmname> <vmname> <vmname> virt-viewer <uuid> <uuid> <vmname> Using old spice-server Command Old title New title ------- --------- --------- remote-viewer -t xyz spice://host:port xyz xyz remote-viewer spice://host:port spice://host:port spice://host:port virt-viewer <vmname> <vmname> <vmname> virt-viewer <uuid> <uuid> <vmname>
* Add ability to define custom display->monitor mapping per vmJonathon Jongsma2013-11-201-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Fullscreen mode generally just assigns display 1 to monitor 1, display 2 to monitor 2, etc. For custom setups, you can define a monitor mapping in the settings keyfile per-vm. This requires a vm uuid (so only works in virt-viewer or on versions of spice-server that send the uuid over the wire). The format is pretty basic: [6485b20f-e9da-614c-72b0-60a7857e7886] monitor-mapping=2;3 The group name ("6485b20f-e9da-614c-72b0-60a7857e7886") is the uuid id of the vm. This group has a single key: monitor-mapping. This key is an array of integers describing the order in which to assign the monitors to a guest display. Any monitors that are not listed in this array will not be configured at startup. For instance: monitor-mapping=2;1 will attempt to configure 2 displays on the guest and assign the first display to monitor 2 and the second display to monitor 1. monitor-mapping=2 will only configure a single display on the guest and place it on the second monitor. Any monitor numbers listed in the keyfile are greater than the number of monitors that are physically present, they will be ignored.
* Try to share more GOption code between r-v and v-vMarc-André Lureau2013-08-201-5/+1
|
* Unregister events and callbacks on disposeJán Tomko2013-07-291-12/+19
| | | | | | Without these libvirtd reports an error on virt-viewer shutdown: virNetSocketReadWire:1377 : End of file while reading data: Input/output error
* virt-viewer: Allow TLS-only SPICE connectionsChristophe Fergeau2013-07-111-12/+12
| | | | | | | | | | | | | | | | | | | | | When trying to connect to a VM which uses SPICE with only a tls port set: <graphics type='spice' tlsPort='-1' autoport='no' listen='0' keymap='en-us'> <listen type='address' address='0'/> </graphics> the connection will fail with "Cannot determine the graphic address for the guest spice" virt_viewer_extract_connect_info() indeed assumes that if no non-TLS port is set, then this means we are trying to connect through an already open socket, and otherwise the connection fails. The presence of a TLS port is only checked when a non-TLS port is set. This commit reworks that logic to start by extracting both the non-TLS and TLS ports (only when using SPICE for the latter), and by only trying to parse the socket to use if none of these 2 ports is set This fixes rhbz#982840
* Use format stringGuido Günther2013-06-261-1/+1
| | | | | | | | to fix virt-viewer.c: In function 'virt_viewer_connect': virt-viewer.c:686:13: error: format not a string literal and no format arguments [-Werror=format-security] g_warning(error->message);
* Show connect dialog again if connection from dialog failedMarc-André Lureau2013-05-171-3/+3
| | | | https://bugzilla.redhat.com/show_bug.cgi?id=864026
* Remove the "container" logic used by legacy browser pluginMarc-André Lureau2013-05-161-3/+1
|