Discussion:
[Libstoragemgmt-devel] [PATCH 0/4] Remove pool_create_from_volumes method
Gris Ge
2014-06-19 14:22:59 UTC
Permalink
As discussed in IRC, we don't have any real storage array or plugin
support Volume Pool. For those using remove LUN as disk,
lsm.Pool.MEMBER_TYPE_LUN could be sufficient.

Gris Ge (4):
Python & C Library: remove pool_create_from_volumes()
lsmcli: Remove pool-create-from-volumes command
Plugins: Remove pool_create_from_volumes()
C unit test: remove volume pool creating test.

c_binding/include/libstoragemgmt/libstoragemgmt.h | 25 ---
.../libstoragemgmt/libstoragemgmt_capabilities.h | 16 --
.../libstoragemgmt/libstoragemgmt_plug_interface.h | 19 --
.../include/libstoragemgmt/libstoragemgmt_types.h | 1 -
c_binding/lsm_mgmt.cpp | 24 --
c_binding/lsm_plugin_ipc.cpp | 50 +----
doc/man/lsmcli.1.in | 24 --
plugin/sim/simarray.py | 245 +--------------------
plugin/sim/simulator.py | 6 -
plugin/smispy/smis.py | 7 +-
python_binding/lsm/_client.py | 27 ---
python_binding/lsm/_data.py | 18 --
python_binding/lsm/_iplugin.py | 11 -
test/tester.c | 85 -------
tools/lsmcli/cmdline.py | 44 ----
tools/lsmcli/data_display.py | 1 -
16 files changed, 7 insertions(+), 596 deletions(-)
--
1.8.3.1
Gris Ge
2014-06-19 14:23:01 UTC
Permalink
* Just remove pool-create-from-volumes command and manpage.

Signed-off-by: Gris Ge <***@redhat.com>
---
doc/man/lsmcli.1.in | 24 ------------------------
tools/lsmcli/cmdline.py | 44 --------------------------------------------
tools/lsmcli/data_display.py | 1 -
3 files changed, 69 deletions(-)

diff --git a/doc/man/lsmcli.1.in b/doc/man/lsmcli.1.in
index b22555c..9096186 100644
--- a/doc/man/lsmcli.1.in
+++ b/doc/man/lsmcli.1.in
@@ -638,30 +638,6 @@ For two or more members: '\fB--member-id DISK_ID_A --member DISK_ID_B\fR'.
\fB--sys\fR \fI<SYS_ID>\fR
Required. ID of the system to create new pool.

-.SS pool-create-from-volumes
-Create a new pool by specifying which volumes to use with which RAID type.
-This require POOL_CREATE_FROM_VOLUMES capability.
-.TP 15
-\fB--name\fR \fI<POOL_NAME>\fR
-Required. Human friendly name for new pool.
-.TP
-\fB--raid-type\fR \fI<RAID_TYPE>\fR
-Required. The RAID type of new pool. Valid values are:
-\fBNOT_APPLICABLE\fR, \fBJBOD\fR, \fBRAID0\fR, \fBRAID1\fR, \fBRAID5\fR,
-\fBRAID6\fR, \fBRAID10\fR, \fBRAID50\fR, \fBRAID51\fR, \fBRAID60\fR,
-\fBRAID61\fR.
-.br
-The \fBNOT_APPLICABLE\fR means pool only contain 1 volume.
-For supported RAID types of certain array, please use \fBcapabilities\fR
-command for POOL_CREATE_VOLUME_RAID_XXX entries.
-.TP
-\fB--member-id\fR \fI<VOL_ID>\fR
-Required. Repeatable. The ID of volume to create new pool.
-For two or more members: '\fB--member-id VOL_ID_A --member VOL_ID_B\fR'.
-.TP
-\fB--sys\fR \fI<SYS_ID>\fR
-Required. ID of the system to create new pool.
-
.SS pool-create-from-pool
Create a new sub-pool from specified pool. This require POOL_CREATE_FROM_POOLS
capability.
diff --git a/tools/lsmcli/cmdline.py b/tools/lsmcli/cmdline.py
index 7061edb..f8ed7b4 100644
--- a/tools/lsmcli/cmdline.py
+++ b/tools/lsmcli/cmdline.py
@@ -637,24 +637,6 @@ cmds = (
),

dict(
- name='pool-create-from-volumes',
- help='Creates a storage pool from volumes',
- args=[
- dict(sys_id_opt),
- dict(name="--name", metavar="<POOL_NAME>",
- help="Human friendly name for new pool"),
- dict(name="--member-id", metavar='<MEMBER_ID>',
- help='The ID of volumes to create new pool\n'
- 'This is a repeatable argument',
- action='append'),
- dict(name="--raid-type", metavar='<RAID_TYPE>',
- help=raid_help,
- choices=raid_types,
- type=str.upper),
- ],
- ),
-
- dict(
name='pool-create-from-pool',
help='Creates a sub-pool from another storage pool',
args=[
@@ -1495,32 +1477,6 @@ class CmdLine:
system, pool_name, disks_to_use, raid_type, 0))
self.display_data([pool])

- def pool_create_from_volumes(self, args):
- system = _get_item(self.c.systems(), args.sys, "system id")
- if len(args.member_id) <= 0:
- raise ArgError("No volume ID was provided for new pool")
-
- member_ids = args.member_id
- volumes = self.c.volumes()
- vol_ids = [v.id for v in volumes]
- for member_id in member_ids:
- if member_id not in vol_ids:
- raise ArgError("Invalid volumes ID specified in " +
- "--member-id %s " % member_id)
-
- raid_type = pool_raid_type_str_to_type(
- self.args.raid_type)
- if raid_type == Pool.RAID_TYPE_UNKNOWN:
- raise ArgError("Unknown RAID type specified: %s" %
- self.args.raid_type)
-
- pool_name = args.name
- pool = self._wait_for_it(
- "pool-create-from-volumes",
- *self.c.pool_create_from_volumes(
- system, pool_name, member_ids, raid_type, 0))
- self.display_data([pool])
-
def pool_create_from_pool(self, args):
system = _get_item(self.c.systems(), args.sys, "system id")
if len(args.member_id) <= 0:
diff --git a/tools/lsmcli/data_display.py b/tools/lsmcli/data_display.py
index 9c040a5..cb41996 100644
--- a/tools/lsmcli/data_display.py
+++ b/tools/lsmcli/data_display.py
@@ -180,7 +180,6 @@ _POOL_MEMBER_TYPE_CONV = {
Pool.MEMBER_TYPE_DISK_SSD: 'DISK_SSD',
Pool.MEMBER_TYPE_DISK_HYBRID: 'DISK_HYBRID',
Pool.MEMBER_TYPE_POOL: 'POOL', # Pool was created from other Pool(s).
- Pool.MEMBER_TYPE_VOLUME: 'VOLUME', # Pool was created from Volume(s).
}
--
1.8.3.1
Gris Ge
2014-06-19 14:23:00 UTC
Permalink
Removed methods:
Python: pool_create_from_volumes()
C: lsm_pool_create_from_volumes()
Removed constants:
Python: lsm.Pool.MEMBER_TYPE_VOLUME
C: LSM_POOL_MEMBER_TYPE_VOLUME
Removed capabilities:
Python:
lsm.Capabilities.POOL_CREATE_FROM_VOLUMES
lsm.Capabilities.POOL_CREATE_VOLUME_RAID_0 and etc
C:
LSM_CAP_POOL_CREATE_VOLUME_RAID_0 and etc

Signed-off-by: Gris Ge <***@redhat.com>
---
c_binding/include/libstoragemgmt/libstoragemgmt.h | 25 -----------
.../libstoragemgmt/libstoragemgmt_capabilities.h | 16 -------
.../libstoragemgmt/libstoragemgmt_plug_interface.h | 19 --------
.../include/libstoragemgmt/libstoragemgmt_types.h | 1 -
c_binding/lsm_mgmt.cpp | 24 -----------
c_binding/lsm_plugin_ipc.cpp | 50 +---------------------
python_binding/lsm/_client.py | 27 ------------
python_binding/lsm/_data.py | 18 --------
python_binding/lsm/_iplugin.py | 11 -----
9 files changed, 1 insertion(+), 190 deletions(-)

diff --git a/c_binding/include/libstoragemgmt/libstoragemgmt.h b/c_binding/include/libstoragemgmt/libstoragemgmt.h
index cd209e8..0496cce 100644
--- a/c_binding/include/libstoragemgmt/libstoragemgmt.h
+++ b/c_binding/include/libstoragemgmt/libstoragemgmt.h
@@ -291,31 +291,6 @@ extern "C" {
lsm_pool** pool, char **job, lsm_flag flags);

/**
- * Create new pool in by specifying which volumes should be used for pool
- * creation.
- * @param [in] conn Valid connection @see lsm_connect_password
- * @param [in] system System 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 lsm_pool_create_from_volumes(lsm_connect *conn,
- lsm_system *system, const char *pool_name,
- lsm_volume *volumes[], uint32_t num_volumes,
- lsm_pool_raid_type raid_type,
- lsm_pool** pool, char **job, lsm_flag flags);
-
- /**
* Create new pool from an existing pool
* @param [in] conn Valid connection @see lsm_connect_password
* @param [in] system System of where pool will reside
diff --git a/c_binding/include/libstoragemgmt/libstoragemgmt_capabilities.h b/c_binding/include/libstoragemgmt/libstoragemgmt_capabilities.h
index 2963d09..2ccbef3 100644
--- a/c_binding/include/libstoragemgmt/libstoragemgmt_capabilities.h
+++ b/c_binding/include/libstoragemgmt/libstoragemgmt_capabilities.h
@@ -120,22 +120,6 @@ typedef enum {
LSM_CAP_POOL_CREATE_DISK_RAID_16 = 153,
LSM_CAP_POOL_CREATE_DISK_RAID_NOT_APPLICABLE = 154,

- LSM_CAP_POOL_CREATE_VOLUME_RAID_0 = 160,
- LSM_CAP_POOL_CREATE_VOLUME_RAID_1 = 161,
- LSM_CAP_POOL_CREATE_VOLUME_RAID_JBOD = 162,
- LSM_CAP_POOL_CREATE_VOLUME_RAID_3 = 163,
- LSM_CAP_POOL_CREATE_VOLUME_RAID_4 = 164,
- LSM_CAP_POOL_CREATE_VOLUME_RAID_5 = 165,
- LSM_CAP_POOL_CREATE_VOLUME_RAID_6 = 166,
- LSM_CAP_POOL_CREATE_VOLUME_RAID_10 = 167,
- LSM_CAP_POOL_CREATE_VOLUME_RAID_50 = 168,
- LSM_CAP_POOL_CREATE_VOLUME_RAID_51 = 169,
- LSM_CAP_POOL_CREATE_VOLUME_RAID_60 = 170,
- LSM_CAP_POOL_CREATE_VOLUME_RAID_61 = 171,
- LSM_CAP_POOL_CREATE_VOLUME_RAID_15 = 172,
- LSM_CAP_POOL_CREATE_VOLUME_RAID_16 = 173,
- LSM_CAP_POOL_CREATE_VOLUME_RAID_NOT_APPLICABLE = 174,
-
LSM_CAP_POOL_DELETE = 200, /**< Pool delete support */

LSM_CAP_POOLS_QUICK_SEARCH = 210, /**< Seach occurs on array */
diff --git a/c_binding/include/libstoragemgmt/libstoragemgmt_plug_interface.h b/c_binding/include/libstoragemgmt/libstoragemgmt_plug_interface.h
index 7eb152c..a337c1a 100644
--- a/c_binding/include/libstoragemgmt/libstoragemgmt_plug_interface.h
+++ b/c_binding/include/libstoragemgmt/libstoragemgmt_plug_interface.h
@@ -248,24 +248,6 @@ typedef int (*lsm_plug_pool_create_from_disks)( lsm_plugin_ptr c,
lsm_pool_raid_type raid_type, lsm_pool **pool, char **job,
lsm_flag flags);

-/**
- * Create a pool and specifying volumes to use.
- * @param[in] c Valid lsm plug-in pointer
- * @param[in] system System
- * @param[in] pool_name Human name of pool
- * @param[in] volumes Array of volume pointers
- * @param[in] num_volumes Number of volumes
- * @param[in] raid_type Raid type for pool
- * @param[out] pool Newly create pool if done sync.
- * @param[out] job Job id if execution is async.
- * @return LSM_ERR_OK, else error reason
- */
-typedef int (*lsm_plug_pool_create_from_volumes)( lsm_plugin_ptr c,
- lsm_system *system,
- const char *pool_name, lsm_volume *volumes[],
- uint32_t num_volumes,
- lsm_pool_raid_type raid_type, lsm_pool** pool, char **job,
- lsm_flag flags);

/**
* Create a pool and specifying pool to use.
@@ -837,7 +819,6 @@ struct lsm_san_ops_v1 {
lsm_plug_disk_list disk_get; /**< retrieve disks */
lsm_plug_pool_create pool_create; /**< Pool create */
lsm_plug_pool_create_from_disks pool_create_from_disks; /**< Pool create from disks */
- lsm_plug_pool_create_from_volumes pool_create_from_volumes; /**< Pool create using volumes */
lsm_plug_pool_create_from_pool pool_create_from_pool; /**< Pool creation from pool */
lsm_plug_pool_delete pool_delete; /**< Delete a pool */
lsm_plug_volume_create vol_create; /**< creating a lun */
diff --git a/c_binding/include/libstoragemgmt/libstoragemgmt_types.h b/c_binding/include/libstoragemgmt/libstoragemgmt_types.h
index ce1559a..3691eda 100644
--- a/c_binding/include/libstoragemgmt/libstoragemgmt_types.h
+++ b/c_binding/include/libstoragemgmt/libstoragemgmt_types.h
@@ -265,7 +265,6 @@ 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,
diff --git a/c_binding/lsm_mgmt.cpp b/c_binding/lsm_mgmt.cpp
index 74ddf73..0ad8597 100644
--- a/c_binding/lsm_mgmt.cpp
+++ b/c_binding/lsm_mgmt.cpp
@@ -871,7 +871,6 @@ static int valid_pool_member_type(lsm_pool_member_type 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):
@@ -992,29 +991,6 @@ int LSM_DLL_EXPORT lsm_pool_create_from_disks(lsm_connect *c,

}

-int LSM_DLL_EXPORT lsm_pool_create_from_volumes(lsm_connect *c,
- lsm_system *system, const char *pool_name,
- lsm_volume *volumes[], uint32_t num_volumes,
- lsm_pool_raid_type raid_type,
- lsm_pool** pool, char **job, lsm_flag flags)
-{
- uint32_t i;
-
- if( !volumes || !num_volumes ) {
- return LSM_ERR_INVALID_ARGUMENT;
- }
-
- /* Create disks container */
- std::vector<Value> vols;
- for( i = 0; i < num_volumes; ++i ) {
- vols.push_back(volume_to_value(volumes[i]));
- }
-
- return lsm_pool_create_from(c, system, pool_name, vols, raid_type,
- pool, job, flags, "volumes",
- "pool_create_from_volumes");
-}
-

int lsm_pool_create_from_pool(lsm_connect *c, lsm_system *system,
const char *pool_name, lsm_pool *pool,
diff --git a/c_binding/lsm_plugin_ipc.cpp b/c_binding/lsm_plugin_ipc.cpp
index 3279ea3..8be63b0 100644
--- a/c_binding/lsm_plugin_ipc.cpp
+++ b/c_binding/lsm_plugin_ipc.cpp
@@ -595,53 +595,6 @@ static int handle_pool_create_from_disks(lsm_plugin_ptr p, Value &params, Value
return rc;
}

-static int handle_pool_create_from_volumes(lsm_plugin_ptr p, Value &params, Value &response)
-{
- int rc = LSM_ERR_NO_SUPPORT;
- if( p && p->san_ops && p->san_ops->pool_create_from_volumes ) {
-
- Value v_sys = params["system"];
- Value v_pool_name = params["pool_name"];
- Value v_volumes = params["volumes"];
- Value v_raid_t = params["raid_type"];
-
- if( Value::object_t == v_sys.valueType() &&
- Value::string_t == v_pool_name.valueType() &&
- Value::array_t == v_volumes.valueType() &&
- Value::numeric_t == v_raid_t.valueType() &&
- LSM_FLAG_EXPECTED_TYPE(params)) {
-
- /* Get the array of disks */
- lsm_volume **volumes = NULL;
- uint32_t num_volumes = 0;
- rc = value_array_to_volumes(v_volumes, &volumes, &num_volumes);
-
- if( LSM_ERR_OK == rc ) {
- lsm_system *sys = value_to_system(v_sys);
- const char *pool_name = v_pool_name.asC_str();
- lsm_pool_raid_type raid_type = (lsm_pool_raid_type)v_raid_t.asInt32_t();
-
- lsm_pool *pool = NULL;
- char *job = NULL;
-
- rc = p->san_ops->pool_create_from_volumes(p, sys, pool_name,
- volumes, num_volumes, raid_type,
- &pool, &job, LSM_FLAG_GET_VALUE(params));
-
- Value p = pool_to_value(pool);
- response = job_handle(p, job);
- lsm_volume_record_array_free(volumes, num_volumes);
- lsm_pool_record_free(pool);
- lsm_system_record_free(sys);
- free(job);
- }
- } else {
- rc = LSM_ERR_TRANSPORT_INVALID_ARG;
- }
- }
- return rc;
-}
-
static int handle_pool_create_from_pool(lsm_plugin_ptr p, Value &params, Value &response)
{
int rc = LSM_ERR_NO_SUPPORT;
@@ -2284,7 +2237,6 @@ static std::map<std::string,handler> dispatch = static_map<std::string,handler>
("pools", handle_pools)
("pool_create", handle_pool_create)
("pool_create_from_disks", handle_pool_create_from_disks)
- ("pool_create_from_volumes", handle_pool_create_from_volumes)
("pool_create_from_pool", handle_pool_create_from_pool)
("pool_delete", handle_pool_delete)
("time_out_set", handle_set_time_out)
@@ -2692,4 +2644,4 @@ void lsm_plug_nfs_export_search_filter(const char *search_key,
nfs_free);
}
}
-}
\ No newline at end of file
+}
diff --git a/python_binding/lsm/_client.py b/python_binding/lsm/_client.py
index 74e663c..c85cdee 100644
--- a/python_binding/lsm/_client.py
+++ b/python_binding/lsm/_client.py
@@ -362,33 +362,6 @@ class Client(INetworkAttachedStorage):
"""
return self._tp.rpc('pool_create_from_disks', _del_self(locals()))

- ## Create new pool in the hard way by defined what exactly volumes should
- ## be used. Depending on these capabilities:
- ## Capabilities.POOL_CREATE_FROM_VOLUMES
- ## Return the newly created pool object with all supported optional data.
- # @param self The this pointer
- # @param system_id The id of system where new pool should reside.
- # @param pool_name The name for new pool. Will not fail if created
- # pool_name is not the same as requested.
- # @param volumes The volumes to create new pool from.
- # The new pool could contain more volumes than
- # requested due to internal needs, but if possible,
- # new pool should only contain requested volumes.
- # @param raid_type The RAID level for new pool.
- # Capabilities.POOL_CREATE_VOLUME_RAID_XXX will
- # indicate the supported RAID level.
- # @param flags Reserved for future use.
- # @returns A tuple (job_id, new_pool), when one is None the other is
- # valid.
- @_return_requires(unicode, Pool)
- def pool_create_from_volumes(self, system_id, pool_name, volumes,
- raid_type, flags=0):
- """
- Creates pool from volumes.
- Returns the created new pool object.
- """
- return self._tp.rpc('pool_create_from_volumes', _del_self(locals()))
-
## Create new pool in the hard way by defined what exactly pool should
## be allocate space from. Depending on this capability:
## Capabilities.POOL_CREATE_FROM_POOL
diff --git a/python_binding/lsm/_data.py b/python_binding/lsm/_data.py
index 04c7af3..444c7b9 100644
--- a/python_binding/lsm/_data.py
+++ b/python_binding/lsm/_data.py
@@ -431,7 +431,6 @@ class Pool(IData):
MEMBER_TYPE_DISK_LUN = 111

MEMBER_TYPE_POOL = 2
- MEMBER_TYPE_VOLUME = 3

_MEMBER_TYPE_2_DISK_TYPE = {
MEMBER_TYPE_DISK: Disk.DISK_TYPE_UNKNOWN,
@@ -769,7 +768,6 @@ class Capabilities(IData):
#Pool
POOL_CREATE = 130
POOL_CREATE_FROM_DISKS = 131
- POOL_CREATE_FROM_VOLUMES = 132
POOL_CREATE_FROM_POOL = 133

POOL_CREATE_DISK_RAID_0 = 140
@@ -788,22 +786,6 @@ class Capabilities(IData):
POOL_CREATE_DISK_RAID_16 = 153
POOL_CREATE_DISK_RAID_NOT_APPLICABLE = 154

- POOL_CREATE_VOLUME_RAID_0 = 160
- POOL_CREATE_VOLUME_RAID_1 = 161
- POOL_CREATE_VOLUME_RAID_JBOD = 162
- POOL_CREATE_VOLUME_RAID_3 = 163
- POOL_CREATE_VOLUME_RAID_4 = 164
- POOL_CREATE_VOLUME_RAID_5 = 165
- POOL_CREATE_VOLUME_RAID_6 = 166
- POOL_CREATE_VOLUME_RAID_10 = 167
- POOL_CREATE_VOLUME_RAID_50 = 168
- POOL_CREATE_VOLUME_RAID_51 = 169
- POOL_CREATE_VOLUME_RAID_60 = 170
- POOL_CREATE_VOLUME_RAID_61 = 171
- POOL_CREATE_VOLUME_RAID_15 = 172
- POOL_CREATE_VOLUME_RAID_16 = 173
- POOL_CREATE_VOLUME_RAID_NOT_APPLICABLE = 174
-
POOL_DELETE = 200

POOLS_QUICK_SEARCH = 210
diff --git a/python_binding/lsm/_iplugin.py b/python_binding/lsm/_iplugin.py
index d903fc3..6c32f71 100644
--- a/python_binding/lsm/_iplugin.py
+++ b/python_binding/lsm/_iplugin.py
@@ -151,17 +151,6 @@ class IStorageAreaNetwork(IPlugin):
"""
raise LsmError(ErrorNumber.NO_SUPPORT, "Not supported")

- def pool_create_from_volumes(self, system_id, pool_name, member_ids,
- raid_type, flags=0):
- """
- Creates a pool from existing volumes
-
- Returns a tuple (job_id, re-sized_volume)
- Note: Tuple return values are mutually exclusive, when one
- is None the other must be valid.
- """
- raise LsmError(ErrorNumber.NO_SUPPORT, "Not supported")
-
def pool_create_from_pool(self, system_id, pool_name, member_id,
size_bytes, flags=0):
"""
--
1.8.3.1
Gris Ge
2014-06-19 14:23:02 UTC
Permalink
* Remove pool_create_from_volumes() method.
* Remove the use of lsm.Pool.MEMBER_TYPE_VOLUME

Signed-off-by: Gris Ge <***@redhat.com>
---
plugin/sim/simarray.py | 245 +-----------------------------------------------
plugin/sim/simulator.py | 6 --
plugin/smispy/smis.py | 7 +-
3 files changed, 6 insertions(+), 252 deletions(-)

diff --git a/plugin/sim/simarray.py b/plugin/sim/simarray.py
index 080e757..bfab3b1 100644
--- a/plugin/sim/simarray.py
+++ b/plugin/sim/simarray.py
@@ -184,13 +184,6 @@ class SimArray(object):
return self.data.job_create(
self._sim_pool_2_lsm(sim_pool))

- def pool_create_from_volumes(self, sys_id, pool_name, member_ids,
- raid_type, flags=0):
- sim_pool = self.data.pool_create_from_volumes(
- sys_id, pool_name, member_ids, raid_type, flags)
- return self.data.job_create(
- self._sim_pool_2_lsm(sim_pool))
-
def pool_create_from_pool(self, sys_id, pool_name, member_id, size_bytes,
flags=0):
sim_pool = self.data.pool_create_from_pool(
@@ -494,7 +487,7 @@ class SimData(object):
}
"""
SIM_DATA_BLK_SIZE = 512
- SIM_DATA_VERSION = "2.4"
+ SIM_DATA_VERSION = "2.5"
SIM_DATA_SYS_ID = 'sim-01'
SIM_DATA_INIT_NAME = 'NULL'
SIM_DATA_TMO = 30000 # ms
@@ -647,10 +640,10 @@ class SimData(object):
self.pool_dict['POO3'] = {
'pool_id': 'POO3',
'name': 'Pool 3',
- 'member_type': Pool.MEMBER_TYPE_VOLUME,
+ 'member_type': Pool.MEMBER_TYPE_DISK_SSD,
'member_ids': [
- self.vol_dict.values()[0]['vol_id'],
- self.vol_dict.values()[1]['vol_id'],
+ self.disk_dict[SimData._disk_id(9)]['disk_id'],
+ self.disk_dict[SimData._disk_id(10)]['disk_id'],
],
'raid_type': Pool.RAID_TYPE_RAID1,
'status': Pool.STATUS_OK,
@@ -702,10 +695,6 @@ class SimData(object):
for member_id in member_ids:
member_sizes.extend([self.disk_dict[member_id]['total_space']])

- elif member_type == Pool.MEMBER_TYPE_VOLUME:
- for member_id in member_ids:
- member_sizes.extend([self.vol_dict[member_id]['total_space']])
-
elif member_type == Pool.MEMBER_TYPE_POOL:
for member_id in member_ids:
member_sizes.extend([pool_each_size])
@@ -1394,44 +1383,6 @@ class SimData(object):

return rc

- def _free_volumes_list(self):
- rc = []
- for sim_vol in self.vol_dict.values():
- flag_free = True
- for sim_pool in self.pool_dict.values():
- if sim_pool['member_type'] == Pool.MEMBER_TYPE_VOLUME and \
- sim_vol['vol_id'] in sim_pool['member_ids']:
- flag_free = False
- break
- if flag_free:
- rc.extend([sim_vol])
- return sorted(rc, key=lambda k: (k['vol_id']))
-
- def _free_volumes(self, size_bytes=0):
- """
- We group sim_vol based on theri total_space because RAID (except
- JBOD) require member in the same spaces.
- Return a dictionary like this:
- {
- sim_vol['total_space']: [sim_vol, ]
- }
- """
- free_sim_vols = self._free_volumes_list()
- if len(free_sim_vols) <= 0:
- return dict()
- rc = dict()
- for sim_vol in free_sim_vols:
- if size_bytes != 0 and sim_vol['total_space'] != size_bytes:
- continue
- # TODO: one day we will introduce free_size of Volume.
- # in that case we will check whether
- # total_space == vol_free_size(sim_vol['vol_id'])
-
- if sim_vol['total_space'] not in rc.keys():
- rc[sim_vol['total_space']] = []
- rc[sim_vol['total_space']].extend([sim_vol])
- return rc
-
def _free_pools_list(self):
"""
Return a list of sim_pool or []
@@ -1562,100 +1513,6 @@ class SimData(object):
return self._pool_create_from_disks(pool_name, member_ids, raid_type,
raise_error=True)

- def _pool_create_from_volumes(self, pool_name, member_ids, raid_type,
- raise_error=False):
- # Check:
- # 1. The vol_id is valid
- # 3. All volumes are free.
- if len(member_ids) == 0:
- if raise_error:
- raise LsmError(ErrorNumber.INVALID_VOLUME,
- "No volume ID defined")
- else:
- return None
-
- if raid_type == Pool.RAID_TYPE_NOT_APPLICABLE and \
- len(member_ids) >= 2:
- if raise_error:
- raise LsmError(ErrorNumber.INVALID_ARGUMENT,
- "Pool.RAID_TYPE_NOT_APPLICABLE means only 1 " +
- "member, but got 2 or more: %s" %
- ', '.join(member_ids))
- else:
- return None
-
- current_vol_size = None
- for vol_id in member_ids:
- if vol_id not in self.vol_dict.keys() and raise_error:
- if raise_error:
- raise LsmError(ErrorNumber.INVALID_DISK,
- "The vol ID %s does not exist" % vol_id)
- else:
- return None
- sim_vol = self.vol_dict[vol_id]
- if current_vol_size is None:
- current_vol_size = sim_vol['total_space']
- elif current_vol_size != sim_vol['total_space']:
- if raise_error:
- raise LsmError(ErrorNumber.NO_SUPPORT,
- "Mixing volume size in one pool " +
- "is not supported: %d and %d" %
- (current_vol_size, sim_vol['total_space']))
- else:
- return None
-
- all_free_vols = self._free_volumes_list()
- if all_free_vols is None:
- if raise_error:
- raise LsmError(ErrorNumber.VOLUME_BUSY,
- "No free volume to create new pool")
- else:
- return None
- all_free_vol_ids = [v['vol_id'] for v in all_free_vols]
- for vol_id in member_ids:
- if vol_id not in all_free_vol_ids:
- if raise_error:
- raise LsmError(ErrorNumber.VOLUME_BUSY,
- "Volume %s is used by other pool" % vol_id)
- else:
- return None
-
- if raid_type == Pool.RAID_TYPE_UNKNOWN or \
- raid_type == Pool.RAID_TYPE_MIXED:
- if raise_error:
- raise LsmError(ErrorNumber.NO_SUPPORT,
- "RAID type %s(%d) is not supported" %
- (Pool.raid_type_to_str(raid_type), raid_type))
- else:
- return None
-
- pool_id = self._next_pool_id()
- if pool_name == '':
- pool_name = 'POOL %s' % SimData._random_vpd(4)
- sim_pool = dict()
- sim_pool['name'] = pool_name
- sim_pool['pool_id'] = pool_id
- if len(member_ids) == 1:
- sim_pool['raid_type'] = Pool.RAID_TYPE_NOT_APPLICABLE
- else:
- sim_pool['raid_type'] = raid_type
- sim_pool['member_ids'] = member_ids
- sim_pool['member_type'] = Pool.MEMBER_TYPE_VOLUME
- sim_pool['sys_id'] = SimData.SIM_DATA_SYS_ID
- sim_pool['element_type'] = SimData.SIM_DATA_POOL_ELEMENT_TYPE
- sim_pool['status'] = SimData.SIM_DATA_POOL_STATUS
- sim_pool['status_info'] = SimData.SIM_DATA_POOL_STATUS_INFO
- self.pool_dict[pool_id] = sim_pool
- return sim_pool
-
- def pool_create_from_volumes(self, sys_id, pool_name, member_ids,
- raid_type, flags=0):
- if sys_id != SimData.SIM_DATA_SYS_ID:
- raise LsmError(ErrorNumber.INVALID_SYSTEM,
- "No such system: %s" % sys_id)
- return self._pool_create_from_volumes(pool_name, member_ids, raid_type,
- raise_error=True)
-
def _pool_create_from_pool(self, pool_name, member_id,
size_bytes, raise_error=False):

@@ -1789,85 +1646,6 @@ class SimData(object):
else:
return []

- def _auto_choose_vol(self, size_bytes, raid_type, raise_error=False):
- """
- Return a list of member ids suitable for creating RAID pool with
- required size_bytes.
- Return [] if nothing found.
- Raise LsmError if raise_error is True
- """
- if raid_type == Pool.RAID_TYPE_NOT_APPLICABLE:
- # NOT_APPLICABLE means pool will only contain one volume.
- sim_vols = self._free_volumes_list()
- if len(sim_vols) == 0:
- if raise_error:
- raise LsmError(ErrorNumber.VOLUME_BUSY,
- "No free volume found")
- else:
- return []
- for sim_vol in sim_vols:
- if sim_vol['total_space'] >= size_bytes:
- return [sim_vol]
-
- if raise_error:
- raise LsmError(ErrorNumber.SIZE_INSUFFICIENT_SPACE,
- "No volume is bigger than expected size: " +
- "%s(%d)" %
- (size_bytes_2_size_human(size_bytes),
- size_bytes))
- else:
- return []
-
- if raid_type == Pool.RAID_TYPE_JBOD:
- # JBOD does not require all vols in the same size.
- sim_vols = self._free_volumes_list()
- if len(sim_vols) == 0:
- if raise_error:
- raise LsmError(ErrorNumber.VOLUME_BUSY,
- "No free volume found")
- else:
- return []
-
- chose_sim_vols = []
- all_free_size = 0
- for sim_vol in sim_vols:
- chose_sim_vols.extend([sim_vol])
- all_free_size += sim_vol['total_space']
- if all_free_size >= size_bytes:
- return chose_sim_vols
-
- if raise_error:
- raise LsmError(ErrorNumber.SIZE_INSUFFICIENT_SPACE,
- "No enough volumes to provide size %s(%d)" %
- (size_bytes_2_size_human(size_bytes),
- size_bytes))
- else:
- return []
-
- # Rest RAID types require volume to be the same size.
- sim_vols_dict = self._free_volumes()
- for vol_size in sim_vols_dict.keys():
- sim_vols = sim_vols_dict[vol_size]
- if len(sim_vols) == 0:
- continue
- for member_count in range(1, len(sim_vols) + 1):
- partial_sim_vols = sim_vols[0:member_count]
- member_ids = [v['vol_id'] for v in partial_sim_vols]
- raid_actual_size = self._size_of_raid(
- Pool.MEMBER_TYPE_VOLUME, member_ids, raid_type)
- if size_bytes <= raid_actual_size:
- return sim_vols[0:member_count]
-
- if raise_error:
- raise LsmError(ErrorNumber.SIZE_INSUFFICIENT_SPACE,
- "No enough volumes to create "
- "%s providing size: %s(%d)" %
- (Pool.raid_type_to_str(raid_type),
- size_bytes_2_size_human(size_bytes),
- size_bytes))
- else:
- return []
-
def _auto_choose_pool(self, size_bytes, raise_error=False):
"""
Return a sim_pool.
@@ -1922,20 +1700,7 @@ class SimData(object):
return sim_pool

if member_type == Pool.MEMBER_TYPE_UNKNOWN or \
- member_type == Pool.MEMBER_TYPE_VOLUME:
- vol_raid_type = raid_type
- if raid_type == Pool.RAID_TYPE_UNKNOWN:
- vol_raid_type = SimData.SIM_DATA_VOLUME_DEFAULT_RAID
- sim_vols = self._auto_choose_vol(
- size_bytes, vol_raid_type, raise_error)
- if len(sim_vols) >= 1:
- member_ids = [v['vol_id'] for v in sim_vols]
- sim_pool = self._pool_create_from_volumes(
- pool_name, member_ids, vol_raid_type, raise_error)
- if sim_pool:
- return sim_pool
-
- if member_type == Pool.MEMBER_TYPE_POOL:
+ member_type == Pool.MEMBER_TYPE_POOL:
if raid_type != Pool.RAID_TYPE_UNKNOWN and \
raid_type != Pool.RAID_TYPE_NOT_APPLICABLE:
raise LsmError(ErrorNumber.NO_SUPPORT,
diff --git a/plugin/sim/simulator.py b/plugin/sim/simulator.py
index 45bed3c..b98ecb8 100644
--- a/plugin/sim/simulator.py
+++ b/plugin/sim/simulator.py
@@ -111,12 +111,6 @@ class SimPlugin(INfs, IStorageAreaNetwork):
return self.sim_array.pool_create_from_disks(
system.id, pool_name, member_ids, raid_type, flags)

- def pool_create_from_volumes(self, system, pool_name, volumes,
- raid_type, flags=0):
- member_ids = [x.id for x in volumes]
- return self.sim_array.pool_create_from_volumes(
- system.id, pool_name, member_ids, raid_type, flags)
-
def pool_create_from_pool(self, system, pool_name, pool,
size_bytes, flags=0):
return self.sim_array.pool_create_from_pool(
diff --git a/plugin/smispy/smis.py b/plugin/smispy/smis.py
index c1fe951..ee82e75 100644
--- a/plugin/smispy/smis.py
+++ b/plugin/smispy/smis.py
@@ -2732,8 +2732,7 @@ class Smis(IStorageAreaNetwork):
else:
raid_type = cur_raid_type

- if opt_pro_dict['member_type'] == Pool.MEMBER_TYPE_POOL or \
- opt_pro_dict['member_type'] == Pool.MEMBER_TYPE_VOLUME:
+ if opt_pro_dict['member_type'] == Pool.MEMBER_TYPE_POOL:
# we already know current pool is based on pool or volume.
# skipping disk member traverse walk.
continue
@@ -2942,10 +2941,6 @@ class Smis(IStorageAreaNetwork):
"The pool_create of SMI-S plugin does not "
"support creating pool over pool(sub-pool) yet")

- elif member_type == Pool.MEMBER_TYPE_VOLUME:
- raise LsmError(ErrorNumber.NO_SUPPORT,
- "The pool_create of SMI-S plugin does not "
- "support creating pool on volume yet")
elif member_type == Pool.MEMBER_TYPE_UNKNOWN:
pass
else:
--
1.8.3.1
Gris Ge
2014-06-19 14:23:03 UTC
Permalink
* Remove unit test of volume pool creation.

Signed-off-by: Gris Ge <***@redhat.com>
---
test/tester.c | 85 -----------------------------------------------------------
1 file changed, 85 deletions(-)

diff --git a/test/tester.c b/test/tester.c
index bf5ba9f..f51cc4f 100644
--- a/test/tester.c
+++ b/test/tester.c
@@ -2412,91 +2412,6 @@ START_TEST(test_pool_create)
lsm_pool_record_free(pool);
pool = NULL;

-
- /* Test pool creation from volume */
- {
- lsm_volume **volumes = NULL;
- uint32_t num_volumes = 0;
- int i = 0;
- lsm_pool **pools = NULL;
- uint32_t num_pools = 0;
- lsm_volume *vol = NULL;
- char r_name[32];
- lsm_volume *volumes_to_use[128];
- uint32_t num_of_volumes_to_use = 0;
-
- memset(volumes_to_use, 0, sizeof(volumes_to_use));
-
- /* Create some volumes */
- rc = lsm_pool_list(c, NULL, NULL, &pools, &num_pools, LSM_FLAG_RSVD);
-
- fail_unless(LSM_ERR_OK == rc, "rc %d", rc);
- fail_unless(num_pools > 0, "num pools = %d", num_pools);
-
- if( LSM_ERR_OK == rc && num_pools > 0) {
-
- pool_one = lsm_pool_record_copy(pools[0]);
-
- for( i = 0; i < num_pools; ++i ) {
- job = NULL;
- vol = NULL;
-
- generate_random(r_name, sizeof(r_name));
-
- rc = lsm_volume_create(c, pools[i], r_name,
- 1024*1024*1024, LSM_PROVISION_DEFAULT,
- &vol, &job, LSM_FLAG_RSVD);
-
- if( LSM_ERR_JOB_STARTED == rc ) {
- vol = wait_for_job_vol(c, &job);
- } else {
- fail_unless(LSM_ERR_OK == rc, "rc %d", rc);
- }
-
- lsm_volume_record_free(vol);
- }
- }
-
- rc = lsm_volume_list(c, NULL, NULL, &volumes, &num_volumes, LSM_FLAG_RSVD);
- fail_unless( LSM_ERR_OK == rc );
-
- if( num_volumes ) {
- uint64_t size = lsm_volume_number_of_blocks_get(volumes[num_volumes-1]);
- for( i = num_volumes - 1; i > 0; --i ) {
- if( lsm_volume_number_of_blocks_get(volumes[i]) == size ) {
- volumes_to_use[num_of_volumes_to_use] = volumes[i];
- num_of_volumes_to_use += 1;
- }
- }
-
- pool = NULL;
- job = NULL;
-
- rc = lsm_pool_create_from_volumes(c, system,
- "pool_create_from_volumes", volumes_to_use,
- num_of_volumes_to_use,
- LSM_POOL_RAID_TYPE_0, &pool, &job,
- LSM_FLAG_RSVD);
-
- if( LSM_ERR_JOB_STARTED == rc ) {
- pool = wait_for_job_pool(c, &job);
- } else {
- fail_unless(LSM_ERR_OK == rc,
- "lsmPoolCreateFromVolumes %d (%s)",
- rc, error(lsm_error_last_get(c)));
- }
-
- lsm_pool_record_free(pool);
- pool = NULL;
-
- lsm_volume_record_array_free(volumes, num_volumes);
- memset(volumes_to_use, 0, sizeof(volumes_to_use));
- num_of_volumes_to_use = 0;
- volumes = NULL;
- num_volumes = 0;
- }
- }
-
/* Test pool creation from pool */
{
if( pool_one ) {
--
1.8.3.1
Tony Asleson
2014-06-19 15:42:32 UTC
Permalink
Committed.

Thanks,
Tony
Post by Gris Ge
As discussed in IRC, we don't have any real storage array or plugin
support Volume Pool. For those using remove LUN as disk,
lsm.Pool.MEMBER_TYPE_LUN could be sufficient.
Python & C Library: remove pool_create_from_volumes()
lsmcli: Remove pool-create-from-volumes command
Plugins: Remove pool_create_from_volumes()
C unit test: remove volume pool creating test.
c_binding/include/libstoragemgmt/libstoragemgmt.h | 25 ---
.../libstoragemgmt/libstoragemgmt_capabilities.h | 16 --
.../libstoragemgmt/libstoragemgmt_plug_interface.h | 19 --
.../include/libstoragemgmt/libstoragemgmt_types.h | 1 -
c_binding/lsm_mgmt.cpp | 24 --
c_binding/lsm_plugin_ipc.cpp | 50 +----
doc/man/lsmcli.1.in | 24 --
plugin/sim/simarray.py | 245 +--------------------
plugin/sim/simulator.py | 6 -
plugin/smispy/smis.py | 7 +-
python_binding/lsm/_client.py | 27 ---
python_binding/lsm/_data.py | 18 --
python_binding/lsm/_iplugin.py | 11 -
test/tester.c | 85 -------
tools/lsmcli/cmdline.py | 44 ----
tools/lsmcli/data_display.py | 1 -
16 files changed, 7 insertions(+), 596 deletions(-)
Loading...