[libvirt] [RFC] virCommandRun return error number
Michal Privoznik
mprivozn at redhat.com
Thu Apr 11 13:38:50 UTC 2013
On 11.04.2013 15:33, harryxiyou wrote:
> Hi all,
>
> I copy portions of libvirt/src/storage/storage_backend_sheepdog.c
> [...]
> 125 ret = virCommandRun(cmd, NULL);
> 126 if (ret == 0)
> 127 ret = virStorageBackendSheepdogParseNodeInfo(pool->def, output);
> [...]
>
> I found virCommandRun may return '-1', which hinds something error happens.
> However, Sheepdog hasn't check here. Maybe i have come up with this bug.
> I cannot remember clearly. Could anyone please give me some suggestions?
> If ture, i will give a patch for this bug ;-).
>
>
> --
> Thanks
> Harry Wei
>
Maybe you've pasted wrong code snippet, but the one you've pasted is
correct. If virCommandRun() fails and returns -1; we return that value
to the caller. And if the command doesn't fail, we call
virStorageBackendSheepdogParseNodeInfo to parse output of the command.
Michal
More information about the libvir-list
mailing list