[libvirt] [libvirt-glib 22/37] More GVirConfigDeviceDisk setters

Christophe Fergeau cfergeau at redhat.com
Tue Nov 15 17:04:47 UTC 2011


On Fri, Nov 11, 2011 at 06:43:10PM +0100, Marc-André Lureau wrote:
> > +
> > +void gvir_config_device_disk_set_source(GVirConfigDeviceDisk *disk,
> > +                                        const char *source)
> > +{
> > +    xmlNodePtr source_node;
> > +    const char *attribute_name;
> > +
> > +    if (disk->priv->type == GVIR_CONFIG_DEVICE_DISK_DIR) {
> > +        /* I don't know what attribute name to use for 'dir' */
> > +        g_warning("set_source not implemented for 'dir' disk nodes");
> > +        return;
> > +    }
> > +
> > +    source_node = gvir_config_object_new_child(GVIR_CONFIG_OBJECT(disk),
> > +                                               "source", TRUE);
> > +    if (source_node == NULL)
> > +        return;
> > +
> > +    switch (disk->priv->type) {
> > +        case GVIR_CONFIG_DEVICE_DISK_FILE:
> > +            attribute_name = "file";
> > +            break;
> > +        case GVIR_CONFIG_DEVICE_DISK_BLOCK:
> > +            attribute_name = "block";
> > +            break;
> > +        case GVIR_CONFIG_DEVICE_DISK_NETWORK:
> > +            attribute_name = "protocol";
> > +            break;
> > +        default:
> > +            g_return_if_reached();
> > +    }
> 
> hmm, if I read domain_conf.c correctly,
> 
> FILE -> "file"
> BLOCK -> "dev"
> DIR -> "dir"
> NETWORK -> "protocol"

Ah thanks, the doc confirms I made a typo, and I can now handle the "dir"
type. I'll send a patch to add it to libvirt documentation.

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20111115/38b0728e/attachment-0001.sig>


More information about the libvir-list mailing list