[virt-tools-list] [PATCH virt-viewer v3 3/3] Write vm name to config file as comment

Jonathon Jongsma jjongsma at redhat.com
Tue Aug 26 19:18:48 UTC 2014


On Fri, 2014-08-22 at 17:25 +0200, Marc-André Lureau wrote:
> 
> On Wed, Aug 6, 2014 at 9:19 PM, Jonathon Jongsma <jjongsma at redhat.com>
> wrote:
>         +        if (error) {
>         +            g_warning("Unable to get comment from key file: %
>         s", error->message);
>         
> 
> 
> 
> I get this warning, while I think this is a normal condition.
> Shouldn't it be a g_debug instead?

You're right.  This should not be a warning.



>  
> 
>         +            g_clear_error(&error);
>         +        } else {
>         +            if (!comment || *comment == '\0')
>         +                g_key_file_set_comment(priv->config,
>         priv->uuid, NULL, priv->guest_name, NULL);
>         +        }
> 
> 
> So is this patch supposed to add a comment if it doesn't exist? How is
> it supposed to look like? It would have been nice to add a comment in
> commit log or in man page if it's supposed to be edited by user?
> 

Yes, this will add a comment to the config file.  I debated whether this
patch was useful or not, but in the end, I decided to add it.

We still need to write proper documentation about this configuration
file in general. But I'll quickly describe this patch. Essentially a
user will create a keyfile group with the UUID as the title, e.g.: 

        [19c78a87-413b-784b-8081-112be3d1ddc7]
        monitor-mapping=1:2;2:3

Most people don't remember UUIDs very well, so it's easy to forget which
guest is associated with this configuration. So the next time a user
connects to this guest, virt-viewer will try to add a comment to the
file so that it's easier for a human to remember. So it should now look
something like this:

        # guestname
        [19c78a87-413b-784b-8081-112be3d1ddc7]
        monitor-mapping=1:2;2:3
        
If there was already a comment for this group, then we will just leave
that comment alone and not add our own. 

You could certainly argue that this feature is kind of useless, since
the comment only gets added after the next time the user connects to
this guest. But I don't think it hurts anything. But I wouldn't be
opposed to simply reverting this patch either.

Jonathon





More information about the virt-tools-list mailing list