The snapshot location enum is also needed for the disk definition so if
we house it inside domain_conf we can use the proper type for it.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/conf/domain_conf.c | 10 +++++++++-
src/conf/domain_conf.h | 14 +++++++++++++-
src/conf/snapshot_conf.c | 8 --------
src/conf/snapshot_conf.h | 12 ------------
src/libvirt_private.syms | 4 ++--
5 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 40ff71d7db..721623129c 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -1402,6 +1402,14 @@ VIR_ENUM_IMPL(virDomainIBS,
"fixed-na",
);
+VIR_ENUM_IMPL(virDomainSnapshotLocation,
+ VIR_DOMAIN_SNAPSHOT_LOCATION_LAST,
+ "default",
+ "no",
+ "internal",
+ "external",
+);
+
/* Internal mapping: subset of block job types that can be present in
* <mirror> XML (remaining types are not two-phase). */
VIR_ENUM_DECL(virDomainBlockJob);
@@ -23608,7 +23616,7 @@ virDomainDiskDefFormat(virBuffer *buf,
if (def->sgio)
virBufferAsprintf(&attrBuf, " sgio='%s'", sgio);
- if (def->snapshot &&
+ if (def->snapshot != VIR_DOMAIN_SNAPSHOT_LOCATION_DEFAULT &&
!(def->snapshot == VIR_DOMAIN_SNAPSHOT_LOCATION_NONE &&
def->src->readonly))
virBufferAsprintf(&attrBuf, " snapshot='%s'",
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 9fcf842ee7..5f6b508e89 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -537,6 +537,18 @@ typedef enum {
} virDomainMemoryAllocation;
+typedef enum {
+ VIR_DOMAIN_SNAPSHOT_LOCATION_DEFAULT = 0,
+ VIR_DOMAIN_SNAPSHOT_LOCATION_NONE,
+ VIR_DOMAIN_SNAPSHOT_LOCATION_INTERNAL,
+ VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL,
+
+ VIR_DOMAIN_SNAPSHOT_LOCATION_LAST
+} virDomainSnapshotLocation;
+
+VIR_ENUM_DECL(virDomainSnapshotLocation);
+
+
/* Stores the virtual disk configuration */
struct _virDomainDiskDef {
virStorageSource *src; /* non-NULL. XXX Allow NULL for empty cdrom? */
@@ -581,7 +593,7 @@ struct _virDomainDiskDef {
virTristateSwitch ioeventfd;
virTristateSwitch event_idx;
virTristateSwitch copy_on_read;
- unsigned int snapshot; /* virDomainSnapshotLocation, snapshot_conf.h */
+ virDomainSnapshotLocation snapshot;
virDomainStartupPolicy startupPolicy;
bool transient;
virTristateBool transientShareBacking;
diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c
index 812cca2ed1..a4b3cd8c2b 100644
--- a/src/conf/snapshot_conf.c
+++ b/src/conf/snapshot_conf.c
@@ -67,14 +67,6 @@ virDomainSnapshotOnceInit(void)
VIR_ONCE_GLOBAL_INIT(virDomainSnapshot);
-VIR_ENUM_IMPL(virDomainSnapshotLocation,
- VIR_DOMAIN_SNAPSHOT_LOCATION_LAST,
- "default",
- "no",
- "internal",
- "external",
-);
-
/* virDomainSnapshotState is really virDomainState plus one extra state */
VIR_ENUM_IMPL(virDomainSnapshotState,
VIR_DOMAIN_SNAPSHOT_LAST,
diff --git a/src/conf/snapshot_conf.h b/src/conf/snapshot_conf.h
index c8997c710c..b7e0d441ff 100644
--- a/src/conf/snapshot_conf.h
+++ b/src/conf/snapshot_conf.h
@@ -26,17 +26,6 @@
#include "moment_conf.h"
#include "virenum.h"
-/* Items related to snapshot state */
-
-typedef enum {
- VIR_DOMAIN_SNAPSHOT_LOCATION_DEFAULT = 0,
- VIR_DOMAIN_SNAPSHOT_LOCATION_NONE,
- VIR_DOMAIN_SNAPSHOT_LOCATION_INTERNAL,
- VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL,
-
- VIR_DOMAIN_SNAPSHOT_LOCATION_LAST
-} virDomainSnapshotLocation;
-
/**
* This enum has to map all known domain states from the public enum
* virDomainState, before adding one additional state possible only
@@ -139,5 +128,4 @@ int virDomainSnapshotRedefinePrep(virDomainObj *vm,
virDomainXMLOption *xmlopt,
unsigned int flags);
-VIR_ENUM_DECL(virDomainSnapshotLocation);
VIR_ENUM_DECL(virDomainSnapshotState);
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 6f0d72ca38..01503083ef 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -637,6 +637,8 @@ virDomainSmartcardTypeFromString;
virDomainSmartcardTypeToString;
virDomainSmbiosModeTypeFromString;
virDomainSmbiosModeTypeToString;
+virDomainSnapshotLocationTypeFromString;
+virDomainSnapshotLocationTypeToString;
virDomainSoundDefFind;
virDomainSoundDefFree;
virDomainSoundDefRemove;
@@ -1024,8 +1026,6 @@ virDomainSnapshotDiskDefFree;
virDomainSnapshotDiskDefParseXML;
virDomainSnapshotFormatConvertXMLFlags;
virDomainSnapshotIsExternal;
-virDomainSnapshotLocationTypeFromString;
-virDomainSnapshotLocationTypeToString;
virDomainSnapshotRedefinePrep;
virDomainSnapshotStateTypeFromString;
virDomainSnapshotStateTypeToString;
--
2.35.1