[libvirt] [PATCH v3 3/8] test: Implement readonly snapshot APIs
Cole Robinson
crobinso at redhat.com
Thu Oct 3 21:40:29 UTC 2013
On 10/02/2013 06:40 AM, John Ferlan wrote:
> On 09/25/2013 03:15 PM, Cole Robinson wrote:
>> This is just stolen from qemu_driver.c with tweaks to fit the
>> test driver.
>> ---
>> src/test/test_driver.c | 392 +++++++++++++++++++++++++++++++++++++++++++++++++
>> 1 file changed, 392 insertions(+)
>>
>
> ...
>
>> +static int
>> +testDomainSnapshotIsCurrent(virDomainSnapshotPtr snapshot,
>> + unsigned int flags)
>> +{
>> + virDomainObjPtr vm = NULL;
>> + int ret = -1;
>> + virDomainSnapshotObjPtr snap = NULL;
>> +
>> + virCheckFlags(0, -1);
>> +
>> + if (!(vm = testDomObjFromSnapshot(snapshot)))
>> + goto cleanup;
>> +
>
> Coverity complains here:
>
> 6440
>
> (1) Event returned_pointer: Pointer "snap" returned by "testSnapObjFromSnapshot(vm, snapshot)" is never used.
>
> 6441 if (!(snap = testSnapObjFromSnapshot(vm, snapshot)))
>
>
>> + if (!(snap = testSnapObjFromSnapshot(vm, snapshot)))
>> + goto cleanup;
>> +
>> + ret = (vm->current_snapshot &&
>> + STREQ(snapshot->name, vm->current_snapshot->def->name));
>> +
>> +cleanup:
>> + if (vm)
>> + virObjectUnlock(vm);
>> + return ret;
>> +}
>> +
>> +
>> +static int
>> +testDomainSnapshotHasMetadata(virDomainSnapshotPtr snapshot,
>> + unsigned int flags)
>> +{
>> + virDomainObjPtr vm = NULL;
>> + int ret = -1;
>> + virDomainSnapshotObjPtr snap = NULL;
>> +
>> + virCheckFlags(0, -1);
>> +
>> + if (!(vm = testDomObjFromSnapshot(snapshot)))
>> + goto cleanup;
>> +
>
> Coverity complains here too
>
> 6466
>
> (1) Event returned_pointer: Pointer "snap" returned by "testSnapObjFromSnapshot(vm, snapshot)" is never used.
>
> 6467 if (!(snap = testSnapObjFromSnapshot(vm, snapshot)))
>
> John
>
>> + if (!(snap = testSnapObjFromSnapshot(vm, snapshot)))
>> + goto cleanup;
>> +
>> + ret = 1;
>> +
>> +cleanup:
>> + if (vm)
>> + virObjectUnlock(vm);
>> + return ret;
>> +}
>> +
>
I've sent a patch for this
Thanks,
Cole
More information about the libvir-list
mailing list