[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCHv2 16/20] conf: Add helper to determine if snapshot is external



Snapshots are external if they are "disk snapshots" or if they have an
external memory image. Other possibilities are not supported (yet).
---
 src/conf/snapshot_conf.c | 11 +++++++++++
 src/conf/snapshot_conf.h |  2 ++
 src/libvirt_private.syms |  1 +
 3 files changed, 14 insertions(+)

diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c
index 691950a..5d9df57 100644
--- a/src/conf/snapshot_conf.c
+++ b/src/conf/snapshot_conf.c
@@ -1023,3 +1023,14 @@ cleanup:
     }
     return ret;
 }
+
+
+bool
+virDomainSnapshotIsExternal(virDomainSnapshotObjPtr snap)
+{
+    if (snap->def->state == VIR_DOMAIN_DISK_SNAPSHOT ||
+        snap->def->memory == VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL)
+        return true;
+
+    return false;
+}
diff --git a/src/conf/snapshot_conf.h b/src/conf/snapshot_conf.h
index 00775ae..b5c6e25 100644
--- a/src/conf/snapshot_conf.h
+++ b/src/conf/snapshot_conf.h
@@ -155,6 +155,8 @@ int virDomainListSnapshots(virDomainSnapshotObjListPtr snapshots,
                            virDomainSnapshotPtr **snaps,
                            unsigned int flags);

+bool virDomainSnapshotIsExternal(virDomainSnapshotObjPtr snap);
+
 VIR_ENUM_DECL(virDomainSnapshotLocation)
 VIR_ENUM_DECL(virDomainSnapshotState)

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index e94b478..5a07139 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1083,6 +1083,7 @@ virDomainSnapshotFindByName;
 virDomainSnapshotForEach;
 virDomainSnapshotForEachChild;
 virDomainSnapshotForEachDescendant;
+virDomainSnapshotIsExternal;
 virDomainSnapshotLocationTypeFromString;
 virDomainSnapshotLocationTypeToString;
 virDomainSnapshotObjListGetNames;
-- 
1.7.12.4


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]