Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy(a)virtuozzo.com>
---
include/libvirt/virterror.h | 8 +
po/POTFILES.in | 1 +
src/Makefile.am | 3 +
src/datatypes.c | 154 ++++
src/datatypes.h | 94 +++
src/driver-fs.h | 210 ++++++
src/driver.h | 1 +
src/libvirt-fs.c | 1715 +++++++++++++++++++++++++++++++++++++++++++
src/libvirt_private.syms | 4 +
src/libvirt_public.syms | 46 ++
src/util/virerror.c | 37 +
11 files changed, 2273 insertions(+)
create mode 100644 src/driver-fs.h
create mode 100644 src/libvirt-fs.c
diff --git a/include/libvirt/virterror.h b/include/libvirt/virterror.h
index 2ec560e..39cddca 100644
--- a/include/libvirt/virterror.h
+++ b/include/libvirt/virterror.h
@@ -132,6 +132,8 @@ typedef enum {
VIR_FROM_PERF = 65, /* Error from perf */
+ VIR_FROM_FSPOOL = 66, /* Error from fs pool */
+
# ifdef VIR_ENUM_SENTINELS
VIR_ERR_DOMAIN_LAST
# endif
@@ -315,6 +317,12 @@ typedef enum {
VIR_ERR_AUTH_UNAVAILABLE = 94, /* authentication unavailable */
VIR_ERR_NO_SERVER = 95, /* Server was not found */
VIR_ERR_NO_CLIENT = 96, /* Client was not found */
+ VIR_ERR_INVALID_FS_POOL = 97, /* invalid fspool object */
+ VIR_ERR_INVALID_FS_ITEM = 98, /* invalid fspool object */
+ VIR_WAR_NO_FS_POOL = 99, /* failed to start fspool */
+ VIR_ERR_NO_FS_POOL = 100, /* fspool not found */
+ VIR_ERR_NO_FS_ITEM = 101, /* fstem not found */
+ VIR_ERR_FS_ITEM_EXIST = 102, /* fspool item already exists */
} virErrorNumber;
/**
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 25dbc84..af00155 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -67,6 +67,7 @@ src/internal.h
src/libvirt-admin.c
src/libvirt-domain-snapshot.c
src/libvirt-domain.c
+src/libvirt-fs.c
src/libvirt-host.c
src/libvirt-lxc.c
src/libvirt-network.c
diff --git a/src/Makefile.am b/src/Makefile.am
index e2a2128..8fc6582 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -209,6 +209,7 @@ DRIVER_SOURCES = \
driver-secret.h \
driver-state.h \
driver-storage.h \
+ driver-fs.h \
driver-stream.h \
internal.h \
$(DATATYPES_SOURCES) \
@@ -225,6 +226,7 @@ DRIVER_SOURCES = \
libvirt-secret.c \
libvirt-storage.c \
libvirt-stream.c \
+ libvirt-fs.c \
locking/lock_manager.c locking/lock_manager.h \
locking/lock_driver.h \
locking/lock_driver_nop.h locking/lock_driver_nop.c \
@@ -2401,6 +2403,7 @@ libvirt_setuid_rpc_client_la_SOURCES = \
libvirt-storage.c \
libvirt-stream.c \
libvirt-lxc.c \
+ libvirt-fs.c \
$(NULL)
libvirt_setuid_rpc_client_la_LDFLAGS = \
diff --git a/src/datatypes.c b/src/datatypes.c
index ff0c46f..465a8bf 100644
--- a/src/datatypes.c
+++ b/src/datatypes.c
@@ -45,6 +45,8 @@ virClassPtr virSecretClass;
virClassPtr virStreamClass;
virClassPtr virStorageVolClass;
virClassPtr virStoragePoolClass;
+virClassPtr virFsPoolClass;
+virClassPtr virFsItemClass;
static void virConnectDispose(void *obj);
static void virConnectCloseCallbackDataDispose(void *obj);
@@ -58,6 +60,8 @@ static void virSecretDispose(void *obj);
static void virStreamDispose(void *obj);
static void virStorageVolDispose(void *obj);
static void virStoragePoolDispose(void *obj);
+static void virFsItemDispose(void *obj);
+static void virFsPoolDispose(void *obj);
virClassPtr virAdmConnectClass;
virClassPtr virAdmConnectCloseCallbackDataClass;
@@ -96,6 +100,8 @@ virDataTypesOnceInit(void)
DECLARE_CLASS(virStream);
DECLARE_CLASS(virStorageVol);
DECLARE_CLASS(virStoragePool);
+ DECLARE_CLASS(virFsItem);
+ DECLARE_CLASS(virFsPool);
DECLARE_CLASS_LOCKABLE(virAdmConnect);
DECLARE_CLASS_LOCKABLE(virAdmConnectCloseCallbackData);
@@ -597,7 +603,155 @@ virStorageVolDispose(void *obj)
virObjectUnref(vol->conn);
}
+/**
+ * virGetFsPool:
+ * @conn: the hypervisor connection
+ * @name: pointer to the fs pool name
+ * @uuid: pointer to the uuid
+ * @privateData: pointer to driver specific private data
+ * @freeFunc: private data cleanup function pointer specific to driver
+ *
+ * Allocates a new storage pool object. When the object is no longer needed,
+ * virObjectUnref() must be called in order to not leak data.
+ *
+ * Returns a pointer to the storage pool object, or NULL on error.
+ */
+virFsPoolPtr
+virGetFsPool(virConnectPtr conn, const char *name,
+ const unsigned char *uuid,
+ void *privateData, virFreeCallback freeFunc)
+{
+ virFsPoolPtr ret = NULL;
+
+ if (virDataTypesInitialize() < 0)
+ return NULL;
+
+ virCheckConnectGoto(conn, error);
+ virCheckNonNullArgGoto(name, error);
+ virCheckNonNullArgGoto(uuid, error);
+
+ if (!(ret = virObjectNew(virFsPoolClass)))
+ goto error;
+
+ if (VIR_STRDUP(ret->name, name) < 0)
+ goto error;
+
+ ret->conn = virObjectRef(conn);
+ memcpy(&(ret->uuid[0]), uuid, VIR_UUID_BUFLEN);
+
+ /* set the driver specific data */
+ ret->privateData = privateData;
+ ret->privateDataFreeFunc = freeFunc;
+
+ return ret;
+
+ error:
+ virObjectUnref(ret);
+ return NULL;
+}
+
+
+/**
+ * virFsPoolDispose:
+ * @obj: the fs pool to release
+ *
+ * Unconditionally release all memory associated with fs pool.
+ * The pool object must not be used once this method returns.
+ *
+ * It will also unreference the associated connection object,
+ * which may also be released if its ref count hits zero.
+ */
+static void
+virFsPoolDispose(void *obj)
+{
+ virFsPoolPtr fspool = obj;
+ char uuidstr[VIR_UUID_STRING_BUFLEN];
+
+ virUUIDFormat(fspool->uuid, uuidstr);
+ VIR_DEBUG("release fs pool %p %s %s", fspool, fspool->name, uuidstr);
+
+ if (fspool->privateDataFreeFunc)
+ fspool->privateDataFreeFunc(fspool->privateData);
+ VIR_FREE(fspool->name);
+ virObjectUnref(fspool->conn);
+}
+
+
+/**
+ * virGetFsItem:
+ * @conn: the hypervisor connection
+ * @pool: fspool owning the item
+ * @name: pointer to the fsitem name
+ * @key: pointer to unique key of the fsitem
+ * @privateData: pointer to driver specific private data
+ * @freeFunc: private data cleanup function pointer specific to driver
+ *
+ * Allocates a new fsitem object. When the object is no longer needed,
+ * virObjectUnref() must be called in order to not leak data.
+ *
+ * Returns a pointer to the fsitem object, or NULL on error.
+ */
+virFsItemPtr
+virGetFsItem(virConnectPtr conn, const char *fspool, const char *name,
+ const char *key, void *privateData, virFreeCallback freeFunc)
+{
+ virFsItemPtr ret = NULL;
+
+ if (virDataTypesInitialize() < 0)
+ return NULL;
+
+ virCheckConnectGoto(conn, error);
+ virCheckNonNullArgGoto(fspool, error);
+ virCheckNonNullArgGoto(name, error);
+ virCheckNonNullArgGoto(key, error);
+
+ if (!(ret = virObjectNew(virFsItemClass)))
+ goto error;
+
+ if (VIR_STRDUP(ret->fspool, fspool) < 0 ||
+ VIR_STRDUP(ret->name, name) < 0 ||
+ VIR_STRDUP(ret->key, key) < 0)
+ goto error;
+
+ ret->conn = virObjectRef(conn);
+
+ /* set driver specific data */
+ ret->privateData = privateData;
+ ret->privateDataFreeFunc = freeFunc;
+
+ return ret;
+
+ error:
+ virObjectUnref(ret);
+ return NULL;
+}
+
+
+/**
+ * virFsItemDispose:
+ * @obj: the fsitem to release
+ *
+ * Unconditionally release all memory associated with a fsitem.
+ * The fsitem object must not be used once this method returns.
+ *
+ * It will also unreference the associated connection object,
+ * which may also be released if its ref count hits zero.
+ */
+static void
+virFsItemDispose(void *obj)
+{
+ virFsItemPtr fsitem = obj;
+ VIR_DEBUG("release vol %p %s", fsitem, fsitem->name);
+
+ if (fsitem->privateDataFreeFunc)
+ fsitem->privateDataFreeFunc(fsitem->privateData);
+
+ VIR_FREE(fsitem->key);
+ VIR_FREE(fsitem->name);
+ VIR_FREE(fsitem->fspool);
+ virObjectUnref(fsitem->conn);
+}
/**
* virGetNodeDevice:
* @conn: the hypervisor connection
diff --git a/src/datatypes.h b/src/datatypes.h
index 2b6adb4..6f1f11b 100644
--- a/src/datatypes.h
+++ b/src/datatypes.h
@@ -40,6 +40,8 @@ extern virClassPtr virSecretClass;
extern virClassPtr virStreamClass;
extern virClassPtr virStorageVolClass;
extern virClassPtr virStoragePoolClass;
+extern virClassPtr virFsItemClass;
+extern virClassPtr virFsPoolClass;
extern virClassPtr virAdmConnectClass;
extern virClassPtr virAdmServerClass;
@@ -182,6 +184,46 @@ extern virClassPtr virAdmClientClass;
} \
} while (0)
+# define virCheckFsPoolReturn(obj, retval) \
+ do { \
+ virFsPoolPtr _pool = (obj); \
+ if (!virObjectIsClass(_pool, virFsPoolClass) || \
+ !virObjectIsClass(_pool->conn, virConnectClass)) { \
+ virReportErrorHelper(VIR_FROM_FSPOOL, \
+ VIR_ERR_INVALID_FS_POOL, \
+ __FILE__, __FUNCTION__, __LINE__, \
+ __FUNCTION__); \
+ virDispatchError(NULL); \
+ return retval; \
+ } \
+ } while (0)
+
+# define virCheckFsItemReturn(obj, retval) \
+ do { \
+ virFsItemPtr _item = (obj); \
+ if (!virObjectIsClass(_item, virFsItemClass) || \
+ !virObjectIsClass(_item->conn, virConnectClass)) { \
+ virReportErrorHelper(VIR_FROM_FSPOOL, \
+ VIR_ERR_INVALID_FS_ITEM, \
+ __FILE__, __FUNCTION__, __LINE__, \
+ __FUNCTION__); \
+ virDispatchError(NULL); \
+ return retval; \
+ } \
+ } while (0)
+# define virCheckFsItemGoto(obj, label) \
+ do { \
+ virFsItemPtr _item = (obj); \
+ if (!virObjectIsClass(_item, virFsItemClass) || \
+ !virObjectIsClass(_item->conn, virConnectClass)) { \
+ virReportErrorHelper(VIR_FROM_FSPOOL, \
+ VIR_ERR_INVALID_FS_ITEM, \
+ __FILE__, __FUNCTION__, __LINE__, \
+ __FUNCTION__); \
+ goto label; \
+ } \
+ } while (0)
+
# define virCheckNodeDeviceReturn(obj, retval) \
do { \
virNodeDevicePtr _node = (obj); \
@@ -457,6 +499,7 @@ struct _virConnect {
virNodeDeviceDriverPtr nodeDeviceDriver;
virSecretDriverPtr secretDriver;
virNWFilterDriverPtr nwfilterDriver;
+ virFsDriverPtr fsDriver;
/* Private data pointer which can be used by driver and
* network driver as they wish.
@@ -596,6 +639,45 @@ struct _virStorageVol {
};
/**
+* _virFsPool:
+*
+* Internal structure associated to a fs pool
+*/
+struct _virFsPool {
+ virObject object;
+ virConnectPtr conn; /* pointer back to the connection */
+ char *name; /* the storage pool external name */
+ unsigned char uuid[VIR_UUID_BUFLEN]; /* the storage pool unique identifier */
+
+ /* Private data pointer which can be used by driver as they wish.
+ * Cleanup function pointer can be hooked to provide custom cleanup
+ * operation.
+ */
+ void *privateData;
+ virFreeCallback privateDataFreeFunc;
+};
+
+/**
+* _virFsItem:
+*
+* Internal structure associated to a fs pool item
+*/
+struct _virFsItem {
+ virObject object;
+ virConnectPtr conn; /* pointer back to the connection */
+ char *fspool; /* Pool name of owner */
+ char *name; /* the storage vol external name */
+ char *key; /* unique key for storage vol */
+
+ /* Private data pointer which can be used by driver as they wish.
+ * Cleanup function pointer can be hooked to provide custom cleanup
+ * operation.
+ */
+ void *privateData;
+ virFreeCallback privateDataFreeFunc;
+};
+
+/**
* _virNodeDevice:
*
* Internal structure associated with a node device
@@ -687,6 +769,18 @@ virStorageVolPtr virGetStorageVol(virConnectPtr conn,
const char *key,
void *privateData,
virFreeCallback freeFunc);
+virFsPoolPtr virGetFsPool(virConnectPtr conn,
+ const char *name,
+ const unsigned char *uuid,
+ void *privateData,
+ virFreeCallback freeFunc);
+virFsItemPtr virGetFsItem(virConnectPtr conn,
+ const char *pool,
+ const char *name,
+ const char *key,
+ void *privateData,
+ virFreeCallback freeFunc);
+
virNodeDevicePtr virGetNodeDevice(virConnectPtr conn,
const char *name);
virSecretPtr virGetSecret(virConnectPtr conn,
diff --git a/src/driver-fs.h b/src/driver-fs.h
new file mode 100644
index 0000000..1aecb3c
--- /dev/null
+++ b/src/driver-fs.h
@@ -0,0 +1,210 @@
+/*
+ * driver-fs.h: entry points for fs drivers
+ *
+ *
+ * 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/>.
+ */
+
+#ifndef __VIR_DRIVER_FS_H__
+# define __VIR_DRIVER_FS_H__
+
+# ifndef __VIR_DRIVER_H_INCLUDES___
+# error "Don't include this file directly, only use driver.h"
+# endif
+
+typedef int
+(*virDrvConnectNumOfFsPools)(virConnectPtr conn);
+
+typedef int
+(*virDrvConnectListFsPools)(virConnectPtr conn,
+ char **const names,
+ int maxnames);
+
+typedef int
+(*virDrvConnectNumOfDefinedFsPools)(virConnectPtr conn);
+
+typedef int
+(*virDrvConnectListDefinedFsPools)(virConnectPtr conn,
+ char **const names,
+ int maxnames);
+
+typedef int
+(*virDrvConnectListAllFsPools)(virConnectPtr conn,
+ virFsPoolPtr **pools,
+ unsigned int flags);
+
+typedef virFsPoolPtr
+(*virDrvFsPoolLookupByName)(virConnectPtr conn,
+ const char *name);
+
+typedef virFsPoolPtr
+(*virDrvFsPoolLookupByUUID)(virConnectPtr conn,
+ const unsigned char *uuid);
+typedef virFsPoolPtr
+(*virDrvFsPoolLookupByItem)(virFsItemPtr item);
+
+typedef virFsPoolPtr
+(*virDrvFsPoolCreateXML)(virConnectPtr conn,
+ const char *xmlDesc,
+ unsigned int flags);
+
+typedef virFsPoolPtr
+(*virDrvFsPoolDefineXML)(virConnectPtr conn,
+ const char *xmlDesc,
+ unsigned int flags);
+
+typedef int
+(*virDrvFsPoolUndefine)(virFsPoolPtr fspool);
+
+typedef int
+(*virDrvFsPoolBuild)(virFsPoolPtr fspool,
+ unsigned int flags);
+
+typedef int
+(*virDrvFsPoolCreate)(virFsPoolPtr fspool,
+ unsigned int flags);
+typedef int
+(*virDrvFsPoolDestroy)(virFsPoolPtr fspool);
+typedef int
+(*virDrvFsPoolRefresh)(virFsPoolPtr fspool,
+ unsigned int flags);
+
+typedef int
+(*virDrvFsPoolDelete)(virFsPoolPtr fspool,
+ unsigned int flags);
+
+typedef int
+(*virDrvFsPoolGetInfo)(virFsPoolPtr item,
+ virFsPoolInfoPtr info);
+
+typedef char *
+(*virDrvFsPoolGetXMLDesc)(virFsPoolPtr fspool,
+ unsigned int flags);
+typedef int
+(*virDrvFsPoolGetAutostart)(virFsPoolPtr fspool,
+ int *autostart);
+typedef int
+(*virDrvFsPoolSetAutostart)(virFsPoolPtr fspool,
+ int autostart);
+
+typedef int
+(*virDrvFsPoolNumOfItems)(virFsPoolPtr fspool);
+
+typedef int
+(*virDrvFsPoolListItems)(virFsPoolPtr fspool,
+ char **const names,
+ int maxnames);
+
+typedef int
+(*virDrvFsPoolListAllItems)(virFsPoolPtr fspool,
+ virFsItemPtr **items,
+ unsigned int flags);
+
+typedef virFsItemPtr
+(*virDrvFsItemLookupByName)(virFsPoolPtr fspool,
+ const char *name);
+
+typedef virFsItemPtr
+(*virDrvFsItemLookupByKey)(virConnectPtr fspool,
+ const char *key);
+
+typedef virFsItemPtr
+(*virDrvFsItemLookupByPath)(virConnectPtr fspool,
+ const char *path);
+
+typedef virFsItemPtr
+(*virDrvFsItemCreateXML)(virFsPoolPtr fspool,
+ const char *xmldesc,
+ unsigned int flags);
+
+typedef int
+(*virDrvFsItemDelete)(virFsItemPtr item,
+ unsigned int flags);
+
+
+typedef int
+(*virDrvFsItemGetInfo)(virFsItemPtr item,
+ virFsItemInfoPtr info);
+
+typedef char *
+(*virDrvFsItemGetXMLDesc)(virFsItemPtr fspool,
+ unsigned int flags);
+
+typedef char *
+(*virDrvFsItemGetPath)(virFsItemPtr item);
+
+typedef virFsItemPtr
+(*virDrvFsItemCreateXMLFrom)(virFsPoolPtr fspool,
+ const char *xmldesc,
+ virFsItemPtr cloneitem,
+ unsigned int flags);
+
+typedef struct _virFsDriver virFsDriver;
+typedef virFsDriver *virFsDriverPtr;
+
+typedef int
+(*virDrvFsPoolIsActive)(virFsPoolPtr fspool);
+
+typedef int
+(*virDrvFsPoolIsPersistent)(virFsPoolPtr fspool);
+
+
+
+/**
+ * _virFsDriver:
+ *
+ * Structure associated to a storage driver, defining the various
+ * entry points for it.
+ */
+struct _virFsDriver {
+ const char *name; /* the name of the driver */
+ virDrvConnectNumOfFsPools connectNumOfFsPools;
+ virDrvConnectListFsPools connectListFsPools;
+ virDrvConnectNumOfDefinedFsPools connectNumOfDefinedFsPools;
+ virDrvConnectListDefinedFsPools connectListDefinedFsPools;
+ virDrvConnectListAllFsPools connectListAllFsPools;
+ virDrvFsPoolLookupByName fsPoolLookupByName;
+ virDrvFsPoolLookupByUUID fsPoolLookupByUUID;
+ virDrvFsPoolLookupByItem fsPoolLookupByItem;
+ virDrvFsPoolCreateXML fsPoolCreateXML;
+ virDrvFsPoolDefineXML fsPoolDefineXML;
+ virDrvFsPoolBuild fsPoolBuild;
+ virDrvFsPoolUndefine fsPoolUndefine;
+ virDrvFsPoolCreate fsPoolCreate;
+ virDrvFsPoolDestroy fsPoolDestroy;
+ virDrvFsPoolDelete fsPoolDelete;
+ virDrvFsPoolRefresh fsPoolRefresh;
+ virDrvFsPoolGetInfo fsPoolGetInfo;
+ virDrvFsPoolGetXMLDesc fsPoolGetXMLDesc;
+ virDrvFsPoolGetAutostart fsPoolGetAutostart;
+ virDrvFsPoolSetAutostart fsPoolSetAutostart;
+ virDrvFsPoolNumOfItems fsPoolNumOfItems;
+ virDrvFsPoolListItems fsPoolListItems;
+ virDrvFsPoolListAllItems fsPoolListAllItems;
+ virDrvFsItemLookupByName fsItemLookupByName;
+ virDrvFsItemLookupByKey fsItemLookupByKey;
+ virDrvFsItemLookupByPath fsItemLookupByPath;
+ virDrvFsItemCreateXML fsItemCreateXML;
+ virDrvFsItemCreateXMLFrom fsItemCreateXMLFrom;
+ virDrvFsItemDelete fsItemDelete;
+ virDrvFsItemGetInfo fsItemGetInfo;
+ virDrvFsItemGetXMLDesc fsItemGetXMLDesc;
+ virDrvFsItemGetPath fsItemGetPath;
+ virDrvFsPoolIsActive fsPoolIsActive;
+ virDrvFsPoolIsPersistent fsPoolIsPersistent;
+};
+
+
+#endif /* __VIR_DRIVER_STORAGE_H__ */
diff --git a/src/driver.h b/src/driver.h
index e4e382b..fb93083 100644
--- a/src/driver.h
+++ b/src/driver.h
@@ -72,6 +72,7 @@ typedef enum {
# include "driver-state.h"
# include "driver-stream.h"
# include "driver-storage.h"
+# include "driver-fs.h"
# undef __VIR_DRIVER_H_INCLUDES___
diff --git a/src/libvirt-fs.c b/src/libvirt-fs.c
new file mode 100644
index 0000000..4432cfd
--- /dev/null
+++ b/src/libvirt-fs.c
@@ -0,0 +1,1715 @@
+/*
+ * libvirt-fs.c: entry points for virFs{Pool, Item}Ptr APIs
+ *
+ * Copyright (C) 2006-2015 Red Hat, Inc.
+ *
+ * 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/>.
+ */
+
+#include <config.h>
+
+#include "datatypes.h"
+#include "virlog.h"
+
+VIR_LOG_INIT("libvirt.fs");
+
+#define VIR_FROM_THIS VIR_FROM_FSPOOL
+
+
+/**
+ * virFsPoolGetConnect:
+ * @fspool: pointer to a fspool
+ *
+ * Provides the connection pointer associated with fspool. The
+ * reference counter on the connection is not increased by this
+ * call.
+ * Returns the virConnectPtr or NULL in case of failure.
+ */
+virConnectPtr
+virFsPoolGetConnect(virFsPoolPtr fspool)
+{
+ VIR_DEBUG("fspool=%p", fspool);
+
+ virResetLastError();
+
+ virCheckFsPoolReturn(fspool, NULL);
+
+ return fspool->conn;
+}
+
+
+/**
+ * virConnectListAllFsPools:
+ * @conn: Pointer to the hypervisor connection.
+ * @fspools: Pointer to a variable to store the array containing fspool
+ * objects or NULL if the list is not required (just returns number
+ * of fspools).
+ * @flags: bitwise-OR of virConnectListAllFsPoolsFlags.
+ *
+ * Collect the list of fspools, and allocate an array to store those
+ * objects. This API solves the race inherent between
+ * virConnectListFsPools and virConnectListDefinedFsPools.
+ *
+ * Normally, all fspools are returned; however, @flags can be used to
+ * filter the results for a smaller list of targeted fspools. The valid
+ * flags are divided into groups, where each group contains bits that
+ * describe mutually exclusive attributes of a fspool, and where all bits
+ * within a group describe all possible fspools.
+ *
+ * The only group (at the moment) of @flags is provided to filter the fspools by the
types,
+ * the flags include:
+ * VIR_CONNECT_LIST_FS_POOLS_DIR
+ * VIR_CONNECT_LIST_FS_POOLS_VOLUME
+ * VIR_CONNECT_LIST_FS_POOLS_NETFS
+ *
+ * Returns the number of fs fspools found or -1 and sets @fspools to
+ * NULL in case of error. On success, the array stored into @fspools is
+ * guaranteed to have an extra allocated element set to NULL but not included
+ * in the return count, to make iteration easier. The caller is responsible
+ * for calling virFsPoolFree() on each array element, then calling
+ * free() on @fspools.
+ */
+int
+virConnectListAllFsPools(virConnectPtr conn,
+ virFsPoolPtr **fspools,
+ unsigned int flags)
+{
+ VIR_DEBUG("conn=%p, fspools=%p, flags=%x", conn, fspools, flags);
+
+ virResetLastError();
+
+ if (fspools)
+ *fspools = NULL;
+
+ virCheckConnectReturn(conn, -1);
+
+ if (conn->fsDriver &&
+ conn->fsDriver->connectListAllFsPools) {
+ int ret;
+ ret = conn->fsDriver->connectListAllFsPools(conn, fspools, flags);
+ if (ret < 0)
+ goto error;
+ return ret;
+ }
+
+ virReportUnsupportedError();
+
+ error:
+ virDispatchError(conn);
+ return -1;
+}
+
+
+/**
+ * virConnectNumOfFsPools:
+ * @conn: pointer to hypervisor connection
+ *
+ * Provides the number of active fspools
+ *
+ * Returns the number of fspools found, or -1 on error
+ */
+int
+virConnectNumOfFsPools(virConnectPtr conn)
+{
+ VIR_DEBUG("conn=%p", conn);
+
+ virResetLastError();
+
+ virCheckConnectReturn(conn, -1);
+
+ if (conn->fsDriver && conn->fsDriver->connectNumOfFsPools) {
+ int ret;
+ ret = conn->fsDriver->connectNumOfFsPools(conn);
+ if (ret < 0)
+ goto error;
+ return ret;
+ }
+
+ virReportUnsupportedError();
+
+ error:
+ virDispatchError(conn);
+ return -1;
+}
+
+
+/**
+ * virConnectListFsPools:
+ * @conn: pointer to hypervisor connection
+ * @names: array of char * to fill with fspool names (allocated by caller)
+ * @maxnames: size of the names array
+ *
+ * Provides the list of names of active fspools up to maxnames.
+ * If there are more than maxnames, the remaining names will be silently
+ * ignored.
+ *
+ * For more control over the results, see virConnectListAllFsPools().
+ *
+ * Returns the number of fspools found or -1 in case of error. Note that
+ * this command is inherently racy; a fspool can be started between a call to
+ * virConnectNumOfFsPools() and this call; you are only guaranteed
+ * that all currently active fspools were listed if the return is less than
+ * @maxnames. The client must call free() on each returned name.
+ */
+int
+virConnectListFsPools(virConnectPtr conn,
+ char **const names,
+ int maxnames)
+{
+ VIR_DEBUG("conn=%p, names=%p, maxnames=%d", conn, names, maxnames);
+
+ virResetLastError();
+
+ virCheckConnectReturn(conn, -1);
+ virCheckNonNullArgGoto(names, error);
+ virCheckNonNegativeArgGoto(maxnames, error);
+
+ if (conn->fsDriver && conn->fsDriver->connectListFsPools) {
+ int ret;
+ ret = conn->fsDriver->connectListFsPools(conn, names, maxnames);
+ if (ret < 0)
+ goto error;
+ return ret;
+ }
+
+ virReportUnsupportedError();
+
+ error:
+ virDispatchError(conn);
+ return -1;
+}
+
+
+/**
+ * virConnectNumOfDefinedFsPools:
+ * @conn: pointer to hypervisor connection
+ *
+ * Provides the number of inactive fs fspools
+ *
+ * Returns the number of fspools found, or -1 on error
+ */
+int
+virConnectNumOfDefinedFsPools(virConnectPtr conn)
+{
+ VIR_DEBUG("conn=%p", conn);
+
+ virResetLastError();
+
+ virCheckConnectReturn(conn, -1);
+
+ if (conn->fsDriver && conn->fsDriver->connectNumOfDefinedFsPools) {
+ int ret;
+ ret = conn->fsDriver->connectNumOfDefinedFsPools(conn);
+ if (ret < 0)
+ goto error;
+ return ret;
+ }
+
+ virReportUnsupportedError();
+
+ error:
+ virDispatchError(conn);
+ return -1;
+}
+
+
+/**
+ * virConnectListDefinedFsPools:
+ * @conn: pointer to hypervisor connection
+ * @names: array of char * to fill with fspool names (allocated by caller)
+ * @maxnames: size of the names array
+ *
+ * Provides the list of names of inactive fspools up to maxnames.
+ * If there are more than maxnames, the remaining names will be silently
+ * ignored.
+ *
+ * For more control over the results, see virConnectListAllFsPools().
+ *
+ * Returns the number of names provided in the array or -1 in case of error.
+ * Note that this command is inherently racy; a fspool can be defined between
+ * a call to virConnectNumOfDefinedFsPools() and this call; you are only
+ * guaranteed that all currently defined fspools were listed if the return
+ * is less than @maxnames. The client must call free() on each returned name.
+ */
+int
+virConnectListDefinedFsPools(virConnectPtr conn,
+ char **const names,
+ int maxnames)
+{
+ VIR_DEBUG("conn=%p, names=%p, maxnames=%d", conn, names, maxnames);
+
+ virResetLastError();
+
+ virCheckConnectReturn(conn, -1);
+ virCheckNonNullArgGoto(names, error);
+ virCheckNonNegativeArgGoto(maxnames, error);
+
+ if (conn->fsDriver && conn->fsDriver->connectListDefinedFsPools) {
+ int ret;
+ ret = conn->fsDriver->connectListDefinedFsPools(conn, names, maxnames);
+ if (ret < 0)
+ goto error;
+ return ret;
+ }
+
+ virReportUnsupportedError();
+
+ error:
+ virDispatchError(conn);
+ return -1;
+}
+
+/**
+ * virFsPoolLookupByName:
+ * @conn: pointer to hypervisor connection
+ * @name: name of fspool to fetch
+ *
+ * Fetch fspool based on its unique name
+ *
+ * virFsPoolFree should be used to free the resources after the
+ * fs fspool object is no longer needed.
+ *
+ * Returns a virFsPoolPtr object, or NULL if no matching fspool is found
+ */
+virFsPoolPtr
+virFsPoolLookupByName(virConnectPtr conn,
+ const char *name)
+{
+ VIR_DEBUG("conn=%p, name=%s", conn, NULLSTR(name));
+
+ virResetLastError();
+
+ virCheckConnectReturn(conn, NULL);
+ virCheckNonNullArgGoto(name, error);
+
+ if (conn->fsDriver && conn->fsDriver->fsPoolLookupByName) {
+ virFsPoolPtr ret;
+ ret = conn->fsDriver->fsPoolLookupByName(conn, name);
+ if (!ret)
+ goto error;
+ return ret;
+ }
+
+ virReportUnsupportedError();
+
+ error:
+ virDispatchError(conn);
+ return NULL;
+}
+
+
+/**
+ * virFsPoolLookupByUUID:
+ * @conn: pointer to hypervisor connection
+ * @uuid: globally unique id of fspool to fetch
+ *
+ * Fetch a fspool based on its globally unique id
+ *
+ * virFsPoolFree should be used to free the resources after the
+ * fs fspool object is no longer needed.
+ *
+ * Returns a virFsPoolPtr object, or NULL if no matching fspool is found
+ */
+virFsPoolPtr
+virFsPoolLookupByUUID(virConnectPtr conn,
+ const unsigned char *uuid)
+{
+ VIR_UUID_DEBUG(conn, uuid);
+
+ virResetLastError();
+
+ virCheckConnectReturn(conn, NULL);
+ virCheckNonNullArgGoto(uuid, error);
+
+ if (conn->fsDriver && conn->fsDriver->fsPoolLookupByUUID) {
+ virFsPoolPtr ret;
+ ret = conn->fsDriver->fsPoolLookupByUUID(conn, uuid);
+ if (!ret)
+ goto error;
+ return ret;
+ }
+
+ virReportUnsupportedError();
+
+ error:
+ virDispatchError(conn);
+ return NULL;
+}
+
+
+/**
+ * virFsPoolLookupByUUIDString:
+ * @conn: pointer to hypervisor connection
+ * @uuidstr: globally unique id of fspool to fetch
+ *
+ * Fetch a fs fspool based on its globally unique id
+ *
+ * virFsPoolFree should be used to free the resources after the
+ * fs fspool object is no longer needed.
+ *
+ * Returns a virFsPoolPtr object, or NULL if no matching fspool is found
+ */
+virFsPoolPtr
+virFsPoolLookupByUUIDString(virConnectPtr conn,
+ const char *uuidstr)
+{
+ unsigned char uuid[VIR_UUID_BUFLEN];
+ VIR_DEBUG("conn=%p, uuidstr=%s", conn, NULLSTR(uuidstr));
+
+ virResetLastError();
+
+ virCheckConnectReturn(conn, NULL);
+ virCheckNonNullArgGoto(uuidstr, error);
+
+ if (virUUIDParse(uuidstr, uuid) < 0) {
+ virReportInvalidArg(uuidstr,
+ _("uuidstr in %s must be a valid UUID"),
+ __FUNCTION__);
+ goto error;
+ }
+
+ return virFsPoolLookupByUUID(conn, uuid);
+
+ error:
+ virDispatchError(conn);
+ return NULL;
+}
+
+
+/**
+ * virFsPoolLookupByItem:
+ * @item: pointer to fspool item
+ *
+ * Fetch a fspool which contains a particular item
+ *
+ * virFsPoolFree should be used to free the resources after the
+ * fspool object is no longer needed.
+ *
+ * Returns a virFsPoolPtr object, or NULL if no matching fspool is found
+ */
+virFsPoolPtr
+virFsPoolLookupByItem(virFsItemPtr item)
+{
+ VIR_DEBUG("item=%p", item);
+
+ virResetLastError();
+
+ virCheckFsItemReturn(item, NULL);
+
+ if (item->conn->fsDriver &&
item->conn->fsDriver->fsPoolLookupByItem) {
+ virFsPoolPtr ret;
+ ret = item->conn->fsDriver->fsPoolLookupByItem(item);
+ if (!ret)
+ goto error;
+ return ret;
+ }
+
+ virReportUnsupportedError();
+
+ error:
+ virDispatchError(item->conn);
+ return NULL;
+}
+
+
+/**
+ * virFsPoolCreateXML:
+ * @conn: pointer to hypervisor connection
+ * @xmlDesc: XML description for new fspool
+ * @flags: bitwise-OR of virFsPoolCreateFlags
+ *
+ * Create a new fspool based on its XML description. The
+ * fspool is not persistent, so its definition will disappear
+ * when it is destroyed, or if the host is restarted
+ *
+ * virFsPoolFree should be used to free the resources after the
+ *fspool object is no longer needed.
+ *
+ * Returns a virFsPoolPtr object, or NULL if creation failed
+ */
+virFsPoolPtr
+virFsPoolCreateXML(virConnectPtr conn,
+ const char *xmlDesc,
+ unsigned int flags)
+{
+ VIR_DEBUG("conn=%p, xmlDesc=%s, flags=%x", conn, NULLSTR(xmlDesc), flags);
+
+ virResetLastError();
+
+ virCheckConnectReturn(conn, NULL);
+ virCheckNonNullArgGoto(xmlDesc, error);
+ virCheckReadOnlyGoto(conn->flags, error);
+
+ if (conn->fsDriver && conn->fsDriver->fsPoolCreateXML) {
+ virFsPoolPtr ret;
+ ret = conn->fsDriver->fsPoolCreateXML(conn, xmlDesc, flags);
+ if (!ret)
+ goto error;
+ return ret;
+ }
+
+ virReportUnsupportedError();
+
+ error:
+ virDispatchError(conn);
+ return NULL;
+}
+
+
+/**
+ * virFsPoolDefineXML:
+ * @conn: pointer to hypervisor connection
+ * @xml: XML description for new fspool
+ * @flags: extra flags; not used yet, so callers should always pass 0
+ *
+ * Define an inactive persistent fspool or modify an existing persistent
+ * one from the XML description.
+ *
+ * virFsPoolFree should be used to free the resources after the
+ * fspool object is no longer needed.
+ *
+ * Returns a virFsPoolPtr object, or NULL if creation failed
+ */
+virFsPoolPtr
+virFsPoolDefineXML(virConnectPtr conn,
+ const char *xml,
+ unsigned int flags)
+{
+ VIR_DEBUG("conn=%p, xml=%s, flags=%x", conn, NULLSTR(xml), flags);
+
+ virResetLastError();
+
+ virCheckConnectReturn(conn, NULL);
+ virCheckReadOnlyGoto(conn->flags, error);
+ virCheckNonNullArgGoto(xml, error);
+
+ if (conn->fsDriver && conn->fsDriver->fsPoolDefineXML) {
+ virFsPoolPtr ret;
+ ret = conn->fsDriver->fsPoolDefineXML(conn, xml, flags);
+ if (!ret)
+ goto error;
+ return ret;
+ }
+
+ virReportUnsupportedError();
+
+ error:
+ virDispatchError(conn);
+ return NULL;
+}
+
+
+/**
+ * virFsPoolBuild:
+ * @fspool: pointer to fspool
+ * @flags: bitwise-OR of virFsPoolBuildFlags
+ *
+ * Build the underlying fspool
+ *
+ * Returns 0 on success, or -1 upon failure
+ */
+int
+virFsPoolBuild(virFsPoolPtr fspool,
+ unsigned int flags)
+{
+ virConnectPtr conn;
+ VIR_DEBUG("fspool=%p, flags=%x", fspool, flags);
+
+ virResetLastError();
+
+ virCheckFsPoolReturn(fspool, -1);
+ conn = fspool->conn;
+
+ virCheckReadOnlyGoto(conn->flags, error);
+
+ if (conn->fsDriver && conn->fsDriver->fsPoolBuild) {
+ int ret;
+ ret = conn->fsDriver->fsPoolBuild(fspool, flags);
+ if (ret < 0)
+ goto error;
+ return ret;
+ }
+
+ virReportUnsupportedError();
+
+ error:
+ virDispatchError(fspool->conn);
+ return -1;
+}
+
+/**
+ * virFsPoolRefresh:
+ * @fspool: pointer to fspool
+ * @flags: extra flags; not used yet, so callers should always pass 0
+ *
+ * Request that the fspool refresh its list of itemms. This may
+ * involve communicating with a remote server, and/or initializing
+ * new devices at the OS layer
+ *
+ * Returns 0 if the items list was refreshed, -1 on failure
+ */
+int
+virFsPoolRefresh(virFsPoolPtr fspool,
+ unsigned int flags)
+{
+ virConnectPtr conn;
+ VIR_DEBUG("fspool=%p, flags=%x", fspool, flags);
+
+ virResetLastError();
+
+ virCheckFsPoolReturn(fspool, -1);
+ conn = fspool->conn;
+
+ virCheckReadOnlyGoto(conn->flags, error);
+
+ if (conn->fsDriver && conn->fsDriver->fsPoolRefresh) {
+ int ret;
+ ret = conn->fsDriver->fsPoolRefresh(fspool, flags);
+ if (ret < 0)
+ goto error;
+ return ret;
+ }
+
+ virReportUnsupportedError();
+
+ error:
+ virDispatchError(fspool->conn);
+ return -1;
+}
+/**
+ * virFsPoolUndefine:
+ * @fspool: pointer to fspool
+ *
+ * Undefine an inactive fspool
+ *
+ * Returns 0 on success, -1 on failure
+ */
+int
+virFsPoolUndefine(virFsPoolPtr fspool)
+{
+ virConnectPtr conn;
+ VIR_DEBUG("fspool=%p", fspool);
+
+ virResetLastError();
+
+ virCheckFsPoolReturn(fspool, -1);
+ conn = fspool->conn;
+
+ virCheckReadOnlyGoto(conn->flags, error);
+
+ if (conn->fsDriver && conn->fsDriver->fsPoolUndefine) {
+ int ret;
+ ret = conn->fsDriver->fsPoolUndefine(fspool);
+ if (ret < 0)
+ goto error;
+ return ret;
+ }
+
+ virReportUnsupportedError();
+
+ error:
+ virDispatchError(fspool->conn);
+ return -1;
+}
+
+/**
+ * virFsPoolCreate:
+ * @fspool: pointer to fspool
+ * @flags: bitwise-OR of virFsPoolCreateFlags
+ *
+ * Starts an inactive fspool
+ *
+ * Returns 0 on success, or -1 if it could not be started
+ */
+int
+virFsPoolCreate(virFsPoolPtr fspool,
+ unsigned int flags)
+{
+ virConnectPtr conn;
+ VIR_DEBUG("fspool=%p, flags=%x", fspool, flags);
+
+ virResetLastError();
+
+ virCheckFsPoolReturn(fspool, -1);
+ conn = fspool->conn;
+
+ virCheckReadOnlyGoto(conn->flags, error);
+
+ if (conn->fsDriver && conn->fsDriver->fsPoolCreate) {
+ int ret;
+ ret = conn->fsDriver->fsPoolCreate(fspool, flags);
+ if (ret < 0)
+ goto error;
+ return ret;
+ }
+
+ virReportUnsupportedError();
+
+ error:
+ virDispatchError(fspool->conn);
+ return -1;
+}
+
+/**
+ * virFsPoolDestroy:
+ * @fspool: pointer to fspool
+ *
+ * Destroy an active fspool. This will deactivate the
+ * fspool on the host, but keep any persistent config associated
+ * with it. If it has a persistent config it can later be
+ * restarted with virFsPoolCreate(). This does not free
+ * the associated virFsPoolPtr object.
+ *
+ * Returns 0 on success, or -1 if it could not be destroyed
+ */
+int
+virFsPoolDestroy(virFsPoolPtr fspool)
+{
+ virConnectPtr conn;
+ VIR_DEBUG("fspool=%p", fspool);
+
+ virResetLastError();
+
+ virCheckFsPoolReturn(fspool, -1);
+ conn = fspool->conn;
+
+ virCheckReadOnlyGoto(conn->flags, error);
+
+ if (conn->fsDriver && conn->fsDriver->fsPoolDestroy) {
+ int ret;
+ ret = conn->fsDriver->fsPoolDestroy(fspool);
+ if (ret < 0)
+ goto error;
+ return ret;
+ }
+
+ virReportUnsupportedError();
+
+ error:
+ virDispatchError(fspool->conn);
+ return -1;
+}
+
+/**
+ * virFsPoolDelete:
+ * @fspool: pointer to fspool
+ * @flags: bitwise-OR of virFsPoolDeleteFlags
+ *
+ * Delete the underlying fspool resources. This is
+ * a non-recoverable operation. The virFsPoolPtr object
+ * itself is not free'd.
+ *
+ * Returns 0 on success, or -1 if it could not be obliterate
+ */
+int
+virFsPoolDelete(virFsPoolPtr fspool,
+ unsigned int flags)
+{
+ virConnectPtr conn;
+ VIR_DEBUG("fspool=%p, flags=%x", fspool, flags);
+
+ virResetLastError();
+
+ virCheckFsPoolReturn(fspool, -1);
+ conn = fspool->conn;
+
+ virCheckReadOnlyGoto(conn->flags, error);
+
+ if (conn->fsDriver && conn->fsDriver->fsPoolDelete) {
+ int ret;
+ ret = conn->fsDriver->fsPoolDelete(fspool, flags);
+ if (ret < 0)
+ goto error;
+ return ret;
+ }
+
+ virReportUnsupportedError();
+
+ error:
+ virDispatchError(fspool->conn);
+ return -1;
+}
+
+
+/**
+ * virFsPoolFree:
+ * @fspool: pointer to fspool
+ *
+ * Free a fs fspool object, releasing all memory associated with
+ * it. Does not change the state of the fspool on the host.
+ *
+ * Returns 0 on success, or -1 if it could not be free'd.
+ */
+int
+virFsPoolFree(virFsPoolPtr fspool)
+{
+ VIR_DEBUG("fspool=%p", fspool);
+
+ virResetLastError();
+
+ virCheckFsPoolReturn(fspool, -1);
+
+ virObjectUnref(fspool);
+ return 0;
+
+}
+
+
+/**
+ * virFsPoolRef:
+ * @fspool: the fspool to hold a reference on
+ *
+ * Increment the reference count on the fspool. For each
+ * additional call to this method, there shall be a corresponding
+ * call to virFsPoolFree to release the reference count, once
+ * the caller no longer needs the reference to this object.
+ *
+ * This method is typically useful for applications where multiple
+ * threads are using a connection, and it is required that the
+ * connection remain open until all threads have finished using
+ * it. ie, each new thread using a fspool would increment
+ * the reference count.
+ *
+ * Returns 0 in case of success, -1 in case of failure.
+ */
+int
+virFsPoolRef(virFsPoolPtr fspool)
+{
+ VIR_DEBUG("fspool=%p refs=%d", fspool, fspool ? fspool->object.u.s.refs
: 0);
+
+ virResetLastError();
+
+ virCheckFsPoolReturn(fspool, -1);
+
+ virObjectRef(fspool);
+ return 0;
+}
+
+/**
+ * virFsPoolGetName:
+ * @fspool: pointer to fs fspool
+ *
+ * Fetch the locally unique name of the fs fspool
+ *
+ * Returns the name of the fspool, or NULL on error
+ */
+const char*
+virFsPoolGetName(virFsPoolPtr fspool)
+{
+ VIR_DEBUG("fspool=%p", fspool);
+
+ virResetLastError();
+
+ virCheckFsPoolReturn(fspool, NULL);
+
+ return fspool->name;
+}
+
+
+/**
+ * virFsPoolGetUUID:
+ * @fspool: pointer to fspool
+ * @uuid: buffer of VIR_UUID_BUFLEN bytes in size
+ *
+ * Fetch the globally unique ID of the fspool
+ *
+ * Returns 0 on success, or -1 on error;
+ */
+int
+virFsPoolGetUUID(virFsPoolPtr fspool,
+ unsigned char *uuid)
+{
+ VIR_DEBUG("fspool=%p, uuid=%p", fspool, uuid);
+
+ virResetLastError();
+
+ virCheckFsPoolReturn(fspool, -1);
+ virCheckNonNullArgGoto(uuid, error);
+
+ memcpy(uuid, &fspool->uuid[0], VIR_UUID_BUFLEN);
+
+ return 0;
+
+ error:
+ virDispatchError(fspool->conn);
+ return -1;
+}
+
+
+/**
+ * virFsPoolGetUUIDString:
+ * @fspool: pointer to fspool
+ * @buf: buffer of VIR_UUID_STRING_BUFLEN bytes in size
+ *
+ * Fetch the globally unique ID of the fspool as a string
+ *
+ * Returns 0 on success, or -1 on error;
+ */
+int
+virFsPoolGetUUIDString(virFsPoolPtr fspool,
+ char *buf)
+{
+ VIR_DEBUG("fspool=%p, buf=%p", fspool, buf);
+
+ virResetLastError();
+
+ virCheckFsPoolReturn(fspool, -1);
+ virCheckNonNullArgGoto(buf, error);
+
+ virUUIDFormat(fspool->uuid, buf);
+ return 0;
+
+ error:
+ virDispatchError(fspool->conn);
+ return -1;
+}
+
+
+/**
+ * virFsPoolGetInfo:
+ * @fspool: pointer to fs fspool
+ * @info: pointer at which to store info
+ *
+ * Get information about the fspool
+ * such as free space / usage summary
+ *
+ * Returns 0 on success, or -1 on failure.
+ */
+int
+virFsPoolGetInfo(virFsPoolPtr fspool,
+ virFsPoolInfoPtr info)
+{
+ virConnectPtr conn;
+ VIR_DEBUG("fspool=%p, info=%p", fspool, info);
+
+ virResetLastError();
+
+ if (info)
+ memset(info, 0, sizeof(*info));
+
+ virCheckFsPoolReturn(fspool, -1);
+ virCheckNonNullArgGoto(info, error);
+
+ conn = fspool->conn;
+
+ if (conn->fsDriver->fsPoolGetInfo) {
+ int ret;
+ ret = conn->fsDriver->fsPoolGetInfo(fspool, info);
+ if (ret < 0)
+ goto error;
+ return ret;
+ }
+
+ virReportUnsupportedError();
+
+ error:
+ virDispatchError(fspool->conn);
+ return -1;
+}
+
+/**
+ * virFsPoolGetAutostart:
+ * @fspool: pointer to fspool
+ * @autostart: location in which to store autostart flag
+ *
+ * Fetches the value of the autostart flag, which determines
+ * whether the fspool is automatically started at boot time
+ *
+ * Returns 0 on success, -1 on failure
+ */
+int
+virFsPoolGetAutostart(virFsPoolPtr fspool,
+ int *autostart)
+{
+ virConnectPtr conn;
+ VIR_DEBUG("fspool=%p, autostart=%p", fspool, autostart);
+
+ virResetLastError();
+
+ virCheckFsPoolReturn(fspool, -1);
+ virCheckNonNullArgGoto(autostart, error);
+
+ conn = fspool->conn;
+
+ if (conn->fsDriver && conn->fsDriver->fsPoolGetAutostart) {
+ int ret;
+ ret = conn->fsDriver->fsPoolGetAutostart(fspool, autostart);
+ if (ret < 0)
+ goto error;
+ return ret;
+ }
+
+ virReportUnsupportedError();
+
+ error:
+ virDispatchError(fspool->conn);
+ return -1;
+}
+
+
+/**
+ * virFsPoolSetAutostart:
+ * @fspool: pointer to fspool
+ * @autostart: new flag setting
+ *
+ * Sets the autostart flag
+ *
+ * Returns 0 on success, -1 on failure
+ */
+int
+virFsPoolSetAutostart(virFsPoolPtr fspool,
+ int autostart)
+{
+ virConnectPtr conn;
+ VIR_DEBUG("fspool=%p, autostart=%d", fspool, autostart);
+
+ virResetLastError();
+
+ virCheckFsPoolReturn(fspool, -1);
+ conn = fspool->conn;
+
+ virCheckReadOnlyGoto(conn->flags, error);
+
+ if (conn->fsDriver && conn->fsDriver->fsPoolSetAutostart) {
+ int ret;
+ ret = conn->fsDriver->fsPoolSetAutostart(fspool, autostart);
+ if (ret < 0)
+ goto error;
+ return ret;
+ }
+
+ virReportUnsupportedError();
+
+ error:
+ virDispatchError(fspool->conn);
+ return -1;
+}
+
+/**
+ * virFsPoolGetXMLDesc:
+ * @fspool: pointer to fspool
+ * @flags: bitwise-OR of virFsXMLFlags
+ *
+ * Fetch an XML document describing all aspects of the
+ * fs fspool. This is suitable for later feeding back
+ * into the virFsPoolCreateXML method.
+ *
+ * Returns a XML document (caller frees), or NULL on error
+ */
+char *
+virFsPoolGetXMLDesc(virFsPoolPtr fspool,
+ unsigned int flags)
+{
+ virConnectPtr conn;
+ VIR_DEBUG("fspool=%p, flags=%x", fspool, flags);
+
+ virResetLastError();
+
+ virCheckFsPoolReturn(fspool, NULL);
+ conn = fspool->conn;
+
+ if (conn->fsDriver && conn->fsDriver->fsPoolGetXMLDesc) {
+ char *ret;
+ ret = conn->fsDriver->fsPoolGetXMLDesc(fspool, flags);
+ if (!ret)
+ goto error;
+ return ret;
+ }
+
+ virReportUnsupportedError();
+
+ error:
+ virDispatchError(fspool->conn);
+ return NULL;
+}
+
+
+/**
+ * virFsPoolListAllItems:
+ * @fspool: Pointer to fspool
+ * @items: Pointer to a variable to store the array containing fs item
+ * objects or NULL if the list is not required (just returns number
+ * of items).
+ * @flags: extra flags; not used yet, so callers should always pass 0
+ *
+ * Collect the list of fsitems, and allocate an array to store those
+ * objects.
+ *
+ * Returns the number of fs items found or -1 and sets @items to
+ * NULL in case of error. On success, the array stored into @items is
+ * guaranteed to have an extra allocated element set to NULL but not included
+ * in the return count, to make iteration easier. The caller is responsible
+ * for calling virFsItemFree() on each array element, then calling
+ * free() on @items.
+ */
+int
+virFsPoolListAllItems(virFsPoolPtr fspool,
+ virFsItemPtr **items,
+ unsigned int flags)
+{
+ VIR_DEBUG("fspool=%p, items=%p, flags=%x", fspool, items, flags);
+
+ virResetLastError();
+
+ virCheckFsPoolReturn(fspool, -1);
+
+ if (fspool->conn->fsDriver &&
+ fspool->conn->fsDriver->fsPoolListAllItems) {
+ int ret;
+ ret = fspool->conn->fsDriver->fsPoolListAllItems(fspool, items, flags);
+ if (ret < 0)
+ goto error;
+ return ret;
+ }
+
+ virReportUnsupportedError();
+
+ error:
+ virDispatchError(fspool->conn);
+ return -1;
+}
+
+
+/**
+ * virFsPoolNumOfItems:
+ * @fspool: pointer to fspool
+ *
+ * Fetch the number of items within a fspool
+ *
+ * Returns the number of fspools, or -1 on failure
+ */
+int
+virFsPoolNumOfItems(virFsPoolPtr fspool)
+{
+ VIR_DEBUG("fspool=%p", fspool);
+
+ virResetLastError();
+
+ virCheckFsPoolReturn(fspool, -1);
+
+ if (fspool->conn->fsDriver &&
fspool->conn->fsDriver->fsPoolNumOfItems) {
+ int ret;
+ ret = fspool->conn->fsDriver->fsPoolNumOfItems(fspool);
+ if (ret < 0)
+ goto error;
+ return ret;
+ }
+
+ virReportUnsupportedError();
+
+ error:
+ virDispatchError(fspool->conn);
+ return -1;
+}
+
+
+/**
+ * virFsPoolListItems:
+ * @fspool: pointer to fspool
+ * @names: array in which to fsitem names
+ * @maxnames: size of names array
+ *
+ * Fetch list of fs item names, limiting to
+ * at most maxnames.
+ *
+ * To list the item objects directly, see virFsPoolListAllItems().
+ *
+ * Returns the number of names fetched, or -1 on error
+ */
+int
+virFsPoolListItems(virFsPoolPtr fspool,
+ char **const names,
+ int maxnames)
+{
+ VIR_DEBUG("fspool=%p, names=%p, maxnames=%d", fspool, names, maxnames);
+
+ virResetLastError();
+
+ virCheckFsPoolReturn(fspool, -1);
+ virCheckNonNullArgGoto(names, error);
+ virCheckNonNegativeArgGoto(maxnames, error);
+
+ if (fspool->conn->fsDriver &&
fspool->conn->fsDriver->fsPoolListItems) {
+ int ret;
+ ret = fspool->conn->fsDriver->fsPoolListItems(fspool, names, maxnames);
+ if (ret < 0)
+ goto error;
+ return ret;
+ }
+
+ virReportUnsupportedError();
+
+ error:
+ virDispatchError(fspool->conn);
+ return -1;
+}
+
+
+/**
+ * virFsItemGetConnect:
+ * @item: pointer to a fspool
+ *
+ * Provides the connection pointer associated with a fs item. The
+ * reference counter on the connection is not increased by this
+ * call.
+ *
+ * WARNING: When writing libvirt bindings in other languages, do
+ * not use this function. Instead, store the connection and
+ * the item object together.
+ *
+ * Returns the virConnectPtr or NULL in case of failure.
+ */
+virConnectPtr
+virFsItemGetConnect(virFsItemPtr item)
+{
+ VIR_DEBUG("item=%p", item);
+
+ virResetLastError();
+
+ virCheckFsItemReturn(item, NULL);
+
+ return item->conn;
+}
+
+
+/**
+ * virFsItemLookupByName:
+ * @fspool: pointer to fspool
+ * @name: name of fsitem
+ *
+ * Fetch a pointer to a fs item based on its name
+ * within a fspool
+ *
+ * virFsItemFree should be used to free the resources after the
+ * fs item object is no longer needed.
+ *
+ * Returns a fsitem, or NULL if not found / error
+ */
+virFsItemPtr
+virFsItemLookupByName(virFsPoolPtr fspool,
+ const char *name)
+{
+ VIR_DEBUG("fspool=%p, name=%s", fspool, NULLSTR(name));
+
+ virResetLastError();
+
+ virCheckFsPoolReturn(fspool, NULL);
+ virCheckNonNullArgGoto(name, error);
+
+ if (fspool->conn->fsDriver &&
fspool->conn->fsDriver->fsItemLookupByName) {
+ virFsItemPtr ret;
+ ret = fspool->conn->fsDriver->fsItemLookupByName(fspool, name);
+ if (!ret)
+ goto error;
+ return ret;
+ }
+
+ virReportUnsupportedError();
+
+ error:
+ virDispatchError(fspool->conn);
+ return NULL;
+}
+
+
+/**
+ * virFsItemLookupByKey:
+ * @conn: pointer to hypervisor connection
+ * @key: globally unique key
+ *
+ * Fetch a pointer to a fspool item based on its
+ * globally unique key
+ *
+ * virFsItemFree should be used to free the resources after the
+ * fs item object is no longer needed.
+ *
+ * Returns a fs item, or NULL if not found / error
+ */
+virFsItemPtr
+virFsItemLookupByKey(virConnectPtr conn,
+ const char *key)
+{
+ VIR_DEBUG("conn=%p, key=%s", conn, NULLSTR(key));
+
+ virResetLastError();
+
+ virCheckConnectReturn(conn, NULL);
+ virCheckNonNullArgGoto(key, error);
+
+ if (conn->fsDriver && conn->fsDriver->fsItemLookupByKey) {
+ virFsItemPtr ret;
+ ret = conn->fsDriver->fsItemLookupByKey(conn, key);
+ if (!ret)
+ goto error;
+ return ret;
+ }
+
+ virReportUnsupportedError();
+
+ error:
+ virDispatchError(conn);
+ return NULL;
+}
+
+
+/**
+ * virFsItemLookupByPath:
+ * @conn: pointer to hypervisor connection
+ * @path: locally unique path
+ *
+ * Fetch a pointer to a fs item based on its
+ * locally (host) unique path
+ *
+ * virFsItemFree should be used to free the resources after the
+ * fs item object is no longer needed.
+ *
+ * Returns a fs item, or NULL if not found / error
+ */
+virFsItemPtr
+virFsItemLookupByPath(virConnectPtr conn,
+ const char *path)
+{
+ VIR_DEBUG("conn=%p, path=%s", conn, NULLSTR(path));
+
+ virResetLastError();
+
+ virCheckConnectReturn(conn, NULL);
+ virCheckNonNullArgGoto(path, error);
+
+ if (conn->fsDriver && conn->fsDriver->fsItemLookupByPath) {
+ virFsItemPtr ret;
+ ret = conn->fsDriver->fsItemLookupByPath(conn, path);
+ if (!ret)
+ goto error;
+ return ret;
+ }
+
+ virReportUnsupportedError();
+
+ error:
+ virDispatchError(conn);
+ return NULL;
+}
+
+
+/**
+ * virFsItemGetName:
+ * @item: pointer to fsitem
+ *
+ * Fetch the fsitem name. This is unique
+ * within the scope of a fspool
+ *
+ * Returns the item name, or NULL on error
+ */
+const char*
+virFsItemGetName(virFsItemPtr item)
+{
+ VIR_DEBUG("item=%p", item);
+
+ virResetLastError();
+
+ virCheckFsItemReturn(item, NULL);
+
+ return item->name;
+}
+
+
+/**
+ * virFsItemGetKey:
+ * @item: pointer to fspool item
+ *
+ * Fetch the fsitem key. This is globally
+ * unique, so the same item will have the same
+ * key no matter what host it is accessed from
+ *
+ * Returns the item key, or NULL on error
+ */
+const char*
+virFsItemGetKey(virFsItemPtr item)
+{
+ VIR_DEBUG("item=%p", item);
+
+ virResetLastError();
+
+ virCheckFsItemReturn(item, NULL);
+
+ return item->key;
+}
+
+
+/**
+ * virFsItemCreateXML:
+ * @fspool: pointer to fspool
+ * @xmlDesc: description of item to create
+ * @flags: bitwise-OR of virFsItemCreateFlags
+ *
+ * Create a fs item within a fspool based
+ * on an XML description.
+ *
+ * virFsItemFree should be used to free the resources after the
+ * fs item object is no longer needed.
+ *
+ * Returns the fs item, or NULL on error
+ */
+virFsItemPtr
+virFsItemCreateXML(virFsPoolPtr fspool,
+ const char *xmlDesc,
+ unsigned int flags)
+{
+ VIR_DEBUG("fspool=%p, xmlDesc=%s, flags=%x", fspool, NULLSTR(xmlDesc),
flags);
+
+ virResetLastError();
+
+ virCheckFsPoolReturn(fspool, NULL);
+ virCheckNonNullArgGoto(xmlDesc, error);
+ virCheckReadOnlyGoto(fspool->conn->flags, error);
+
+ if (fspool->conn->fsDriver &&
fspool->conn->fsDriver->fsItemCreateXML) {
+ virFsItemPtr ret;
+ ret = fspool->conn->fsDriver->fsItemCreateXML(fspool, xmlDesc, flags);
+ if (!ret)
+ goto error;
+ return ret;
+ }
+
+ virReportUnsupportedError();
+
+ error:
+ virDispatchError(fspool->conn);
+ return NULL;
+}
+
+
+/**
+ * virFsItemCreateXMLFrom:
+ * @fspool: pointer to parent fspool for the new item
+ * @xmlDesc: description of item to create
+ * @cloneitem: fspool item to use as input
+ * @flags: bitwise-OR of virFsItemCreateFlags
+ *
+ * Create a fs item in the parent fspool, using the
+ * 'cloneitem' item as input. Information for the new
+ * item (name, perms) are passed via a typical item
+ * XML description.
+ *
+ * virFsItemFree should be used to free the resources after the
+ * fs item object is no longer needed.
+ *
+ * Returns the fs item, or NULL on error
+ */
+virFsItemPtr
+virFsItemCreateXMLFrom(virFsPoolPtr fspool,
+ const char *xmlDesc,
+ virFsItemPtr cloneitem,
+ unsigned int flags)
+{
+ VIR_DEBUG("fspool=%p, xmlDesc=%s, cloneitem=%p, flags=%x",
+ fspool, NULLSTR(xmlDesc), cloneitem, flags);
+
+ virResetLastError();
+
+ virCheckFsPoolReturn(fspool, NULL);
+ virCheckFsItemGoto(cloneitem, error);
+ virCheckNonNullArgGoto(xmlDesc, error);
+ virCheckReadOnlyGoto(fspool->conn->flags | cloneitem->conn->flags,
error);
+
+ if (fspool->conn->fsDriver &&
+ fspool->conn->fsDriver->fsItemCreateXMLFrom) {
+ virFsItemPtr ret;
+ ret = fspool->conn->fsDriver->fsItemCreateXMLFrom(fspool, xmlDesc,
+ cloneitem, flags);
+ if (!ret)
+ goto error;
+ return ret;
+ }
+
+ virReportUnsupportedError();
+
+ error:
+ virDispatchError(fspool->conn);
+ return NULL;
+}
+
+/**
+ * virFsItemDelete:
+ * @item: pointer to fspool item
+ * @flags: bitwise-OR of virFsItemDeleteFlags
+ *
+ * Delete the fs item from the fspool
+ *
+ * Returns 0 on success, or -1 on error
+ */
+int
+virFsItemDelete(virFsItemPtr item,
+ unsigned int flags)
+{
+ virConnectPtr conn;
+ VIR_DEBUG("item=%p, flags=%x", item, flags);
+
+ virResetLastError();
+
+ virCheckFsItemReturn(item, -1);
+ conn = item->conn;
+
+ virCheckReadOnlyGoto(conn->flags, error);
+
+ if (conn->fsDriver && conn->fsDriver->fsItemDelete) {
+ int ret;
+ ret = conn->fsDriver->fsItemDelete(item, flags);
+ if (ret < 0)
+ goto error;
+ return ret;
+ }
+
+ virReportUnsupportedError();
+
+ error:
+ virDispatchError(item->conn);
+ return -1;
+}
+
+/**
+ * virFsItemFree:
+ * @item: pointer to fspool item
+ *
+ * Release the fs item handle. The underlying
+ * fs item continues to exist.
+ *
+ * Returns 0 on success, or -1 on error
+ */
+int
+virFsItemFree(virFsItemPtr item)
+{
+ VIR_DEBUG("item=%p", item);
+
+ virResetLastError();
+
+ virCheckFsItemReturn(item, -1);
+
+ virObjectUnref(item);
+ return 0;
+}
+
+
+/**
+ * virFsItemRef:
+ * @item: the item to hold a reference on
+ *
+ * Increment the reference count on the item. For each
+ * additional call to this method, there shall be a corresponding
+ * call to virFsItemFree to release the reference count, once
+ * the caller no longer needs the reference to this object.
+ *
+ * This method is typically useful for applications where multiple
+ * threads are using a connection, and it is required that the
+ * connection remain open until all threads have finished using
+ * it. ie, each new thread using a item would increment
+ * the reference count.
+ *
+ * Returns 0 in case of success, -1 in case of failure.
+ */
+int
+virFsItemRef(virFsItemPtr item)
+{
+ VIR_DEBUG("item=%p refs=%d", item, item ? item->object.u.s.refs : 0);
+
+ virResetLastError();
+
+ virCheckFsItemReturn(item, -1);
+
+ virObjectRef(item);
+ return 0;
+}
+
+
+/**
+ * virFsItemGetInfo:
+ * @item: pointer to fspool item
+ * @info: pointer at which to store info
+ *
+ * Fetches itematile information about the fspool
+ * item such as its current allocation
+ *
+ * Returns 0 on success, or -1 on failure
+ */
+int
+virFsItemGetInfo(virFsItemPtr item,
+ virFsItemInfoPtr info)
+{
+ virConnectPtr conn;
+ VIR_DEBUG("item=%p, info=%p", item, info);
+
+ virResetLastError();
+
+ if (info)
+ memset(info, 0, sizeof(*info));
+
+ virCheckFsItemReturn(item, -1);
+ virCheckNonNullArgGoto(info, error);
+
+ conn = item->conn;
+
+ if (conn->fsDriver->fsItemGetInfo) {
+ int ret;
+ ret = conn->fsDriver->fsItemGetInfo(item, info);
+ if (ret < 0)
+ goto error;
+ return ret;
+ }
+
+ virReportUnsupportedError();
+
+ error:
+ virDispatchError(item->conn);
+ return -1;
+}
+
+
+/**
+ * virFsItemGetXMLDesc:
+ * @item: pointer to fsitem
+ * @flags: extra flags; not used yet, so callers should always pass 0
+ *
+ * Fetch an XML document describing all aspects of
+ * the fsitem
+ *
+ * Returns the XML document, or NULL on error
+ */
+char *
+virFsItemGetXMLDesc(virFsItemPtr item,
+ unsigned int flags)
+{
+ virConnectPtr conn;
+ VIR_DEBUG("item=%p, flags=%x", item, flags);
+
+ virResetLastError();
+
+ virCheckFsItemReturn(item, NULL);
+ conn = item->conn;
+
+ if (conn->fsDriver && conn->fsDriver->fsItemGetXMLDesc) {
+ char *ret;
+ ret = conn->fsDriver->fsItemGetXMLDesc(item, flags);
+ if (!ret)
+ goto error;
+ return ret;
+ }
+
+ virReportUnsupportedError();
+
+ error:
+ virDispatchError(item->conn);
+ return NULL;
+}
+
+
+/**
+ * virFsItemGetPath:
+ * @item: pointer to fspool item
+ *
+ * Fetch the fsitem path. Depending on the fspool
+ * configuration this is either persistent across hosts,
+ * or dynamically assigned at fspool startup. Consult
+ * fspool documentation for information on getting the
+ * persistent naming
+ *
+ * Returns the fs item path, or NULL on error. The
+ * caller must free() the returned path after use.
+ */
+char *
+virFsItemGetPath(virFsItemPtr item)
+{
+ virConnectPtr conn;
+ VIR_DEBUG("item=%p", item);
+
+ virResetLastError();
+
+ virCheckFsItemReturn(item, NULL);
+ conn = item->conn;
+
+ if (conn->fsDriver && conn->fsDriver->fsItemGetPath) {
+ char *ret;
+ ret = conn->fsDriver->fsItemGetPath(item);
+ if (!ret)
+ goto error;
+ return ret;
+ }
+
+ virReportUnsupportedError();
+
+ error:
+ virDispatchError(item->conn);
+ return NULL;
+}
+
+
+/**
+ * virFsPoolIsActive:
+ */
+int
+virFsPoolIsActive(virFsPoolPtr fspool)
+{
+ VIR_DEBUG("fspool=%p", fspool);
+
+ virResetLastError();
+
+ virCheckFsPoolReturn(fspool, -1);
+
+ if (fspool->conn->fsDriver->fsPoolIsActive) {
+ int ret;
+ ret = fspool->conn->fsDriver->fsPoolIsActive(fspool);
+ if (ret < 0)
+ goto error;
+ return ret;
+ }
+
+ virReportUnsupportedError();
+ error:
+ virDispatchError(fspool->conn);
+ return -1;
+}
+
+
+/**
+ * virFsPoolIsPersistent:
+ * @fspool: pointer to the fspool object
+ *
+ * Determine if the fspool has a persistent configuration
+ * which means it will still exist after shutting down
+ *
+ * Returns 1 if persistent, 0 if transient, -1 on error
+ */
+int
+virFsPoolIsPersistent(virFsPoolPtr fspool)
+{
+ VIR_DEBUG("fspool=%p", fspool);
+
+ virResetLastError();
+
+ virCheckFsPoolReturn(fspool, -1);
+
+ if (fspool->conn->fsDriver->fsPoolIsPersistent) {
+ int ret;
+ ret = fspool->conn->fsDriver->fsPoolIsPersistent(fspool);
+ if (ret < 0)
+ goto error;
+ return ret;
+ }
+
+ virReportUnsupportedError();
+ error:
+ virDispatchError(fspool->conn);
+ return -1;
+}
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 419c33d..2efaab1 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -979,9 +979,13 @@ virConnectCloseCallbackDataRegister;
virConnectCloseCallbackDataUnregister;
virDomainClass;
virDomainSnapshotClass;
+virFsItemClass;
+virFsPoolClass;
virGetConnect;
virGetDomain;
virGetDomainSnapshot;
+virGetFsItem;
+virGetFsPool;
virGetInterface;
virGetNetwork;
virGetNodeDevice;
diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms
index e01604c..7420e40 100644
--- a/src/libvirt_public.syms
+++ b/src/libvirt_public.syms
@@ -738,6 +738,52 @@ LIBVIRT_2.0.0 {
virConnectStoragePoolEventDeregisterAny;
virDomainGetGuestVcpus;
virDomainSetGuestVcpus;
+ virFsPoolGetConnect;
+ virConnectNumOfFsPools;
+ virConnectNumOfDefinedFsPools;
+ virConnectListFsPools;
+ virConnectListDefinedFsPools;
+ virConnectListAllFsPools;
+ virFsPoolListAllItems;
+ virFsPoolLookupByName;
+ virFsPoolLookupByUUID;
+ virFsPoolLookupByUUIDString;
+ virFsPoolLookupByItem;
+ virFsPoolCreateXML;
+ virFsPoolDefineXML;
+ virFsPoolUndefine;
+ virFsPoolCreate;
+ virFsPoolBuild;
+ virFsPoolDestroy;
+ virFsPoolDelete;
+ virFsPoolRefresh;
+ virFsPoolFree;
+ virFsPoolGetName;
+ virFsPoolGetUUID;
+ virFsPoolGetUUIDString;
+ virFsPoolGetInfo;
+ virFsPoolGetXMLDesc;
+ virFsPoolSetAutostart;
+ virFsPoolGetAutostart;
+ virFsPoolNumOfItems;
+ virFsPoolListItems;
+ virFsPoolRef;
+ virFsItemRef;
+ virFsItemCreateXMLFrom;
+ virFsItemGetConnect;
+ virFsItemLookupByName;
+ virFsItemLookupByKey;
+ virFsItemLookupByPath;
+ virFsItemCreateXML;
+ virFsItemDelete;
+ virFsItemFree;
+ virFsItemGetName;
+ virFsItemGetKey;
+ virFsItemGetInfo;
+ virFsItemGetXMLDesc;
+ virFsItemGetPath;
+ virFsPoolIsActive;
+ virFsPoolIsPersistent;
} LIBVIRT_1.3.3;
LIBVIRT_2.2.0 {
diff --git a/src/util/virerror.c b/src/util/virerror.c
index 1177570..b2d1329 100644
--- a/src/util/virerror.c
+++ b/src/util/virerror.c
@@ -138,6 +138,7 @@ VIR_ENUM_IMPL(virErrorDomain, VIR_ERR_DOMAIN_LAST,
"Xen XL Config",
"Perf",
+ "Fs Driver"
)
@@ -1394,6 +1395,42 @@ virErrorMsg(virErrorNumber error, const char *info)
else
errmsg = _("Client not found: %s");
break;
+ case VIR_ERR_INVALID_FS_POOL:
+ if (info == NULL)
+ errmsg = _("invalid fspool poiter in");
+ else
+ errmsg = _("invalid fspool pointer in %s");
+ break;
+ case VIR_ERR_INVALID_FS_ITEM:
+ if (info == NULL)
+ errmsg = _("invalid fsitem pointer in");
+ else
+ errmsg = _("invalid fsitem pointer in %s");
+ break;
+ case VIR_WAR_NO_FS_POOL:
+ if (info == NULL)
+ errmsg = _("Failed to find a fs driver");
+ else
+ errmsg = _("Failed to find a fs driver: %s");
+ break;
+ case VIR_ERR_NO_FS_POOL:
+ if (info == NULL)
+ errmsg = _("Fspool not found");
+ else
+ errmsg = _("Fspool not found: %s");
+ break;
+ case VIR_ERR_NO_FS_ITEM:
+ if (info == NULL)
+ errmsg = _("Fspool item not found");
+ else
+ errmsg = _("Fspool item not found: %s");
+ break;
+ case VIR_ERR_FS_ITEM_EXIST:
+ if (info == NULL)
+ errmsg = _("Fspool item exists");
+ else
+ errmsg = _("Fspool item exists: %s");
+ break;
}
return errmsg;
}
--
1.8.3.1