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

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

 



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 5f591f3..66162f8 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1080,6 +1080,7 @@ virDomainSnapshotFindByName;
 virDomainSnapshotForEach;
 virDomainSnapshotForEachChild;
 virDomainSnapshotForEachDescendant;
+virDomainSnapshotIsExternal;
 virDomainSnapshotLocationTypeFromString;
 virDomainSnapshotLocationTypeToString;
 virDomainSnapshotObjListGetNames;
-- 
1.7.12.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]