conf: Move definition of 'virDomainSnapshotLocation'

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>
This commit is contained in:
Peter Krempa 2022-03-08 15:36:17 +01:00
parent 0146d70887
commit f17da1c24b
5 changed files with 24 additions and 24 deletions

View 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'",

View 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;

View 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,

View File

@ -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);

View 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;