On Wed, Jun 10, 2015 at 01:40:09PM +0200, Eren Yagdiran wrote: > Add the config gobject, functions to store and load the new configuration > fragments and test. This will allow creating sandboxes with attached > disk with a parameter formatted like file:hda=/source/file.qcow2,format=qcow2 > +/** > + * gvir_sandbox_config_add_disk_strv: > + * @config: (transfer none): the sandbox config > + * @disks: (transfer none)(array zero-terminated=1): the list of disks > + * > + * Parses @disks whose elements are in the format TYPE:TARGET=SOURCE,FORMAT=FORMAT > + * creating #GVirSandboxConfigMount instances for each element. For > + * example > + * > + * - file:hda=/var/lib/sandbox/demo/tmp.qcow2,format=qcow2 > + */ One of the goal of the libvirt sandbox code is to insulate apps from needing to know hypervisor specific differences. The guest side disk device name is one such big difference. Many hypervisors, including kvm, will not even honour requested names - you just get whatever name the guest decides to give you. Essentially the only thing that libvirt guarantees is the disk ordering. ie if you configure two disks one with hda and one hdb, libvirt will ensure hda appears before hdb on the bus or controller. So I don't think we should include the target device name in our configuration syntax here. We should just document that disks will be added to the guest in the same order that you supply them to virt-sandbox command line in. The actual device names will vary according to the hypevisor and guest os. > +gboolean gvir_sandbox_config_add_disk_strv(GVirSandboxConfig *config, > + gchar **disks, > + GError **error) > +{ > + gsize i = 0; > + while (disks && disks[i]) { > + if (!gvir_sandbox_config_add_disk_opts(config, > + disks[i], > + error)) > + return FALSE; > + i++; > + } > + return TRUE; > +} Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list