[virt-tools-list] [virt-viewer] ovirt: Fail gracefully when hostname is missing

Christophe Fergeau cfergeau at redhat.com
Thu Mar 12 16:50:34 UTC 2015


On Fri, Jan 30, 2015 at 09:51:40AM -0600, Jonathon Jongsma wrote:
> On Fri, 2015-01-30 at 08:27 +0100, Christophe Fergeau wrote:
> > 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.
> > ---
> >  src/remote-viewer.c | 7 +++++++
> >  1 file changed, 7 insertions(+)
> > 
> > diff --git a/src/remote-viewer.c b/src/remote-viewer.c
> > index 34f01da..59250ef 100644
> > --- a/src/remote-viewer.c
> > +++ b/src/remote-viewer.c
> > @@ -915,6 +915,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) {
> 
> 
> ACK

Pushed to master.

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/virt-tools-list/attachments/20150312/987c570a/attachment.sig>


More information about the virt-tools-list mailing list