On 08/24/2011 10:10 AM, Daniel P. Berrange wrote:
On Wed, Aug 24, 2011 at 09:22:20AM -0600, Eric Blake wrote:
> +{
> + const char *qemuimgarg[] = { NULL, "snapshot", "-a", NULL,
NULL, NULL };
> + for (i = 0; i< vm->def->ndisks; i++) {
> +
> + qemuimgarg[4] = vm->def->disks[i]->src;
> +
> + if (virRun(qemuimgarg, NULL)< 0)
I know that virRun is implemented in terms of virCommand, but should
be we aiming to convert virRun uses over to directly use virCommand ?
Here, virRun really is nicer, because it is the only interface that lets
us modify _just_ qemuimgarg[4] without having to alter the earlier array
elements. If we directly used virCommand, we'd have to start from
scratch each time around, or add a new virCommand interface that would
let us delete or otherwise modify arguments previously added. That, and
this new code was merely copying after other functions that did qemu-img
snapshot -c and qemu-img snapshot -d for multiple files.
ACK
Daniel
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org