[libvirt] [PATCH 22/24] maint: improve VIR_ERR_INVALID_DOMAIN_SNAPSHOT usage

Eric Blake eblake at redhat.com
Thu Jan 9 21:50:31 UTC 2014


On 01/02/2014 05:55 PM, John Ferlan wrote:
> 
> 
> On 12/28/2013 11:11 AM, Eric Blake wrote:
>> The existing check of domain snapshots validated that they
>> point to a domain, but did not validate that the domain
>> points to a connection, even though any errors blindly assume
>> the connection is valid.  For consistency with previous
>> patches, continue the trend of using a common macro.  For
>> now, we don't need virCheckDomainSnapshotGoto().
>>
>> * src/datatypes.h (virCheckDomainSnapshotReturn): New macro.
>> (VIR_IS_SNAPSHOT, VIR_IS_DOMAIN_SNAPSHOT):
>> Drop unused macros.
>> * src/libvirt.c: Use macro throughout.
>> (virLibDomainSnapshotError): Drop unused macro.
>>
>> Signed-off-by: Eric Blake <eblake at redhat.com>
>> ---
>>  src/datatypes.h |  18 +++++++--
>>  src/libvirt.c   | 118 +++++++++++---------------------------------------------
>>  2 files changed, 36 insertions(+), 100 deletions(-)
>>
> 
> ACK
> 

22 is pushed, after squashing in this obvious fix which would have
broken all snapshot APIs (bummer that 'make check' didn't catch it,
seems like something where snapshot probing of test:/// should have
caught this...; a trivial 'virsh -c test:///default snapshot-create
test' was enough to expose it)

diff --git i/src/datatypes.h w/src/datatypes.h
index 999065f..9621c55 100644
--- i/src/datatypes.h
+++ w/src/datatypes.h
@@ -235,7 +235,7 @@ extern virClassPtr virStoragePoolClass;
 # define virCheckDomainSnapshotReturn(obj, retval)                      \
     do {                                                                \
         virDomainSnapshotPtr _snap = (obj);                             \
-        if (!virObjectIsClass(_snap, virNWFilterClass) ||               \
+        if (!virObjectIsClass(_snap, virDomainSnapshotClass) ||         \
             !virObjectIsClass(_snap->domain, virDomainClass) ||         \
             !virObjectIsClass(_snap->domain->conn, virConnectClass)) {  \
             virReportErrorHelper(VIR_FROM_DOMAIN_SNAPSHOT,              \


[Do you ever wonder if I sneak in blatant bugs in large series, just to
see if anyone is paying attention?]

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140109/250dfed7/attachment-0001.sig>


More information about the libvir-list mailing list