]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
conf: Move definition of 'virDomainSnapshotLocation'
authorPeter Krempa <pkrempa@redhat.com>
Tue, 8 Mar 2022 14:36:17 +0000 (15:36 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 11 Mar 2022 12:55:49 +0000 (13:55 +0100)
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@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/conf/domain_conf.c
src/conf/domain_conf.h
src/conf/snapshot_conf.c
src/conf/snapshot_conf.h
src/libvirt_private.syms

index 40ff71d7db45d94e01a715775398dbc757dffe1b..721623129ca366fb08c2786ad2ab9a25673b6044 100644 (file)
@@ -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'",
index 9fcf842ee7498fe5ea60624ebaf53731ba34406f..5f6b508e89447c1e2a1bfccc774dfb4325dcc6da 100644 (file)
@@ -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;
index 812cca2ed1113065a0568f675a236f9dedcb89f9..a4b3cd8c2b3c39119a45841f3f6c7d94fc7751b1 100644 (file)
@@ -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,
index c8997c710c81c2d9b9f9b5ef3dabc55e073fc012..b7e0d441ff9e3ac20d2b60db9befe5c48fdbb3a9 100644 (file)
 #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);
index 6f0d72ca389996f88852a695f94a3022b5b605cb..01503083ef6e9a0ceba1ce8353cf85acf922effb 100644 (file)
@@ -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;