This patch adds a public header file defining the application facing contract
for the storage APIs.
b/include/libvirt/storage.h | 215 +++++++++++++++++++++++++++++++++++++++++++
include/libvirt/libvirt.h | 1
include/libvirt/libvirt.h.in | 1
src/libvirt_sym.version | 39 +++++++
4 files changed, 256 insertions(+)
diff -r a123e74573bb include/libvirt/libvirt.h
--- a/include/libvirt/libvirt.h Sat Oct 27 13:36:24 2007 -0400
+++ b/include/libvirt/libvirt.h Sat Oct 27 16:18:43 2007 -0400
@@ -20,6 +20,7 @@
#include <libvirt/node.h>
#include <libvirt/domain.h>
#include <libvirt/network.h>
+#include <libvirt/storage.h>
#ifdef __cplusplus
extern "C" {
diff -r a123e74573bb include/libvirt/libvirt.h.in
--- a/include/libvirt/libvirt.h.in Sat Oct 27 13:36:24 2007 -0400
+++ b/include/libvirt/libvirt.h.in Sat Oct 27 16:18:43 2007 -0400
@@ -20,6 +20,7 @@
#include <libvirt/node.h>
#include <libvirt/domain.h>
#include <libvirt/network.h>
+#include <libvirt/storage.h>
#ifdef __cplusplus
extern "C" {
diff -r a123e74573bb include/libvirt/storage.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/include/libvirt/storage.h Sat Oct 27 16:18:43 2007 -0400
@@ -0,0 +1,215 @@
+/* -*- c -*-
+ * storage.h:
+ * Summary: storage management interfaces
+ * Description: Provides the interfaces of the libvirt library to handle
+ * storage management from a process running in the host
+ *
+ * Copy: Copyright (C) 2005-2007 Red Hat, Inc.
+ *
+ * See COPYING.LIB for the License of this software
+ *
+ * Author: Daniel Veillard <veillard(a)redhat.com>
+ */
+
+
+
+#ifndef __VIR_VIRLIB_H__
+#error "Do not include storage.h directly. Use libvirt.h instead"
+#endif
+
+#ifndef __VIR_VIRLIB_STORAGE_H__
+#define __VIR_VIRLIB_STORAGE_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * virStoragePool:
+ *
+ * a virStoragePool is a private structure representing a storage pool
+ */
+typedef struct _virStoragePool virStoragePool;
+
+/**
+ * virStoragePoolPtr:
+ *
+ * a virStoragePoolPtr is pointer to a virStoragePool private structure, this is the
+ * type used to reference a storage pool in the API.
+ */
+typedef virStoragePool *virStoragePoolPtr;
+
+
+typedef enum {
+ VIR_STORAGE_POOL_INACTIVE = 0,
+ VIR_STORAGE_POOL_ACTIVE = 1,
+} virStoragePoolState;
+
+typedef struct _virStoragePoolInfo virStoragePoolInfo;
+
+struct _virStoragePoolInfo {
+ int state; /* virStoragePoolState flags */
+ unsigned long long capacity; /* Logical size bytes */
+ unsigned long long allocation; /* Current allocation bytes */
+};
+
+typedef virStoragePoolInfo *virStoragePoolInfoPtr;
+
+
+/**
+ * virStorageVol:
+ *
+ * a virStorageVol is a private structure representing a storage volume
+ */
+typedef struct _virStorageVol virStorageVol;
+
+/**
+ * virStorageVolPtr:
+ *
+ * a virStorageVolPtr is pointer to a virStorageVol private structure, this is the
+ * type used to reference a storage volume in the API.
+ */
+typedef virStorageVol *virStorageVolPtr;
+
+
+typedef enum {
+ VIR_STORAGE_POOL_FILE = 0,
+ VIR_STORAGE_POOL_BLOCK = 1,
+} virStoragePoolType;
+
+typedef struct _virStorageVolInfo virStorageVolInfo;
+
+struct _virStorageVolInfo {
+ int type; /* virStoragePoolType flags */
+ unsigned long long capacity; /* Logical size bytes */
+ unsigned long long allocation; /* Current allocation bytes */
+};
+
+typedef virStorageVolInfo *virStorageVolInfoPtr;
+
+/*
+ * Get connection from pool.
+ */
+virConnectPtr virStoragePoolGetConnect (virStoragePoolPtr pool);
+
+/*
+ * List active storage pools
+ */
+int virConnectNumOfStoragePools (virConnectPtr conn);
+int virConnectListStoragePools (virConnectPtr conn,
+ char **const names,
+ int maxnames);
+
+/*
+ * List inactive storage pools
+ */
+int virConnectNumOfDefinedStoragePools(virConnectPtr conn);
+int virConnectListDefinedStoragePools(virConnectPtr conn,
+ char **const names,
+ int maxnames);
+
+/*
+ * Lookup network by name or uuid
+ */
+virStoragePoolPtr virStoragePoolLookupByName(virConnectPtr conn,
+ const char *name);
+virStoragePoolPtr virStoragePoolLookupByUUID(virConnectPtr conn,
+ const unsigned char *uuid);
+virStoragePoolPtr virStoragePoolLookupByUUIDString(virConnectPtr conn,
+ const char *uuid);
+
+/*
+ * Create active transient storage pool
+ */
+virStoragePoolPtr virStoragePoolCreateXML(virConnectPtr conn,
+ const char *xmlDesc);
+
+/*
+ * Define inactive persistent storage pool
+ */
+virStoragePoolPtr virStoragePoolDefineXML(virConnectPtr conn,
+ const char *xmlDesc);
+
+/*
+ * Delete persistent storage pool
+ */
+int virStoragePoolUndefine(virStoragePoolPtr pool);
+
+/*
+ * Activate persistent pool
+ */
+int virStoragePoolCreate(virStoragePoolPtr pool);
+
+/*
+ * StoragePool destroy/free
+ */
+int virStoragePoolShutdown(virStoragePoolPtr pool);
+int virStoragePoolDestroy (virStoragePoolPtr pool);
+int virStoragePoolFree (virStoragePoolPtr pool);
+
+/*
+ * StoragePool information
+ */
+const char* virStoragePoolGetName (virStoragePoolPtr pool);
+int virStoragePoolGetUUID (virStoragePoolPtr pool,
+ unsigned char *uuid);
+int virStoragePoolGetUUIDString(virStoragePoolPtr pool,
+ char *buf);
+
+int virStoragePoolGetInfo(virStoragePoolPtr vol,
+ virStoragePoolInfoPtr info);
+
+char * virStoragePoolGetXMLDesc(virStoragePoolPtr pool,
+ int flags);
+
+int virStoragePoolGetAutostart(virStoragePoolPtr pool,
+ int *autostart);
+int virStoragePoolSetAutostart(virStoragePoolPtr pool,
+ int autostart);
+
+
+
+/*
+ * List storage volumes within a pool
+ */
+int virStoragePoolNumOfVolumes(virStoragePoolPtr pool);
+int virStoragePoolListVolumes (virStoragePoolPtr pool,
+ char **const names,
+ int maxnames);
+
+/*
+ * Lookup network by name or uuid
+ */
+virStorageVolPtr virStorageVolLookupByName(virStoragePoolPtr pool,
+ const char *name);
+virStorageVolPtr virStorageVolLookupByUUID(virStoragePoolPtr pool,
+ const unsigned char *uuid);
+virStorageVolPtr virStorageVolLookupByUUIDString(virStoragePoolPtr pool,
+ const char *uuid);
+
+const char* virStorageVolGetName (virStorageVolPtr vol);
+int virStorageVolGetUUID (virStorageVolPtr vol,
+ unsigned char *uuid);
+int virStorageVolGetUUIDString(virStorageVolPtr vol,
+ char *buf);
+
+
+virStorageVolPtr virStorageVolCreateXML(virStoragePoolPtr pool,
+ const char *xmldesc,
+ int flags);
+
+int virStorageVolDestroy(virStorageVolPtr vol);
+int virStorageVolFree(virStorageVolPtr vol);
+
+int virStorageVolGetInfo(virStorageVolPtr vol,
+ virStorageVolInfoPtr info);
+char * virStorageVolGetXMLDesc(virStorageVolPtr pool,
+ int flags);
+
+char * virStorageVolGetPath(virStorageVolPtr vol);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __VIR_VIRLIB_STORAGE_H__ */
diff -r a123e74573bb src/libvirt_sym.version
--- a/src/libvirt_sym.version Sat Oct 27 13:36:24 2007 -0400
+++ b/src/libvirt_sym.version Sat Oct 27 16:56:25 2007 -0400
@@ -97,6 +97,43 @@
virNetworkGetAutostart;
virNetworkSetAutostart;
+ virConnectNumOfStoragePools;
+ virConnectNumOfDefinedStoragePools;
+ virConnectListStoragePools;
+ virConnectListDefinedStoragePools;
+ virStoragePoolCreateXML;
+ virStoragePoolDefineXML;
+ virStoragePoolCreate;
+ virStoragePoolUndefine;
+ virStoragePoolShutdown;
+ virStoragePoolDestroy;
+ virStoragePoolFree;
+ virStoragePoolLookupByName;
+ virStoragePoolLookupByUUID;
+ virStoragePoolLookupByUUIDString;
+ virStoragePoolGetName;
+ virStoragePoolGetUUID;
+ virStoragePoolGetUUIDString;
+ virStoragePoolGetInfo;
+ virStoragePoolGetXMLDesc;
+ virStoragePoolSetAutostart;
+ virStoragePoolGetAutostart;
+
+ virConnectNumOfStorageVolumes;
+ virConnectListStorageVolumes;
+ virStorageVolCreateXML;
+ virStorageVolDestroy;
+ virStorageVolFree;
+ virStorageVolLookupByName;
+ virStorageVolLookupByUUID;
+ virStorageVolLookupByUUIDString;
+ virStorageVolGetName;
+ virStorageVolGetUUID;
+ virStorageVolGetUUIDString;
+ virStorageVolGetInfo;
+ virStorageVolGetXMLDesc;
+ virStorageVolGetPath;
+
/* Symbols with __ are private only
for use by the libvirtd daemon.
They are not part of stable ABI
@@ -114,6 +151,8 @@
__virGetDomain;
__virGetNetwork;
+ __virGetStoragePool;
+ __virGetStorageVol;
__virEventRegisterImpl;
--
|=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=|
|=- Perl modules:
http://search.cpan.org/~danberr/ -=|
|=- Projects:
http://freshmeat.net/~danielpb/ -=|
|=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|