On 10/21/2012 08:09 PM, Doug Goldstein wrote:
On Sun, Oct 21, 2012 at 7:53 PM, liguang
<lig.fnst(a)cn.fujitsu.com> wrote:
> help to create disk images copy-storage-* required,
> try to do non-shared migration without bothering to
> create disk images at target by hand.
>
> + } else
> + cmd = virCommandNewArgList("rm", "-f",
def->disks[i]->src, NULL);
> +
> + if (virCommandRun(cmd, NULL) < 0) {
> + goto cleanup;
> + virReportSystemError(errno, "%s",
> + _("unable create disk images by qemu-img"));
> + }
The error message reported doesn't match what happened when the rm -f
fails. Also 'cmd' is being leaked here.
Not to mention virCommandRun() is overkill. Use unlink() here instead,
rather than forking out to an external program.
--
Eric Blake eblake(a)redhat.com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org