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