Discussion:
[Libstoragemgmt-devel] [PATCH 1/2] C API: Fix documentation
Tony Asleson
2014-03-17 23:30:18 UTC
Permalink
lsmConnectUserPass -> lsmConnectPassword
---
include/libstoragemgmt/libstoragemgmt.h | 40 ++++++++++++++++-----------------
1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/include/libstoragemgmt/libstoragemgmt.h b/include/libstoragemgmt/libstoragemgmt.h
index 9ec7bb9..ea81ef1 100644
--- a/include/libstoragemgmt/libstoragemgmt.h
+++ b/include/libstoragemgmt/libstoragemgmt.h
@@ -81,7 +81,7 @@ extern "C" {
/**
* Retrieve information about the plug-in
* NOTE: Caller needs to free desc and version!
- * @param[in] conn Valid connection @see lsmConnectUserPass
+ * @param[in] conn Valid connection @see lsmConnectPassword
* @param[out] desc Plug-in description
* @param[out] version Plug-in version
* @param [in] flags Reserved for future use, must be zero.
@@ -104,7 +104,7 @@ extern "C" {

/**
* Sets the time-out for this connection.
- * @param[in] conn Valid connection @see lsmConnectUserPass
+ * @param[in] conn Valid connection @see lsmConnectPassword
* @param[in] timeout Time-out (in ms)
* @param[in] flags Reserved for future use, must be zero.
* @return LSM_ERR_OK on success, else error reason
@@ -114,7 +114,7 @@ extern "C" {

/**
* Gets the time-out for this connection.
- * @param[in] conn Valid connection @see lsmConnectUserPass
+ * @param[in] conn Valid connection @see lsmConnectPassword
* @param[out] timeout Time-out (in ms)
* @param[in] flags Reserved for future use, must be zero.
* @return LSM_ERR_OK on success, else error reason
@@ -196,7 +196,7 @@ extern "C" {

/**
* Query the capabilities of the storage array.
- * @param[in] conn Valid connection @see lsmConnectUserPass
+ * @param[in] conn Valid connection @see lsmConnectPassword
* @param[in] system System of interest
* @param[out] cap The storage array capabilities
* @param[in] flags Reserved for future use, must be zero.
@@ -209,7 +209,7 @@ extern "C" {

/**
* Query the list of storage pools on the array.
- * @param[in] conn Valid connection @see lsmConnectUserPass
+ * @param[in] conn Valid connection @see lsmConnectPassword
* @param[out] poolArray Array of storage pools
* @param[out] count Number of storage pools
* @param[in] flags Reserved for future use, must be zero.
@@ -220,7 +220,7 @@ extern "C" {

/**
* Query the list of initiators known to the array
- * @param[in] conn Valid connection @see lsmConnectUserPass
+ * @param[in] conn Valid connection @see lsmConnectPassword
* @param[out] initiators Array of initiators
* @param[out] count Number of initiators
* @param[in] flags Reserved for future use, must be zero.
@@ -236,7 +236,7 @@ extern "C" {

/**
* Gets a list of logical units for this array.
- * @param[in] conn Valid connection @see lsmConnectUserPass
+ * @param[in] conn Valid connection @see lsmConnectPassword
* @param[out] volumes An array of lsmVolume_t
* @param[out] count Number of elements in the lsmVolume_t array
* @param[in] flags Reserved for future use, must be zero.
@@ -247,7 +247,7 @@ extern "C" {

/**
* Get a list of disk for this array.
- * @param [in] conn Valid connection @see lsmConnectUserPass
+ * @param [in] conn Valid connection @see lsmConnectPassword
* @param [out] disks An array of lsmDisk types
* @param [out] count Number of disks
* @param [in] flags Use LSM_DISK_RETRIEVE_FULL_INFO for all data, else 0
@@ -258,7 +258,7 @@ extern "C" {

/**
* Creates a new volume (aka. LUN).
- * @param[in] conn Valid connection @see lsmConnectUserPass
+ * @param[in] conn Valid connection @see lsmConnectPassword
* @param[in] pool Valid pool @see lsmPool_t (OPTIONAL, use NULL for plug-in choice)
* @param[in] volumeName Human recognizable name (not all arrays support)
* @param[in] size Size of new volume in bytes (actual size will
@@ -277,7 +277,7 @@ extern "C" {

/**
* Resize an existing volume.
- * @param[in] conn Valid connection @see lsmConnectUserPass
+ * @param[in] conn Valid connection @see lsmConnectPassword
* @param[in] volume volume to resize
* @param[in] newSize New size of volume
* @param[out] resizedVolume Pointer to newly resized lun.
@@ -291,7 +291,7 @@ extern "C" {

/**
* Replicates a volume
- * @param[in] conn Valid connection @see lsmConnectUserPass
+ * @param[in] conn Valid connection @see lsmConnectPassword
* @param[in] pool Valid pool
* @param[in] repType Type of replication lsmReplicationType
* @param[in] volumeSrc Which volume to replicate
@@ -341,7 +341,7 @@ extern "C" {

/**
* Deletes a logical unit and data is lost!
- * @param[in] conn Valid connection @see lsmConnectUserPass
+ * @param[in] conn Valid connection @see lsmConnectPassword
* @param[in] volume Volume that is to be deleted.
* @param[out] job Indicates job id
* @param[in] flags Reserved for future use, must be zero.
@@ -352,7 +352,7 @@ extern "C" {

/**
* Set a Volume to online
- * @param[in] conn Valid connection @see lsmConnectUserPass
+ * @param[in] conn Valid connection @see lsmConnectPassword
* @param[in] volume Volume that is to be placed online
* @param[in] flags Reserved for future use, must be zero.
* @return LSM_ERR_OK on success, else error code
@@ -362,7 +362,7 @@ extern "C" {

/**
* Set a Volume to offline
- * @param[in] conn Valid connection @see lsmConnectUserPass
+ * @param[in] conn Valid connection @see lsmConnectPassword
* @param[in] volume Volume that is to be placed online
* @param[in] flags Reserved for future use, must be zero.
* @return LSM_ERR_OK on success, else error code
@@ -391,7 +391,7 @@ extern "C" {

/**
* Access control for allowing an initiator to use a volume.
- * @param[in] conn Valid connection @see lsmConnectUserPass
+ * @param[in] conn Valid connection @see lsmConnectPassword
* @param[in] initiator_id Initiator to grant access to volume
* @param[in] initiator_type Type of initiator we are adding
* @param[in] volume Volume to allow access to
@@ -422,7 +422,7 @@ extern "C" {

/**
* Retrieves a list of access groups.
- * @param[in] conn Valid connection @see lsmConnectUserPass
+ * @param[in] conn Valid connection @see lsmConnectPassword
* @param[out] groups Array of access groups
* @param[out] groupCount Size of array
* @param[in] flags Reserved for future use, must be zero.
@@ -435,7 +435,7 @@ extern "C" {

/**
* Creates a new access group with one initiator in it.
- * @param[in] conn Valid connection @see lsmConnectUserPass
+ * @param[in] conn Valid connection @see lsmConnectPassword
* @param[in] name Name of access group
* @param[in] initiator_id Initiator id to be added to group
* @param[in] id_type Initiator type
@@ -454,7 +454,7 @@ extern "C" {

/**
* Deletes an access group.
- * @param[in] conn Valid connection @see lsmConnectUserPass
+ * @param[in] conn Valid connection @see lsmConnectPassword
* @param[in] group Group to delete
* @param[in] flags Reserved for future use, must be zero.
* @return LSM_ERR_OK on success, else error reason.
@@ -464,7 +464,7 @@ extern "C" {

/**
* Adds an initiator to the access group
- * @param[in] conn Valid connection @see lsmConnectUserPass
+ * @param[in] conn Valid connection @see lsmConnectPassword
* @param[in] group Group to modify
* @param[in] initiator_id Initiator to add to group
* @param[in] id_type Type of initiator
@@ -478,7 +478,7 @@ extern "C" {

/**
* Removes an initiator from an access group.
- * @param[in] conn Valid connection @see lsmConnectUserPass
+ * @param[in] conn Valid connection @see lsmConnectPassword
* @param[in] group Group to modify
* @param[in] initiator_id Initiator to delete from group
* @param[in] flags Reserved for future use, must be zero.
--
1.8.2.1
Tony Asleson
2014-03-17 23:30:19 UTC
Permalink
Signed-off-by: Tony Asleson <***@redhat.com>
---
include/libstoragemgmt/libstoragemgmt.h | 106 +++++++++++++
include/libstoragemgmt/libstoragemgmt_types.h | 38 +++++
src/lsm_mgmt.cpp | 215 ++++++++++++++++++++++++++
3 files changed, 359 insertions(+)

diff --git a/include/libstoragemgmt/libstoragemgmt.h b/include/libstoragemgmt/libstoragemgmt.h
index ea81ef1..69fddf2 100644
--- a/include/libstoragemgmt/libstoragemgmt.h
+++ b/include/libstoragemgmt/libstoragemgmt.h
@@ -219,6 +219,112 @@ extern "C" {
uint32_t *count, lsmFlag_t flags);

/**
+ * Create new pool allowing the array to make the most decisions.
+ * @param [in] conn Valid connection @see lsmConnectPass
+ * @param [in] system_id System ID of where pool will reside
+ * @param [in] pool_name Name of new pool
+ * @param [in] size_bytes Size of new pool in bytes
+ * @param [in] raid_type Optional. If defined, new pool should
+ * using defined RAID type. When
+ * member_type was set to LSM_POOL_MEMBER_TYPE_POOL,
+ * only allowed raid_type is LSM_POOL_RAID_TYPE_UNKNOWN or
+ * LSM_POOL_RAID_TYPE_NOT_APPLICABLE
+ * @param [in] member_type Optional. If defined, new pool will be assembled
+ * by defined member types. For example;
+ * when member_type == LSM_POOL_MEMBER_TYPE_DISK_SAS,
+ * new pool will be created from SAS disks
+ * only.
+ * @param [out] pool Newly created pool
+ * @param [out] job Job ID of aysnc.
+ * @param [in] flags Reserved for future use, must be zero
+ * @return LSM_ERR_OK on success, LSM_ERR_JOB_STARTED if async.,
+ * else error code
+ */
+ int LSM_DLL_EXPORT lsmPoolCreate(lsmConnect *conn, const char *system_id,
+ const char *pool_name, uint64_t size_bytes,
+ lsmPoolRaidType raid_type,
+ lsmPoolMemberType member_type, lsmPool** pool,
+ char **job, lsmFlag_t flags);
+
+ /**
+ * Create a pool specifying specific disks to use.
+ * @param [in] conn Valid connection @see lsmConnectPass
+ * @param [in] system_id System ID of where pool will reside
+ * @param [in] pool_name The name of the new pool, will not fail
+ * if request name cannot be fulfilled
+ * @param [in] member_ids The IDs of disks to create new pool from
+ * The new pool could contain more disks
+ * than requested due to internal needs,
+ * but if possible should only contain
+ * requested disks.
+ * @param [in] raid_type The RAID type for new pool
+ * @param [out] pool Newly created pool
+ * @param [out] job Job ID of aysnc.
+ * @param [in] flags Reserved for future use, must be zero
+ * @return LSM_ERR_OK on success, LSM_ERR_JOB_STARTED if async.,
+ * else error code
+ */
+ int LSM_DLL_EXPORT lsmPoolCreateFromDisks(lsmConnect *conn,
+ const char *system_id, const char *pool_name,
+ lsmStringList *member_ids, lsmPoolRaidType raid_type,
+ lsmPool** pool, char **job, lsmFlag_t flags);
+
+ /**
+ * Create new pool in by specifying which volumes should be used for pool
+ * creation.
+ * @param [in] conn Valid connection @see lsmConnectPass
+ * @param [in] system_id System ID of where pool will reside
+ * @param [in] pool_name The name of the new pool, will not fail
+ * if request name cannot be fulfilled
+ * @param [in] member_ids The IDs of volumes to create new pool from
+ * The new pool could contain more volumes
+ * than requested due to internal needs,
+ * but if possible should only contain
+ * requested volumes.
+ * @param [in] raid_type The RAID type for new pool
+ * @param [out] pool Newly created pool
+ * @param [out] job Job ID of aysnc.
+ * @param [in] flags Reserved for future use, must be zero
+ * @return LSM_ERR_OK on success, LSM_ERR_JOB_STARTED if async.,
+ * else error code
+ */
+ int LSM_DLL_EXPORT lsmPoolCreateFromVolumes(lsmConnect *conn,
+ const char *system_id, const char *pool_name,
+ lsmStringList *member_ids, lsmPoolRaidType raid_type,
+ lsmPool** pool, char **job, lsmFlag_t flags);
+
+ /**
+ * Create new pool from an existing pool
+ * @param [in] conn Valid connection @see lsmConnectPass
+ * @param [in] system_id System ID of where pool will reside
+ * @param [in] pool_name The name of the new pool, will not fail
+ * if request name cannot be fulfilled
+ * @param [in] member_id The ID of pool to create new pool from
+ * @param [in] size_bytes Desired size of new pool
+ * @param [out] pool Newly created pool
+ * @param [out] job Job ID of aysnc.
+ * @param [in] flags Reserved for future use, must be zero
+ * @return LSM_ERR_OK on success, LSM_ERR_JOB_STARTED if async.,
+ * else error code
+ */
+ int LSM_DLL_EXPORT lsmPoolCreateFromPool(lsmConnect *conn,
+ const char *system_id, const char *pool_name,
+ const char *member_id, uint64_t size_bytes,
+ lsmPool** pool, char **job, lsmFlag_t flags);
+
+ /**
+ * Deletes a pool
+ * @param [in] conn Valid connection @see lsmConnectPass
+ * @param [in] pool The pool to delete
+ * @param [out] job_id Job id of job if async.
+ * @param [in] flags Reserved for future use, must be zero
+ * @return LSM_ERR_OK on success, LSM_ERR_JOB_STARTED if async.,
+ * else error code
+ */
+ int LSM_DLL_EXPORT lsmPoolDelete(lsmConnect *conn, lsmPool *pool,
+ char **job_id, lsmFlag_t flags);
+
+ /**
* Query the list of initiators known to the array
* @param[in] conn Valid connection @see lsmConnectPassword
* @param[out] initiators Array of initiators
diff --git a/include/libstoragemgmt/libstoragemgmt_types.h b/include/libstoragemgmt/libstoragemgmt_types.h
index acb9009..fd793f9 100644
--- a/include/libstoragemgmt/libstoragemgmt_types.h
+++ b/include/libstoragemgmt/libstoragemgmt_types.h
@@ -238,6 +238,44 @@ typedef enum {
#define LSM_POOL_STATUS_SHRINKING 0x0000000000010000
#define LSM_POOL_STATUS_DESTROYING 0x0000000000020000

+typedef enum {
+ LSM_POOL_MEMBER_TYPE_UNKNOWN = 0,
+ LSM_POOL_MEMBER_TYPE_DISK = 1,
+ LSM_POOL_MEMBER_TYPE_POOL = 2,
+ LSM_POOL_MEMBER_TYPE_VOLUME = 3,
+ LSM_POOL_MEMBER_TYPE_DISK_MIX = 10,
+ LSM_POOL_MEMBER_TYPE_DISK_ATA = 11,
+ LSM_POOL_MEMBER_TYPE_DISK_SATA = 12,
+ LSM_POOL_MEMBER_TYPE_DISK_SAS = 13,
+ LSM_POOL_MEMBER_TYPE_DISK_FC = 14,
+ LSM_POOL_MEMBER_TYPE_DISK_SOP = 15,
+ LSM_POOL_MEMBER_TYPE_DISK_SCSI = 16,
+ LSM_POOL_MEMBER_TYPE_DISK_NL_SAS = 17,
+ LSM_POOL_MEMBER_TYPE_DISK_HDD = 18,
+ LSM_POOL_MEMBER_TYPE_DISK_SSD = 19,
+ LSM_POOL_MEMBER_TYPE_DISK_HYBRID = 110
+} lsmPoolMemberType;
+
+typedef enum {
+ LSM_POOL_RAID_TYPE_0 = 0,
+ LSM_POOL_RAID_TYPE_1 = 1,
+ LSM_POOL_RAID_TYPE_3 = 3,
+ LSM_POOL_RAID_TYPE_4 = 4,
+ LSM_POOL_RAID_TYPE_5 = 5,
+ LSM_POOL_RAID_TYPE_6 = 6,
+ LSM_POOL_RAID_TYPE_10 = 10,
+ LSM_POOL_RAID_TYPE_15 = 15,
+ LSM_POOL_RAID_TYPE_16 = 16,
+ LSM_POOL_RAID_TYPE_50 = 50,
+ LSM_POOL_RAID_TYPE_60 = 60,
+ LSM_POOL_RAID_TYPE_51 = 51,
+ LSM_POOL_RAID_TYPE_61 = 61,
+ LSM_POOL_RAID_TYPE_JBOD = 20,
+ LSM_POOL_RAID_TYPE_UNKNOWN = 21,
+ LSM_POOL_RAID_TYPE_NOT_APPLICABLE = 22,
+ LSM_POOL_RAID_TYPE_MIXED = 23
+} lsmPoolRaidType;
+
#ifdef __cplusplus
}
#endif
diff --git a/src/lsm_mgmt.cpp b/src/lsm_mgmt.cpp
index 4bc1c37..3d0520b 100644
--- a/src/lsm_mgmt.cpp
+++ b/src/lsm_mgmt.cpp
@@ -830,6 +830,221 @@ static void* parse_job_response(lsmConnect *c, Value response, int &rc,
return val;
}

+static int valid_pool_raid_type(lsmPoolRaidType validate)
+{
+ switch(validate) {
+ case (LSM_POOL_RAID_TYPE_0):
+ case (LSM_POOL_RAID_TYPE_1):
+ case (LSM_POOL_RAID_TYPE_3):
+ case (LSM_POOL_RAID_TYPE_5):
+ case (LSM_POOL_RAID_TYPE_6):
+ case (LSM_POOL_RAID_TYPE_10):
+ case (LSM_POOL_RAID_TYPE_15):
+ case (LSM_POOL_RAID_TYPE_16):
+ case (LSM_POOL_RAID_TYPE_50):
+ case (LSM_POOL_RAID_TYPE_60):
+ case (LSM_POOL_RAID_TYPE_51):
+ case (LSM_POOL_RAID_TYPE_61):
+ case (LSM_POOL_RAID_TYPE_JBOD):
+ case (LSM_POOL_RAID_TYPE_UNKNOWN):
+ case (LSM_POOL_RAID_TYPE_NOT_APPLICABLE):
+ case (LSM_POOL_RAID_TYPE_MIXED):
+ break;
+ default:
+ return 0;
+ }
+ return 1;
+}
+
+static int valid_pool_member_type(lsmPoolMemberType validate)
+{
+ switch(validate) {
+ case (LSM_POOL_MEMBER_TYPE_UNKNOWN):
+ case (LSM_POOL_MEMBER_TYPE_DISK):
+ case (LSM_POOL_MEMBER_TYPE_POOL):
+ case (LSM_POOL_MEMBER_TYPE_VOLUME):
+ case (LSM_POOL_MEMBER_TYPE_DISK_MIX):
+ case (LSM_POOL_MEMBER_TYPE_DISK_ATA):
+ case (LSM_POOL_MEMBER_TYPE_DISK_SATA):
+ case (LSM_POOL_MEMBER_TYPE_DISK_SAS):
+ case (LSM_POOL_MEMBER_TYPE_DISK_FC):
+ case (LSM_POOL_MEMBER_TYPE_DISK_SOP):
+ case (LSM_POOL_MEMBER_TYPE_DISK_SCSI):
+ case (LSM_POOL_MEMBER_TYPE_DISK_NL_SAS):
+ case (LSM_POOL_MEMBER_TYPE_DISK_HDD):
+ case (LSM_POOL_MEMBER_TYPE_DISK_SSD):
+ case (LSM_POOL_MEMBER_TYPE_DISK_HYBRID):
+ break;
+ default:
+ return 0;
+ }
+ return 1;
+}
+
+int lsmPoolCreate(lsmConnect *c, const char *system_id,
+ const char *pool_name, uint64_t size_bytes,
+ lsmPoolRaidType raid_type,
+ lsmPoolMemberType member_type, lsmPool** pool,
+ char **job, lsmFlag_t flags)
+{
+ CONN_SETUP(c);
+
+ if( CHECK_STR(system_id) || CHECK_STR(pool_name) || !size_bytes ||
+ CHECK_RP(pool)|| CHECK_RP(job) || LSM_FLAG_UNUSED_CHECK(flags) ||
+ !valid_pool_raid_type(raid_type) ||
+ !valid_pool_member_type(member_type)) {
+ return LSM_ERR_INVALID_ARGUMENT;
+ }
+
+ std::map<std::string, Value> p;
+ p["system_id"] = Value(system_id);
+ p["pool_name"] = Value(pool_name);
+ p["size_bytes"] = Value(size_bytes);
+ p["raid_type"] = Value((int32_t)raid_type);
+ p["member_type"] = Value((int32_t)member_type);
+ p["flags"] = Value(flags);
+
+ Value parameters(p);
+ Value response;
+
+ int rc = rpc(c, "pool_create", parameters, response);
+ if( LSM_ERR_OK == rc ) {
+ *pool = (lsmPool *)parse_job_response(c, response, rc, job,
+ (convert)valueToPool);
+ }
+ return rc;
+}
+
+
+static int lsm_pool_create_from(lsmConnect *c,
+ const char *system_id, const char *pool_name,
+ lsmStringList *member_ids, lsmPoolRaidType raid_type,
+ lsmPool** pool, char **job, lsmFlag_t flags,
+ const char *method)
+{
+ CONN_SETUP(c);
+
+ if( CHECK_STR(system_id) || CHECK_STR(pool_name) ||
+ CHECK_RP(pool)|| CHECK_RP(job) || LSM_FLAG_UNUSED_CHECK(flags) ||
+ !valid_pool_raid_type(raid_type) ) {
+ return LSM_ERR_INVALID_ARGUMENT;
+ }
+
+ if( !LSM_IS_STRING_LIST(member_ids) ) {
+ return LSM_ERR_INVALID_SL;
+ }
+
+ std::map<std::string, Value> p;
+ p["system_id"] = Value(system_id);
+ p["pool_name"] = Value(pool_name);
+ p["member_ids"] = stringListToValue(member_ids);
+ p["raid_type"] = Value((int32_t)raid_type);
+ p["flags"] = Value(flags);
+
+ Value parameters(p);
+ Value response;
+
+ int rc = rpc(c, method, parameters, response);
+ if( LSM_ERR_OK == rc ) {
+ *pool = (lsmPool *)parse_job_response(c, response, rc, job,
+ (convert)valueToPool);
+ }
+ return rc;
+}
+
+int LSM_DLL_EXPORT lsmPoolCreateFromDisks(lsmConnect *c,
+ const char *system_id, const char *pool_name,
+ lsmStringList *member_ids, lsmPoolRaidType raid_type,
+ lsmPool** pool, char **job, lsmFlag_t flags)
+{
+ return lsm_pool_create_from(c, system_id, pool_name, member_ids, raid_type,
+ pool, job, flags, "lsm_pool_create_from_disks");
+}
+
+int LSM_DLL_EXPORT lsmPoolCreateFromVolumes(lsmConnect *c,
+ const char *system_id, const char *pool_name,
+ lsmStringList *member_ids, lsmPoolRaidType raid_type,
+ lsmPool** pool, char **job, lsmFlag_t flags)
+{
+ return lsm_pool_create_from(c, system_id, pool_name, member_ids, raid_type,
+ pool, job, flags,
+ "lsm_pool_create_from_volumes");
+}
+
+
+ int lsmPoolCreateFromPool(lsmConnect *c, const char *system_id,
+ const char *pool_name, const char *member_id,
+ uint64_t size_bytes, lsmPool **pool, char **job,
+ lsmFlag_t flags)
+ {
+ CONN_SETUP(c);
+
+ if( CHECK_STR(system_id) || CHECK_STR(pool_name) || CHECK_STR(member_id) ||
+ !size_bytes || CHECK_RP(pool)|| CHECK_RP(job) ||
+ LSM_FLAG_UNUSED_CHECK(flags) ) {
+ return LSM_ERR_INVALID_ARGUMENT;
+ }
+
+ std::map<std::string, Value> p;
+ p["system_id"] = Value(system_id);
+ p["pool_name"] = Value(pool_name);
+ p["size_bytes"] = Value(size_bytes);
+ p["member_id"] = Value(member_id);
+ p["flags"] = Value(flags);
+
+ Value parameters(p);
+ Value response;
+
+ int rc = rpc(c, "pool_create_from_pool", parameters, response);
+ if( LSM_ERR_OK == rc ) {
+ *pool = (lsmPool *)parse_job_response(c, response, rc, job,
+ (convert)valueToPool);
+ }
+ return rc;
+ }
+
+int lsmPoolDelete(lsmConnect *c, lsmPool *pool, char **job, lsmFlag_t flags)
+{
+ int rc;
+ CONN_SETUP(c);
+
+ if( !LSM_IS_POOL(pool) ) {
+ return LSM_ERR_INVALID_POOL;
+ }
+
+ if (CHECK_RP(job) || LSM_FLAG_UNUSED_CHECK(flags) ) {
+ return LSM_ERR_INVALID_ARGUMENT;
+ }
+
+ try {
+
+ std::map<std::string, Value> p;
+ p["pool"] = poolToValue(pool);
+ p["flags"] = Value(flags);
+
+ Value parameters(p);
+ Value response;
+
+ rc = rpc(c, "pool_delete", parameters, response);
+ if( LSM_ERR_OK == rc ) {
+ //We get a value back, either null or job id.
+ if( Value::string_t == response.valueType() ) {
+ *job = strdup(response.asString().c_str());
+
+ if( *job ) {
+ rc = LSM_ERR_JOB_STARTED;
+ } else {
+ rc = LSM_ERR_NO_MEMORY;
+ }
+ }
+ }
+ } catch( const ValueException &ve ) {
+ rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type",
+ ve.what());
+ }
+ return rc;
+ }
+
int lsmVolumeCreate(lsmConnect *c, lsmPool *pool, const char *volumeName,
uint64_t size, lsmProvisionType provisioning,
lsmVolume **newVolume, char **job, lsmFlag_t flags)
--
1.8.2.1
Loading...