mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-07 06:45:45 +00:00
16ac4c9d64
A continuation of the migration of disk details to virstoragefile. This patch moves a single enum, but converting the name has quite a bit of fallout. * src/conf/domain_conf.h (virDomainDiskType): Move... * src/util/virstoragefile.h (virStorageType): ...and rename. * src/bhyve/bhyve_command.c (bhyveBuildDiskArgStr) (virBhyveProcessBuildLoadCmd): Update clients. * src/conf/domain_conf.c (virDomainDiskSourceDefParse) (virDomainDiskDefParseXML, virDomainDiskSourceDefFormatInternal) (virDomainDiskDefFormat, virDomainDiskGetActualType) (virDomainDiskDefForeachPath, virDomainDiskSourceIsBlockType): Likewise. * src/conf/snapshot_conf.h (_virDomainSnapshotDiskDef): Likewise. * src/conf/snapshot_conf.c (virDomainSnapshotDiskDefParseXML) (virDomainSnapshotAlignDisks, virDomainSnapshotDiskDefFormat): Likewise. * src/esx/esx_driver.c (esxAutodetectSCSIControllerModel) (esxDomainDefineXML): Likewise. * src/locking/domain_lock.c (virDomainLockManagerAddDisk): Likewise. * src/lxc/lxc_controller.c (virLXCControllerSetupLoopDeviceDisk) (virLXCControllerSetupNBDDeviceDisk) (virLXCControllerSetupLoopDevices, virLXCControllerSetupDisk): Likewise. * src/parallels/parallels_driver.c (parallelsGetHddInfo): Likewise. * src/phyp/phyp_driver.c (phypDiskType): Likewise. * src/qemu/qemu_command.c (qemuGetDriveSourceString) (qemuDomainDiskGetSourceString, qemuBuildDriveStr) (qemuBuildCommandLine, qemuParseCommandLineDisk) (qemuParseCommandLine): Likewise. * src/qemu/qemu_conf.c (qemuCheckSharedDevice) (qemuTranslateDiskSourcePool) (qemuTranslateSnapshotDiskSourcePool): Likewise. * src/qemu/qemu_domain.c (qemuDomainDeviceDefPostParse) (qemuDomainDetermineDiskChain): Likewise. * src/qemu/qemu_driver.c (qemuDomainGetBlockInfo) (qemuDomainSnapshotPrepareDiskExternalBackingInactive) (qemuDomainSnapshotPrepareDiskExternalBackingActive) (qemuDomainSnapshotPrepareDiskExternalOverlayActive) (qemuDomainSnapshotPrepareDiskExternalOverlayInactive) (qemuDomainSnapshotPrepareDiskInternal) (qemuDomainSnapshotPrepare) (qemuDomainSnapshotCreateSingleDiskActive): Likewise. * src/qemu/qemu_hotplug.c (qemuDomainChangeEjectableMedia): Likewise. * src/qemu/qemu_migration.c (qemuMigrationIsSafe): Likewise. * src/security/security_apparmor.c (AppArmorRestoreSecurityImageLabel) (AppArmorSetSecurityImageLabel): Likewise. * src/security/security_dac.c (virSecurityDACSetSecurityImageLabel) (virSecurityDACRestoreSecurityImageLabelInt) (virSecurityDACSetSecurityAllLabel): Likewise. * src/security/security_selinux.c (virSecuritySELinuxRestoreSecurityImageLabelInt) (virSecuritySELinuxSetSecurityImageLabel) (virSecuritySELinuxSetSecurityAllLabel): Likewise. * src/storage/storage_backend.c (virStorageFileBackendForType): Likewise. * src/storage/storage_backend_fs.c (virStorageFileBackendFile) (virStorageFileBackendBlock): Likewise. * src/storage/storage_backend_gluster.c (virStorageFileBackendGluster): Likewise. * src/vbox/vbox_tmpl.c (vboxDomainGetXMLDesc, vboxAttachDrives) (vboxDomainAttachDeviceImpl, vboxDomainDetachDevice): Likewise. * src/vmware/vmware_conf.c (vmwareVmxPath): Likewise. * src/vmx/vmx.c (virVMXParseDisk, virVMXFormatDisk) (virVMXFormatFloppy): Likewise. * src/xenxs/xen_sxpr.c (xenParseSxprDisks, xenParseSxpr) (xenFormatSxprDisk): Likewise. * src/xenxs/xen_xm.c (xenParseXM, xenFormatXMDisk): Likewise. * tests/securityselinuxlabeltest.c (testSELinuxLoadDef): Likewise. * src/libvirt_private.syms (domain_conf.h): Move symbols... (virstoragefile.h): ...as appropriate. Signed-off-by: Eric Blake <eblake@redhat.com>
196 lines
8.4 KiB
C
196 lines
8.4 KiB
C
/*
|
|
* snapshot_conf.h: domain snapshot XML processing
|
|
*
|
|
* Copyright (C) 2006-2014 Red Hat, Inc.
|
|
* Copyright (C) 2006-2008 Daniel P. Berrange
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with this library. If not, see
|
|
* <http://www.gnu.org/licenses/>.
|
|
*
|
|
* Author: Eric Blake <eblake@redhat.com>
|
|
*/
|
|
|
|
#ifndef __SNAPSHOT_CONF_H
|
|
# define __SNAPSHOT_CONF_H
|
|
|
|
# include "internal.h"
|
|
# include "domain_conf.h"
|
|
|
|
/* Items related to snapshot state */
|
|
|
|
enum virDomainSnapshotLocation {
|
|
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
|
|
};
|
|
|
|
enum virDomainSnapshotState {
|
|
/* Inherit the VIR_DOMAIN_* states from virDomainState. */
|
|
VIR_DOMAIN_DISK_SNAPSHOT = VIR_DOMAIN_LAST,
|
|
VIR_DOMAIN_SNAPSHOT_STATE_LAST
|
|
};
|
|
|
|
/* Stores disk-snapshot information */
|
|
typedef struct _virDomainSnapshotDiskDef virDomainSnapshotDiskDef;
|
|
typedef virDomainSnapshotDiskDef *virDomainSnapshotDiskDefPtr;
|
|
struct _virDomainSnapshotDiskDef {
|
|
char *name; /* name matching the <target dev='...' of the domain */
|
|
int index; /* index within snapshot->dom->disks that matches name */
|
|
int snapshot; /* enum virDomainSnapshotLocation */
|
|
int type; /* enum virStorageType */
|
|
char *file; /* new source file when snapshot is external */
|
|
int format; /* enum virStorageFileFormat */
|
|
int protocol; /* network source protocol */
|
|
size_t nhosts; /* network source hosts count */
|
|
virStorageNetHostDefPtr hosts; /* network source hosts */
|
|
};
|
|
|
|
/* Stores the complete snapshot metadata */
|
|
typedef struct _virDomainSnapshotDef virDomainSnapshotDef;
|
|
typedef virDomainSnapshotDef *virDomainSnapshotDefPtr;
|
|
struct _virDomainSnapshotDef {
|
|
/* Public XML. */
|
|
char *name;
|
|
char *description;
|
|
char *parent;
|
|
long long creationTime; /* in seconds */
|
|
int state; /* enum virDomainSnapshotState */
|
|
|
|
int memory; /* enum virDomainMemorySnapshot */
|
|
char *file; /* memory state file when snapshot is external */
|
|
|
|
size_t ndisks; /* should not exceed dom->ndisks */
|
|
virDomainSnapshotDiskDef *disks;
|
|
|
|
virDomainDefPtr dom;
|
|
|
|
/* Internal use. */
|
|
bool current; /* At most one snapshot in the list should have this set */
|
|
};
|
|
|
|
struct _virDomainSnapshotObj {
|
|
virDomainSnapshotDefPtr def; /* non-NULL except for metaroot */
|
|
|
|
virDomainSnapshotObjPtr parent; /* non-NULL except for metaroot, before
|
|
virDomainSnapshotUpdateRelations, or
|
|
after virDomainSnapshotDropParent */
|
|
virDomainSnapshotObjPtr sibling; /* NULL if last child of parent */
|
|
size_t nchildren;
|
|
virDomainSnapshotObjPtr first_child; /* NULL if no children */
|
|
};
|
|
|
|
virDomainSnapshotObjListPtr virDomainSnapshotObjListNew(void);
|
|
void virDomainSnapshotObjListFree(virDomainSnapshotObjListPtr snapshots);
|
|
|
|
typedef enum {
|
|
VIR_DOMAIN_SNAPSHOT_PARSE_REDEFINE = 1 << 0,
|
|
VIR_DOMAIN_SNAPSHOT_PARSE_DISKS = 1 << 1,
|
|
VIR_DOMAIN_SNAPSHOT_PARSE_INTERNAL = 1 << 2,
|
|
VIR_DOMAIN_SNAPSHOT_PARSE_OFFLINE = 1 << 3,
|
|
} virDomainSnapshotParseFlags;
|
|
|
|
virDomainSnapshotDefPtr virDomainSnapshotDefParseString(const char *xmlStr,
|
|
virCapsPtr caps,
|
|
virDomainXMLOptionPtr xmlopt,
|
|
unsigned int expectedVirtTypes,
|
|
unsigned int flags);
|
|
virDomainSnapshotDefPtr virDomainSnapshotDefParseNode(xmlDocPtr xml,
|
|
xmlNodePtr root,
|
|
virCapsPtr caps,
|
|
virDomainXMLOptionPtr xmlopt,
|
|
unsigned int expectedVirtTypes,
|
|
unsigned int flags);
|
|
void virDomainSnapshotDefFree(virDomainSnapshotDefPtr def);
|
|
char *virDomainSnapshotDefFormat(const char *domain_uuid,
|
|
virDomainSnapshotDefPtr def,
|
|
unsigned int flags,
|
|
int internal);
|
|
int virDomainSnapshotAlignDisks(virDomainSnapshotDefPtr snapshot,
|
|
int default_snapshot,
|
|
bool require_match);
|
|
virDomainSnapshotObjPtr virDomainSnapshotAssignDef(virDomainSnapshotObjListPtr snapshots,
|
|
virDomainSnapshotDefPtr def);
|
|
|
|
int virDomainSnapshotObjListGetNames(virDomainSnapshotObjListPtr snapshots,
|
|
virDomainSnapshotObjPtr from,
|
|
char **const names, int maxnames,
|
|
unsigned int flags);
|
|
int virDomainSnapshotObjListNum(virDomainSnapshotObjListPtr snapshots,
|
|
virDomainSnapshotObjPtr from,
|
|
unsigned int flags);
|
|
virDomainSnapshotObjPtr virDomainSnapshotFindByName(virDomainSnapshotObjListPtr snapshots,
|
|
const char *name);
|
|
void virDomainSnapshotObjListRemove(virDomainSnapshotObjListPtr snapshots,
|
|
virDomainSnapshotObjPtr snapshot);
|
|
int virDomainSnapshotForEach(virDomainSnapshotObjListPtr snapshots,
|
|
virHashIterator iter,
|
|
void *data);
|
|
int virDomainSnapshotForEachChild(virDomainSnapshotObjPtr snapshot,
|
|
virHashIterator iter,
|
|
void *data);
|
|
int virDomainSnapshotForEachDescendant(virDomainSnapshotObjPtr snapshot,
|
|
virHashIterator iter,
|
|
void *data);
|
|
int virDomainSnapshotUpdateRelations(virDomainSnapshotObjListPtr snapshots);
|
|
void virDomainSnapshotDropParent(virDomainSnapshotObjPtr snapshot);
|
|
|
|
# define VIR_DOMAIN_SNAPSHOT_FILTERS_METADATA \
|
|
(VIR_DOMAIN_SNAPSHOT_LIST_METADATA | \
|
|
VIR_DOMAIN_SNAPSHOT_LIST_NO_METADATA)
|
|
|
|
# define VIR_DOMAIN_SNAPSHOT_FILTERS_LEAVES \
|
|
(VIR_DOMAIN_SNAPSHOT_LIST_LEAVES | \
|
|
VIR_DOMAIN_SNAPSHOT_LIST_NO_LEAVES)
|
|
|
|
# define VIR_DOMAIN_SNAPSHOT_FILTERS_STATUS \
|
|
(VIR_DOMAIN_SNAPSHOT_LIST_INACTIVE | \
|
|
VIR_DOMAIN_SNAPSHOT_LIST_ACTIVE | \
|
|
VIR_DOMAIN_SNAPSHOT_LIST_DISK_ONLY)
|
|
|
|
# define VIR_DOMAIN_SNAPSHOT_FILTERS_LOCATION \
|
|
(VIR_DOMAIN_SNAPSHOT_LIST_INTERNAL | \
|
|
VIR_DOMAIN_SNAPSHOT_LIST_EXTERNAL)
|
|
|
|
# define VIR_DOMAIN_SNAPSHOT_FILTERS_ALL \
|
|
(VIR_DOMAIN_SNAPSHOT_FILTERS_METADATA | \
|
|
VIR_DOMAIN_SNAPSHOT_FILTERS_LEAVES | \
|
|
VIR_DOMAIN_SNAPSHOT_FILTERS_STATUS | \
|
|
VIR_DOMAIN_SNAPSHOT_FILTERS_LOCATION)
|
|
|
|
int virDomainListSnapshots(virDomainSnapshotObjListPtr snapshots,
|
|
virDomainSnapshotObjPtr from,
|
|
virDomainPtr dom,
|
|
virDomainSnapshotPtr **snaps,
|
|
unsigned int flags);
|
|
|
|
bool virDomainSnapshotDefIsExternal(virDomainSnapshotDefPtr def);
|
|
bool virDomainSnapshotIsExternal(virDomainSnapshotObjPtr snap);
|
|
|
|
int virDomainSnapshotRedefinePrep(virDomainPtr domain,
|
|
virDomainObjPtr vm,
|
|
virDomainSnapshotDefPtr *def,
|
|
virDomainSnapshotObjPtr *snap,
|
|
bool *update_current,
|
|
unsigned int flags);
|
|
|
|
int virDomainSnapshotDiskGetActualType(virDomainSnapshotDiskDefPtr def);
|
|
|
|
VIR_ENUM_DECL(virDomainSnapshotLocation)
|
|
VIR_ENUM_DECL(virDomainSnapshotState)
|
|
|
|
#endif /* __SNAPSHOT_CONF_H */
|