diff options
author | Christophe Fergeau <cfergeau@redhat.com> | 2015-01-30 08:24:15 +0100 |
---|---|---|
committer | Christophe Fergeau <cfergeau@redhat.com> | 2015-03-12 17:48:36 +0100 |
commit | ccafa32fe0efece1d7945618b82ce61eed73e97c (patch) | |
tree | c4ce27afa8cb514ebc66baf862405cb856e12855 /src/remote-viewer.c | |
parent | f9577b9197b737be722cfd5632b6077ce6b041ff (diff) | |
download | virt-viewer-ccafa32fe0efece1d7945618b82ce61eed73e97c.tar.gz virt-viewer-ccafa32fe0efece1d7945618b82ce61eed73e97c.tar.xz virt-viewer-ccafa32fe0efece1d7945618b82ce61eed73e97c.zip |
ovirt: Fail gracefully when hostname is missing
When parsing info returned by oVirt REST API, the hostname should be
present. However, I recently run remote-viewer against a buggy oVirt
instance where the hostname was missing. This commit handles better this
situation by displaying an error message and exiting.
Diffstat (limited to 'src/remote-viewer.c')
-rw-r--r-- | src/remote-viewer.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/remote-viewer.c b/src/remote-viewer.c index 1eb5f25..3c81650 100644 --- a/src/remote-viewer.c +++ b/src/remote-viewer.c @@ -914,6 +914,13 @@ create_ovirt_session(VirtViewerApp *app, const char *uri, GError **err) gport = g_strdup_printf("%d", port); gtlsport = g_strdup_printf("%d", secure_port); + if (ghost == NULL) { + g_set_error(&error, VIRT_VIEWER_ERROR, VIRT_VIEWER_ERROR_FAILED, + _("oVirt VM %s has no host information"), vm_name); + g_debug("%s", error->message); + goto error; + } + if (type == OVIRT_VM_DISPLAY_SPICE) { session_type = "spice"; } else if (type == OVIRT_VM_DISPLAY_VNC) { |