2008-02-20 15:34:52 +00:00
|
|
|
/*
|
|
|
|
* storage_conf.h: config handling for storage driver
|
|
|
|
*
|
2014-03-28 03:26:44 +00:00
|
|
|
* Copyright (C) 2006-2008, 2010-2014 Red Hat, Inc.
|
2008-02-20 15:34:52 +00:00
|
|
|
* 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
|
2012-09-20 22:30:55 +00:00
|
|
|
* License along with this library. If not, see
|
2012-07-21 10:06:23 +00:00
|
|
|
* <http://www.gnu.org/licenses/>.
|
2008-02-20 15:34:52 +00:00
|
|
|
*
|
|
|
|
* Author: Daniel P. Berrange <berrange@redhat.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __VIR_STORAGE_CONF_H__
|
2010-03-09 18:22:22 +00:00
|
|
|
# define __VIR_STORAGE_CONF_H__
|
2008-02-20 15:34:52 +00:00
|
|
|
|
2010-03-09 18:22:22 +00:00
|
|
|
# include "internal.h"
|
2014-03-28 03:26:44 +00:00
|
|
|
# include "virstorageencryption.h"
|
2014-03-30 03:21:06 +00:00
|
|
|
# include "virstoragefile.h"
|
2013-05-16 10:38:26 +00:00
|
|
|
# include "virbitmap.h"
|
2012-12-13 15:49:48 +00:00
|
|
|
# include "virthread.h"
|
2014-03-04 03:15:13 +00:00
|
|
|
# include "device_conf.h"
|
2014-11-17 13:40:59 +00:00
|
|
|
# include "node_device_conf.h"
|
2008-02-20 15:34:52 +00:00
|
|
|
|
2010-03-09 18:22:22 +00:00
|
|
|
# include <libxml/tree.h>
|
2009-06-22 16:41:34 +00:00
|
|
|
|
2008-02-20 15:34:52 +00:00
|
|
|
/*
|
|
|
|
* How the volume's data is stored on underlying
|
|
|
|
* physical devices - can potentially span many
|
|
|
|
* devices in LVM case.
|
|
|
|
*/
|
|
|
|
typedef struct _virStorageVolSourceExtent virStorageVolSourceExtent;
|
|
|
|
typedef virStorageVolSourceExtent *virStorageVolSourceExtentPtr;
|
|
|
|
struct _virStorageVolSourceExtent {
|
|
|
|
char *path;
|
|
|
|
unsigned long long start;
|
|
|
|
unsigned long long end;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct _virStorageVolSource virStorageVolSource;
|
|
|
|
typedef virStorageVolSource *virStorageVolSourcePtr;
|
|
|
|
struct _virStorageVolSource {
|
|
|
|
int nextent;
|
|
|
|
virStorageVolSourceExtentPtr extents;
|
2014-03-30 02:27:44 +00:00
|
|
|
|
2014-05-11 15:08:50 +00:00
|
|
|
int partType; /* virStorageVolTypeDisk, only used by disk
|
2014-03-30 02:27:44 +00:00
|
|
|
* backend for partition type creation */
|
2008-02-20 15:34:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct _virStorageVolDef virStorageVolDef;
|
|
|
|
typedef virStorageVolDef *virStorageVolDefPtr;
|
|
|
|
struct _virStorageVolDef {
|
|
|
|
char *name;
|
|
|
|
char *key;
|
2014-05-11 15:08:50 +00:00
|
|
|
int type; /* virStorageVolType */
|
2008-02-20 15:34:52 +00:00
|
|
|
|
2014-07-17 16:41:21 +00:00
|
|
|
bool building;
|
2014-04-16 13:16:20 +00:00
|
|
|
unsigned int in_use;
|
2009-04-17 19:12:37 +00:00
|
|
|
|
2008-02-20 15:34:52 +00:00
|
|
|
virStorageVolSource source;
|
2014-04-01 21:11:30 +00:00
|
|
|
virStorageSource target;
|
2008-02-20 15:34:52 +00:00
|
|
|
};
|
|
|
|
|
2008-10-10 15:13:28 +00:00
|
|
|
typedef struct _virStorageVolDefList virStorageVolDefList;
|
|
|
|
typedef virStorageVolDefList *virStorageVolDefListPtr;
|
|
|
|
struct _virStorageVolDefList {
|
2013-10-30 21:42:31 +00:00
|
|
|
size_t count;
|
2008-10-10 15:13:28 +00:00
|
|
|
virStorageVolDefPtr *objs;
|
|
|
|
};
|
2008-02-20 15:34:52 +00:00
|
|
|
|
2013-11-19 20:14:54 +00:00
|
|
|
VIR_ENUM_DECL(virStorageVol)
|
2008-02-20 15:34:52 +00:00
|
|
|
|
2014-05-11 15:08:50 +00:00
|
|
|
typedef enum {
|
2008-11-17 11:19:33 +00:00
|
|
|
VIR_STORAGE_POOL_DIR, /* Local directory */
|
2008-02-20 15:34:52 +00:00
|
|
|
VIR_STORAGE_POOL_FS, /* Local filesystem */
|
|
|
|
VIR_STORAGE_POOL_NETFS, /* Networked filesystem - eg NFS, GFS, etc */
|
|
|
|
VIR_STORAGE_POOL_LOGICAL, /* Logical volume groups / volumes */
|
|
|
|
VIR_STORAGE_POOL_DISK, /* Disk partitions */
|
|
|
|
VIR_STORAGE_POOL_ISCSI, /* iSCSI targets */
|
|
|
|
VIR_STORAGE_POOL_SCSI, /* SCSI HBA */
|
2009-09-08 13:47:45 +00:00
|
|
|
VIR_STORAGE_POOL_MPATH, /* Multipath devices */
|
2012-05-14 09:06:42 +00:00
|
|
|
VIR_STORAGE_POOL_RBD, /* RADOS Block Device */
|
2012-07-18 19:06:58 +00:00
|
|
|
VIR_STORAGE_POOL_SHEEPDOG, /* Sheepdog device */
|
2013-11-19 23:26:05 +00:00
|
|
|
VIR_STORAGE_POOL_GLUSTER, /* Gluster device */
|
2014-07-21 14:38:42 +00:00
|
|
|
VIR_STORAGE_POOL_ZFS, /* ZFS */
|
2008-11-17 11:19:33 +00:00
|
|
|
|
|
|
|
VIR_STORAGE_POOL_LAST,
|
2014-05-11 15:08:50 +00:00
|
|
|
} virStoragePoolType;
|
2008-02-20 15:34:52 +00:00
|
|
|
|
2008-12-17 21:09:44 +00:00
|
|
|
VIR_ENUM_DECL(virStoragePool)
|
2008-11-17 11:19:33 +00:00
|
|
|
|
2014-05-11 15:08:50 +00:00
|
|
|
typedef enum {
|
2009-04-01 16:03:22 +00:00
|
|
|
VIR_STORAGE_DEVICE_TYPE_DISK = 0x00,
|
|
|
|
VIR_STORAGE_DEVICE_TYPE_ROM = 0x05,
|
|
|
|
|
|
|
|
VIR_STORAGE_DEVICE_TYPE_LAST,
|
2014-05-11 15:08:50 +00:00
|
|
|
} virStoragePoolDeviceType;
|
2009-04-01 16:03:22 +00:00
|
|
|
|
2008-02-20 15:34:52 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* For remote pools, info on how to reach the host
|
|
|
|
*/
|
|
|
|
typedef struct _virStoragePoolSourceHost virStoragePoolSourceHost;
|
|
|
|
typedef virStoragePoolSourceHost *virStoragePoolSourceHostPtr;
|
|
|
|
struct _virStoragePoolSourceHost {
|
|
|
|
char *name;
|
|
|
|
int port;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2009-06-26 16:18:59 +00:00
|
|
|
/*
|
2013-05-16 12:40:54 +00:00
|
|
|
* For MSDOS partitions, the free area is important when
|
|
|
|
* creating logical partitions
|
2009-06-26 16:18:59 +00:00
|
|
|
*/
|
2014-05-11 15:08:50 +00:00
|
|
|
typedef enum {
|
2009-06-26 16:18:59 +00:00
|
|
|
VIR_STORAGE_FREE_NONE = 0,
|
|
|
|
VIR_STORAGE_FREE_NORMAL,
|
|
|
|
VIR_STORAGE_FREE_LOGICAL,
|
|
|
|
VIR_STORAGE_FREE_LAST
|
2014-05-11 15:08:50 +00:00
|
|
|
} virStorageFreeType;
|
2009-06-26 16:18:59 +00:00
|
|
|
|
2008-02-20 15:34:52 +00:00
|
|
|
/*
|
|
|
|
* Available extents on the underlying storage
|
|
|
|
*/
|
|
|
|
typedef struct _virStoragePoolSourceDeviceExtent virStoragePoolSourceDeviceExtent;
|
|
|
|
typedef virStoragePoolSourceDeviceExtent *virStoragePoolSourceDeviceExtentPtr;
|
|
|
|
struct _virStoragePoolSourceDeviceExtent {
|
|
|
|
unsigned long long start;
|
|
|
|
unsigned long long end;
|
2014-05-11 15:08:50 +00:00
|
|
|
int type; /* virStorageFreeType */
|
2008-02-20 15:34:52 +00:00
|
|
|
};
|
|
|
|
|
2010-01-21 11:50:52 +00:00
|
|
|
typedef struct _virStoragePoolSourceInitiatorAttr virStoragePoolSourceInitiatorAttr;
|
|
|
|
struct _virStoragePoolSourceInitiatorAttr {
|
2013-05-16 12:40:54 +00:00
|
|
|
char *iqn; /* Initiator IQN */
|
2010-01-21 11:50:52 +00:00
|
|
|
};
|
|
|
|
|
2008-02-20 15:34:52 +00:00
|
|
|
/*
|
|
|
|
* Pools can be backed by one or more devices, and some
|
|
|
|
* allow us to track free space on underlying devices.
|
|
|
|
*/
|
|
|
|
typedef struct _virStoragePoolSourceDevice virStoragePoolSourceDevice;
|
|
|
|
typedef virStoragePoolSourceDevice *virStoragePoolSourceDevicePtr;
|
|
|
|
struct _virStoragePoolSourceDevice {
|
|
|
|
int nfreeExtent;
|
|
|
|
virStoragePoolSourceDeviceExtentPtr freeExtents;
|
|
|
|
char *path;
|
2013-05-16 12:40:54 +00:00
|
|
|
int format; /* Pool specific source format */
|
|
|
|
|
2009-06-26 16:18:59 +00:00
|
|
|
/* When the source device is a physical disk,
|
2013-05-16 12:40:54 +00:00
|
|
|
* the geometry data is needed
|
|
|
|
*/
|
2009-06-26 16:18:59 +00:00
|
|
|
struct _geometry {
|
2013-11-14 16:14:26 +00:00
|
|
|
int cylinders;
|
2009-06-26 16:18:59 +00:00
|
|
|
int heads;
|
|
|
|
int sectors;
|
|
|
|
} geometry;
|
2008-02-20 15:34:52 +00:00
|
|
|
};
|
|
|
|
|
2014-05-11 15:08:50 +00:00
|
|
|
typedef enum {
|
2013-03-25 16:43:36 +00:00
|
|
|
VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_DEFAULT = 0,
|
|
|
|
VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_SCSI_HOST,
|
|
|
|
VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_FC_HOST,
|
2008-02-20 15:34:52 +00:00
|
|
|
|
2013-03-25 16:43:36 +00:00
|
|
|
VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_LAST,
|
2014-05-11 15:08:50 +00:00
|
|
|
} virStoragePoolSourceAdapterType;
|
2014-05-14 19:48:15 +00:00
|
|
|
VIR_ENUM_DECL(virStoragePoolSourceAdapter)
|
2013-03-25 16:43:36 +00:00
|
|
|
|
|
|
|
typedef struct _virStoragePoolSourceAdapter virStoragePoolSourceAdapter;
|
2014-11-10 16:34:57 +00:00
|
|
|
typedef virStoragePoolSourceAdapter *virStoragePoolSourceAdapterPtr;
|
2013-03-25 16:43:36 +00:00
|
|
|
struct _virStoragePoolSourceAdapter {
|
2014-05-11 15:08:50 +00:00
|
|
|
int type; /* virStoragePoolSourceAdapterType */
|
2013-03-25 16:43:36 +00:00
|
|
|
|
|
|
|
union {
|
2014-03-03 20:04:17 +00:00
|
|
|
struct {
|
|
|
|
char *name;
|
2014-03-04 03:15:13 +00:00
|
|
|
virDevicePCIAddress parentaddr; /* host address */
|
|
|
|
int unique_id;
|
|
|
|
bool has_parent;
|
2014-03-03 20:04:17 +00:00
|
|
|
} scsi_host;
|
2013-03-25 16:43:36 +00:00
|
|
|
struct {
|
|
|
|
char *parent;
|
|
|
|
char *wwnn;
|
|
|
|
char *wwpn;
|
storage: Introduce 'managed' for the fchost parent
https://bugzilla.redhat.com/show_bug.cgi?id=1160926
Introduce a 'managed' attribute to allow libvirt to decide whether to
delete a vHBA vport created via external means such as nodedev-create.
The code currently decides whether to delete the vHBA based solely on
whether the parent was provided at creation time. However, that may not
be the desired action, so rather than delete and force someone to create
another vHBA via an additional nodedev-create allow the configuration of
the storage pool to decide the desired action.
During createVport when libvirt does the VPORT_CREATE, set the managed
value to YES if not already set to indicate to the deleteVport code that
it should delete the vHBA when the pool is destroyed.
If libvirtd is restarted all the memory only state was lost, so for a
persistent storage pool, use the virStoragePoolSaveConfig in order to
write out the managed value.
Because we're now saving the current configuration, we need to be sure
to not save the parent in the output XML if it was undefined at start.
Saving the name would cause future starts to always use the same parent
which is not the expected result when not providing a parent. By not
providing a parent, libvirt is expected to find the best available
vHBA port for each subsequent (re)start.
At deleteVport, use the new managed value to decide whether to execute
the VPORT_DELETE. Since we no longer save the parent in memory or in
XML when provided, if it was not provided, then we have to look it up.
2014-11-10 16:19:51 +00:00
|
|
|
int managed; /* enum virTristateSwitch */
|
2013-03-25 16:43:36 +00:00
|
|
|
} fchost;
|
|
|
|
} data;
|
|
|
|
};
|
2008-02-20 15:34:52 +00:00
|
|
|
|
|
|
|
typedef struct _virStoragePoolSource virStoragePoolSource;
|
|
|
|
typedef virStoragePoolSource *virStoragePoolSourcePtr;
|
|
|
|
struct _virStoragePoolSource {
|
2012-04-25 10:43:09 +00:00
|
|
|
/* An optional (maybe multiple) host(s) */
|
|
|
|
size_t nhost;
|
|
|
|
virStoragePoolSourceHostPtr hosts;
|
2008-02-20 15:34:52 +00:00
|
|
|
|
|
|
|
/* And either one or more devices ... */
|
2014-03-11 08:13:15 +00:00
|
|
|
size_t ndevice;
|
2008-02-20 15:34:52 +00:00
|
|
|
virStoragePoolSourceDevicePtr devices;
|
|
|
|
|
|
|
|
/* Or a directory */
|
|
|
|
char *dir;
|
|
|
|
|
|
|
|
/* Or an adapter */
|
2013-03-25 16:43:36 +00:00
|
|
|
virStoragePoolSourceAdapter adapter;
|
2008-02-20 15:34:52 +00:00
|
|
|
|
2008-09-02 14:15:42 +00:00
|
|
|
/* Or a name */
|
|
|
|
char *name;
|
|
|
|
|
2010-01-21 11:50:52 +00:00
|
|
|
/* Initiator IQN */
|
|
|
|
virStoragePoolSourceInitiatorAttr initiator;
|
|
|
|
|
2014-06-26 12:18:09 +00:00
|
|
|
/* Authentication information */
|
|
|
|
virStorageAuthDefPtr auth;
|
2008-02-20 15:34:52 +00:00
|
|
|
|
2010-08-17 17:44:27 +00:00
|
|
|
/* Vendor of the source */
|
|
|
|
char *vendor;
|
|
|
|
|
|
|
|
/* Product name of the source*/
|
|
|
|
char *product;
|
|
|
|
|
2013-05-16 12:40:54 +00:00
|
|
|
/* Pool type specific format such as filesystem type,
|
|
|
|
* or lvm version, etc.
|
|
|
|
*/
|
|
|
|
int format;
|
2008-02-20 15:34:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct _virStoragePoolTarget virStoragePoolTarget;
|
|
|
|
typedef virStoragePoolTarget *virStoragePoolTargetPtr;
|
|
|
|
struct _virStoragePoolTarget {
|
2013-05-16 12:40:54 +00:00
|
|
|
char *path; /* Optional local filesystem mapping */
|
|
|
|
virStoragePerms perms; /* Default permissions for volumes */
|
2008-02-20 15:34:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct _virStoragePoolDef virStoragePoolDef;
|
|
|
|
typedef virStoragePoolDef *virStoragePoolDefPtr;
|
|
|
|
struct _virStoragePoolDef {
|
|
|
|
char *name;
|
|
|
|
unsigned char uuid[VIR_UUID_BUFLEN];
|
2014-05-11 15:08:50 +00:00
|
|
|
int type; /* virStoragePoolType */
|
2008-02-20 15:34:52 +00:00
|
|
|
|
2012-02-23 00:48:38 +00:00
|
|
|
unsigned long long allocation; /* bytes */
|
|
|
|
unsigned long long capacity; /* bytes */
|
|
|
|
unsigned long long available; /* bytes */
|
2008-02-20 15:34:52 +00:00
|
|
|
|
|
|
|
virStoragePoolSource source;
|
|
|
|
virStoragePoolTarget target;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct _virStoragePoolObj virStoragePoolObj;
|
|
|
|
typedef virStoragePoolObj *virStoragePoolObjPtr;
|
|
|
|
|
|
|
|
struct _virStoragePoolObj {
|
2009-01-15 19:56:05 +00:00
|
|
|
virMutex lock;
|
2008-12-04 22:00:14 +00:00
|
|
|
|
2008-02-20 15:34:52 +00:00
|
|
|
char *configFile;
|
|
|
|
char *autostartLink;
|
|
|
|
int active;
|
|
|
|
int autostart;
|
2009-04-17 19:12:37 +00:00
|
|
|
unsigned int asyncjobs;
|
2008-02-20 15:34:52 +00:00
|
|
|
|
|
|
|
virStoragePoolDefPtr def;
|
|
|
|
virStoragePoolDefPtr newDef;
|
|
|
|
|
2008-10-10 15:13:28 +00:00
|
|
|
virStorageVolDefList volumes;
|
|
|
|
};
|
2008-02-20 15:34:52 +00:00
|
|
|
|
2008-10-10 15:13:28 +00:00
|
|
|
typedef struct _virStoragePoolObjList virStoragePoolObjList;
|
|
|
|
typedef virStoragePoolObjList *virStoragePoolObjListPtr;
|
|
|
|
struct _virStoragePoolObjList {
|
2013-10-30 21:42:31 +00:00
|
|
|
size_t count;
|
2008-10-10 15:13:28 +00:00
|
|
|
virStoragePoolObjPtr *objs;
|
2008-02-20 15:34:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct _virStorageDriverState virStorageDriverState;
|
|
|
|
typedef virStorageDriverState *virStorageDriverStatePtr;
|
|
|
|
|
|
|
|
struct _virStorageDriverState {
|
2009-01-15 19:56:05 +00:00
|
|
|
virMutex lock;
|
2008-12-04 21:40:42 +00:00
|
|
|
|
2008-10-10 15:13:28 +00:00
|
|
|
virStoragePoolObjList pools;
|
|
|
|
|
2008-02-20 15:34:52 +00:00
|
|
|
char *configDir;
|
|
|
|
char *autostartDir;
|
2015-03-09 14:36:44 +00:00
|
|
|
char *stateDir;
|
2013-07-15 20:26:10 +00:00
|
|
|
bool privileged;
|
2008-02-20 15:34:52 +00:00
|
|
|
};
|
|
|
|
|
2008-10-23 11:39:53 +00:00
|
|
|
typedef struct _virStoragePoolSourceList virStoragePoolSourceList;
|
|
|
|
typedef virStoragePoolSourceList *virStoragePoolSourceListPtr;
|
|
|
|
struct _virStoragePoolSourceList {
|
2008-11-04 21:54:21 +00:00
|
|
|
int type;
|
2008-10-23 11:39:53 +00:00
|
|
|
unsigned int nsources;
|
|
|
|
virStoragePoolSourcePtr sources;
|
|
|
|
};
|
2008-02-20 15:34:52 +00:00
|
|
|
|
2013-06-26 17:47:48 +00:00
|
|
|
typedef bool (*virStoragePoolObjListFilter)(virConnectPtr conn,
|
|
|
|
virStoragePoolDefPtr def);
|
2008-11-17 11:19:33 +00:00
|
|
|
|
2013-05-16 12:40:54 +00:00
|
|
|
static inline int
|
|
|
|
virStoragePoolObjIsActive(virStoragePoolObjPtr pool)
|
|
|
|
{
|
2008-02-20 15:34:52 +00:00
|
|
|
return pool->active;
|
|
|
|
}
|
|
|
|
|
2010-02-10 11:42:56 +00:00
|
|
|
int virStoragePoolLoadAllConfigs(virStoragePoolObjListPtr pools,
|
2008-10-10 15:13:28 +00:00
|
|
|
const char *configDir,
|
|
|
|
const char *autostartDir);
|
2008-02-20 15:34:52 +00:00
|
|
|
|
2015-03-10 12:59:51 +00:00
|
|
|
int virStoragePoolLoadAllState(virStoragePoolObjListPtr pools,
|
|
|
|
const char *stateDir);
|
|
|
|
|
|
|
|
virStoragePoolObjPtr
|
|
|
|
virStoragePoolLoadState(virStoragePoolObjListPtr pools,
|
|
|
|
const char *stateDir,
|
|
|
|
const char *name);
|
2013-05-16 12:40:54 +00:00
|
|
|
virStoragePoolObjPtr
|
|
|
|
virStoragePoolObjFindByUUID(virStoragePoolObjListPtr pools,
|
|
|
|
const unsigned char *uuid);
|
|
|
|
virStoragePoolObjPtr
|
|
|
|
virStoragePoolObjFindByName(virStoragePoolObjListPtr pools,
|
|
|
|
const char *name);
|
|
|
|
virStoragePoolObjPtr
|
|
|
|
virStoragePoolSourceFindDuplicateDevices(virStoragePoolObjPtr pool,
|
|
|
|
virStoragePoolDefPtr def);
|
|
|
|
|
|
|
|
virStorageVolDefPtr
|
|
|
|
virStorageVolDefFindByKey(virStoragePoolObjPtr pool,
|
|
|
|
const char *key);
|
|
|
|
virStorageVolDefPtr
|
|
|
|
virStorageVolDefFindByPath(virStoragePoolObjPtr pool,
|
|
|
|
const char *path);
|
|
|
|
virStorageVolDefPtr
|
|
|
|
virStorageVolDefFindByName(virStoragePoolObjPtr pool,
|
|
|
|
const char *name);
|
2008-02-20 15:34:52 +00:00
|
|
|
|
|
|
|
void virStoragePoolObjClearVols(virStoragePoolObjPtr pool);
|
|
|
|
|
2010-02-10 11:42:56 +00:00
|
|
|
virStoragePoolDefPtr virStoragePoolDefParseString(const char *xml);
|
|
|
|
virStoragePoolDefPtr virStoragePoolDefParseFile(const char *filename);
|
|
|
|
virStoragePoolDefPtr virStoragePoolDefParseNode(xmlDocPtr xml,
|
2009-06-22 16:41:34 +00:00
|
|
|
xmlNodePtr root);
|
2010-02-10 11:42:56 +00:00
|
|
|
char *virStoragePoolDefFormat(virStoragePoolDefPtr def);
|
2008-02-20 15:34:52 +00:00
|
|
|
|
2015-02-17 15:47:04 +00:00
|
|
|
typedef enum {
|
|
|
|
/* do not require volume capacity at all */
|
|
|
|
VIR_VOL_XML_PARSE_NO_CAPACITY = 1 << 0,
|
2015-02-17 15:55:59 +00:00
|
|
|
/* do not require volume capacity if the volume has a backing store */
|
|
|
|
VIR_VOL_XML_PARSE_OPT_CAPACITY = 1 << 1,
|
2015-02-17 15:47:04 +00:00
|
|
|
} virStorageVolDefParseFlags;
|
2013-05-16 12:40:54 +00:00
|
|
|
virStorageVolDefPtr
|
|
|
|
virStorageVolDefParseString(virStoragePoolDefPtr pool,
|
2015-02-05 15:20:17 +00:00
|
|
|
const char *xml,
|
|
|
|
unsigned int flags);
|
2013-05-16 12:40:54 +00:00
|
|
|
virStorageVolDefPtr
|
|
|
|
virStorageVolDefParseFile(virStoragePoolDefPtr pool,
|
2015-02-05 15:20:17 +00:00
|
|
|
const char *filename,
|
|
|
|
unsigned int flags);
|
2013-05-16 12:40:54 +00:00
|
|
|
virStorageVolDefPtr
|
|
|
|
virStorageVolDefParseNode(virStoragePoolDefPtr pool,
|
|
|
|
xmlDocPtr xml,
|
2015-02-05 15:20:17 +00:00
|
|
|
xmlNodePtr root,
|
|
|
|
unsigned int flags);
|
2010-02-10 11:42:56 +00:00
|
|
|
char *virStorageVolDefFormat(virStoragePoolDefPtr pool,
|
2008-02-20 15:34:52 +00:00
|
|
|
virStorageVolDefPtr def);
|
|
|
|
|
2013-05-16 12:40:54 +00:00
|
|
|
virStoragePoolObjPtr
|
|
|
|
virStoragePoolObjAssignDef(virStoragePoolObjListPtr pools,
|
|
|
|
virStoragePoolDefPtr def);
|
2008-02-20 15:34:52 +00:00
|
|
|
|
2015-04-02 14:41:51 +00:00
|
|
|
int virStoragePoolSaveState(const char *stateFile,
|
|
|
|
virStoragePoolDefPtr def);
|
2015-04-03 08:41:04 +00:00
|
|
|
int virStoragePoolSaveConfig(const char *configFile,
|
2014-11-10 17:23:46 +00:00
|
|
|
virStoragePoolDefPtr def);
|
2010-02-10 11:42:56 +00:00
|
|
|
int virStoragePoolObjSaveDef(virStorageDriverStatePtr driver,
|
2008-02-20 15:34:52 +00:00
|
|
|
virStoragePoolObjPtr pool,
|
|
|
|
virStoragePoolDefPtr def);
|
2010-02-10 11:42:56 +00:00
|
|
|
int virStoragePoolObjDeleteDef(virStoragePoolObjPtr pool);
|
2008-02-20 15:34:52 +00:00
|
|
|
|
|
|
|
void virStorageVolDefFree(virStorageVolDefPtr def);
|
2011-10-21 22:44:52 +00:00
|
|
|
void virStoragePoolSourceClear(virStoragePoolSourcePtr source);
|
2014-03-11 07:44:22 +00:00
|
|
|
void virStoragePoolSourceDeviceClear(virStoragePoolSourceDevicePtr dev);
|
2008-10-23 11:39:53 +00:00
|
|
|
void virStoragePoolSourceFree(virStoragePoolSourcePtr source);
|
2008-02-20 15:34:52 +00:00
|
|
|
void virStoragePoolDefFree(virStoragePoolDefPtr def);
|
|
|
|
void virStoragePoolObjFree(virStoragePoolObjPtr pool);
|
2008-10-10 15:13:28 +00:00
|
|
|
void virStoragePoolObjListFree(virStoragePoolObjListPtr pools);
|
|
|
|
void virStoragePoolObjRemove(virStoragePoolObjListPtr pools,
|
2008-02-20 15:34:52 +00:00
|
|
|
virStoragePoolObjPtr pool);
|
|
|
|
|
2009-10-15 15:41:53 +00:00
|
|
|
virStoragePoolSourcePtr
|
2010-02-10 11:42:56 +00:00
|
|
|
virStoragePoolDefParseSourceString(const char *srcSpec,
|
2009-10-15 15:58:35 +00:00
|
|
|
int pool_type);
|
|
|
|
virStoragePoolSourcePtr
|
2010-02-10 11:42:56 +00:00
|
|
|
virStoragePoolSourceListNewSource(virStoragePoolSourceListPtr list);
|
|
|
|
char *virStoragePoolSourceListFormat(virStoragePoolSourceListPtr def);
|
2008-11-17 11:19:33 +00:00
|
|
|
|
2010-05-27 11:41:30 +00:00
|
|
|
int virStoragePoolObjIsDuplicate(virStoragePoolObjListPtr pools,
|
|
|
|
virStoragePoolDefPtr def,
|
|
|
|
unsigned int check_active);
|
|
|
|
|
2014-11-17 13:40:59 +00:00
|
|
|
char *virStoragePoolGetVhbaSCSIHostParent(virConnectPtr conn,
|
|
|
|
const char *name)
|
|
|
|
ATTRIBUTE_NONNULL(1);
|
|
|
|
|
2014-11-14 14:50:59 +00:00
|
|
|
int virStoragePoolSourceFindDuplicate(virConnectPtr conn,
|
|
|
|
virStoragePoolObjListPtr pools,
|
2011-09-05 07:52:03 +00:00
|
|
|
virStoragePoolDefPtr def);
|
|
|
|
|
2008-12-04 20:53:20 +00:00
|
|
|
void virStoragePoolObjLock(virStoragePoolObjPtr obj);
|
|
|
|
void virStoragePoolObjUnlock(virStoragePoolObjPtr obj);
|
|
|
|
|
2008-11-17 11:19:33 +00:00
|
|
|
|
2014-05-11 15:08:50 +00:00
|
|
|
typedef enum {
|
2008-11-17 11:19:33 +00:00
|
|
|
VIR_STORAGE_POOL_FS_AUTO = 0,
|
|
|
|
VIR_STORAGE_POOL_FS_EXT2,
|
|
|
|
VIR_STORAGE_POOL_FS_EXT3,
|
|
|
|
VIR_STORAGE_POOL_FS_EXT4,
|
|
|
|
VIR_STORAGE_POOL_FS_UFS,
|
|
|
|
VIR_STORAGE_POOL_FS_ISO,
|
|
|
|
VIR_STORAGE_POOL_FS_UDF,
|
|
|
|
VIR_STORAGE_POOL_FS_GFS,
|
|
|
|
VIR_STORAGE_POOL_FS_GFS2,
|
|
|
|
VIR_STORAGE_POOL_FS_VFAT,
|
|
|
|
VIR_STORAGE_POOL_FS_HFSPLUS,
|
|
|
|
VIR_STORAGE_POOL_FS_XFS,
|
2009-10-14 15:03:22 +00:00
|
|
|
VIR_STORAGE_POOL_FS_OCFS2,
|
2008-11-17 11:19:33 +00:00
|
|
|
VIR_STORAGE_POOL_FS_LAST,
|
2014-05-11 15:08:50 +00:00
|
|
|
} virStoragePoolFormatFileSystem;
|
2008-12-17 21:09:44 +00:00
|
|
|
VIR_ENUM_DECL(virStoragePoolFormatFileSystem)
|
2008-11-17 11:19:33 +00:00
|
|
|
|
2014-05-11 15:08:50 +00:00
|
|
|
typedef enum {
|
2008-11-17 11:19:33 +00:00
|
|
|
VIR_STORAGE_POOL_NETFS_AUTO = 0,
|
|
|
|
VIR_STORAGE_POOL_NETFS_NFS,
|
2009-07-08 09:46:25 +00:00
|
|
|
VIR_STORAGE_POOL_NETFS_GLUSTERFS,
|
2010-05-17 23:24:32 +00:00
|
|
|
VIR_STORAGE_POOL_NETFS_CIFS,
|
2008-11-17 11:19:33 +00:00
|
|
|
VIR_STORAGE_POOL_NETFS_LAST,
|
2014-05-11 15:08:50 +00:00
|
|
|
} virStoragePoolFormatFileSystemNet;
|
2008-12-17 21:09:44 +00:00
|
|
|
VIR_ENUM_DECL(virStoragePoolFormatFileSystemNet)
|
2008-11-17 11:19:33 +00:00
|
|
|
|
2014-05-11 15:08:50 +00:00
|
|
|
typedef enum {
|
2008-11-17 11:19:33 +00:00
|
|
|
VIR_STORAGE_POOL_DISK_UNKNOWN = 0,
|
|
|
|
VIR_STORAGE_POOL_DISK_DOS = 1,
|
|
|
|
VIR_STORAGE_POOL_DISK_DVH,
|
|
|
|
VIR_STORAGE_POOL_DISK_GPT,
|
|
|
|
VIR_STORAGE_POOL_DISK_MAC,
|
|
|
|
VIR_STORAGE_POOL_DISK_BSD,
|
|
|
|
VIR_STORAGE_POOL_DISK_PC98,
|
|
|
|
VIR_STORAGE_POOL_DISK_SUN,
|
|
|
|
VIR_STORAGE_POOL_DISK_LVM2,
|
|
|
|
VIR_STORAGE_POOL_DISK_LAST,
|
2014-05-11 15:08:50 +00:00
|
|
|
} virStoragePoolFormatDisk;
|
2008-12-17 21:09:44 +00:00
|
|
|
VIR_ENUM_DECL(virStoragePoolFormatDisk)
|
2008-11-17 11:19:33 +00:00
|
|
|
|
2014-05-11 15:08:50 +00:00
|
|
|
typedef enum {
|
2008-11-17 11:19:33 +00:00
|
|
|
VIR_STORAGE_POOL_LOGICAL_UNKNOWN = 0,
|
|
|
|
VIR_STORAGE_POOL_LOGICAL_LVM2 = 1,
|
|
|
|
VIR_STORAGE_POOL_LOGICAL_LAST,
|
2014-05-11 15:08:50 +00:00
|
|
|
} virStoragePoolFormatLogical;
|
2008-12-17 21:09:44 +00:00
|
|
|
VIR_ENUM_DECL(virStoragePoolFormatLogical)
|
2008-11-17 11:19:33 +00:00
|
|
|
|
|
|
|
/*
|
2013-05-16 12:40:54 +00:00
|
|
|
* XXX: these are basically partition types.
|
2008-11-17 11:19:33 +00:00
|
|
|
*
|
2013-05-16 12:40:54 +00:00
|
|
|
* fdisk has a bazillion partition ID types parted has
|
|
|
|
* practically none, and splits the * info across 3
|
|
|
|
* different attributes.
|
2008-11-17 11:19:33 +00:00
|
|
|
*
|
|
|
|
* So this is a semi-generic set
|
|
|
|
*/
|
2014-05-11 15:08:50 +00:00
|
|
|
typedef enum {
|
2008-11-17 11:19:33 +00:00
|
|
|
VIR_STORAGE_VOL_DISK_NONE = 0,
|
|
|
|
VIR_STORAGE_VOL_DISK_LINUX,
|
|
|
|
VIR_STORAGE_VOL_DISK_FAT16,
|
|
|
|
VIR_STORAGE_VOL_DISK_FAT32,
|
|
|
|
VIR_STORAGE_VOL_DISK_LINUX_SWAP,
|
|
|
|
VIR_STORAGE_VOL_DISK_LINUX_LVM,
|
|
|
|
VIR_STORAGE_VOL_DISK_LINUX_RAID,
|
|
|
|
VIR_STORAGE_VOL_DISK_EXTENDED,
|
|
|
|
VIR_STORAGE_VOL_DISK_LAST,
|
2014-05-11 15:08:50 +00:00
|
|
|
} virStorageVolFormatDisk;
|
2008-12-17 21:09:44 +00:00
|
|
|
VIR_ENUM_DECL(virStorageVolFormatDisk)
|
2008-11-17 11:19:33 +00:00
|
|
|
|
2014-05-11 15:08:50 +00:00
|
|
|
typedef enum {
|
2009-06-26 16:18:59 +00:00
|
|
|
VIR_STORAGE_VOL_DISK_TYPE_NONE = 0,
|
|
|
|
VIR_STORAGE_VOL_DISK_TYPE_PRIMARY,
|
|
|
|
VIR_STORAGE_VOL_DISK_TYPE_LOGICAL,
|
|
|
|
VIR_STORAGE_VOL_DISK_TYPE_EXTENDED,
|
|
|
|
VIR_STORAGE_VOL_DISK_TYPE_LAST,
|
2014-05-11 15:08:50 +00:00
|
|
|
} virStorageVolTypeDisk;
|
2008-11-17 11:19:33 +00:00
|
|
|
|
2009-06-26 16:18:59 +00:00
|
|
|
/*
|
2013-05-16 12:40:54 +00:00
|
|
|
* Mapping of Parted fs-types MUST be kept in the
|
|
|
|
* same order as virStorageVolFormatDisk
|
2009-06-26 16:18:59 +00:00
|
|
|
*/
|
2014-05-11 15:08:50 +00:00
|
|
|
typedef enum {
|
2009-06-26 16:18:59 +00:00
|
|
|
VIR_STORAGE_PARTED_FS_TYPE_NONE = 0,
|
|
|
|
VIR_STORAGE_PARTED_FS_TYPE_LINUX,
|
|
|
|
VIR_STORAGE_PARTED_FS_TYPE_FAT16,
|
|
|
|
VIR_STORAGE_PARTED_FS_TYPE_FAT32,
|
|
|
|
VIR_STORAGE_PARTED_FS_TYPE_LINUX_SWAP,
|
|
|
|
VIR_STORAGE_PARTED_FS_TYPE_LINUX_LVM,
|
|
|
|
VIR_STORAGE_PARTED_FS_TYPE_LINUX_RAID,
|
|
|
|
VIR_STORAGE_PARTED_FS_TYPE_EXTENDED,
|
|
|
|
VIR_STORAGE_PARTED_FS_TYPE_LAST,
|
2014-05-11 15:08:50 +00:00
|
|
|
} virStoragePartedFsType;
|
2014-05-14 19:48:15 +00:00
|
|
|
VIR_ENUM_DECL(virStoragePartedFs)
|
2008-11-17 11:19:33 +00:00
|
|
|
|
2012-09-04 15:16:25 +00:00
|
|
|
# define VIR_CONNECT_LIST_STORAGE_POOLS_FILTERS_ACTIVE \
|
|
|
|
(VIR_CONNECT_LIST_STORAGE_POOLS_ACTIVE | \
|
|
|
|
VIR_CONNECT_LIST_STORAGE_POOLS_INACTIVE)
|
|
|
|
|
|
|
|
# define VIR_CONNECT_LIST_STORAGE_POOLS_FILTERS_PERSISTENT \
|
|
|
|
(VIR_CONNECT_LIST_STORAGE_POOLS_PERSISTENT | \
|
|
|
|
VIR_CONNECT_LIST_STORAGE_POOLS_TRANSIENT)
|
|
|
|
|
|
|
|
# define VIR_CONNECT_LIST_STORAGE_POOLS_FILTERS_AUTOSTART \
|
|
|
|
(VIR_CONNECT_LIST_STORAGE_POOLS_AUTOSTART | \
|
|
|
|
VIR_CONNECT_LIST_STORAGE_POOLS_NO_AUTOSTART)
|
|
|
|
|
|
|
|
# define VIR_CONNECT_LIST_STORAGE_POOLS_FILTERS_POOL_TYPE \
|
|
|
|
(VIR_CONNECT_LIST_STORAGE_POOLS_DIR | \
|
|
|
|
VIR_CONNECT_LIST_STORAGE_POOLS_FS | \
|
|
|
|
VIR_CONNECT_LIST_STORAGE_POOLS_NETFS | \
|
|
|
|
VIR_CONNECT_LIST_STORAGE_POOLS_LOGICAL | \
|
|
|
|
VIR_CONNECT_LIST_STORAGE_POOLS_DISK | \
|
|
|
|
VIR_CONNECT_LIST_STORAGE_POOLS_ISCSI | \
|
|
|
|
VIR_CONNECT_LIST_STORAGE_POOLS_SCSI | \
|
|
|
|
VIR_CONNECT_LIST_STORAGE_POOLS_MPATH | \
|
|
|
|
VIR_CONNECT_LIST_STORAGE_POOLS_RBD | \
|
2014-02-06 15:12:14 +00:00
|
|
|
VIR_CONNECT_LIST_STORAGE_POOLS_SHEEPDOG | \
|
2014-07-21 14:38:42 +00:00
|
|
|
VIR_CONNECT_LIST_STORAGE_POOLS_GLUSTER | \
|
|
|
|
VIR_CONNECT_LIST_STORAGE_POOLS_ZFS)
|
2012-09-04 15:16:25 +00:00
|
|
|
|
|
|
|
# define VIR_CONNECT_LIST_STORAGE_POOLS_FILTERS_ALL \
|
|
|
|
(VIR_CONNECT_LIST_STORAGE_POOLS_FILTERS_ACTIVE | \
|
|
|
|
VIR_CONNECT_LIST_STORAGE_POOLS_FILTERS_PERSISTENT | \
|
|
|
|
VIR_CONNECT_LIST_STORAGE_POOLS_FILTERS_AUTOSTART | \
|
|
|
|
VIR_CONNECT_LIST_STORAGE_POOLS_FILTERS_POOL_TYPE)
|
|
|
|
|
2013-06-26 17:47:48 +00:00
|
|
|
int virStoragePoolObjListExport(virConnectPtr conn,
|
|
|
|
virStoragePoolObjList poolobjs,
|
|
|
|
virStoragePoolPtr **pools,
|
|
|
|
virStoragePoolObjListFilter filter,
|
|
|
|
unsigned int flags);
|
2012-09-04 15:16:25 +00:00
|
|
|
|
2008-10-23 11:39:53 +00:00
|
|
|
#endif /* __VIR_STORAGE_CONF_H__ */
|