Discussion:
[Libstoragemgmt-devel] [PATCH 1/7] python: Rename get_available_plugins
Tony Asleson
2014-05-20 22:28:01 UTC
Permalink
get_available_plugins -> available_plugins

Signed-off-by: Tony Asleson <***@redhat.com>
---
python_binding/lsm/_client.py | 2 +-
python_binding/lsm/_cmdline.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/python_binding/lsm/_client.py b/python_binding/lsm/_client.py
index f34c87c..e271c3a 100644
--- a/python_binding/lsm/_client.py
+++ b/python_binding/lsm/_client.py
@@ -171,7 +171,7 @@ class Client(INetworkAttachedStorage):
## Retrieves all the available plug-ins
@staticmethod
@_return_requires([unicode])
- def get_available_plugins(field_sep=':', flags=0):
+ def available_plugins(field_sep=':', flags=0):
"""
Retrieves all the available plug-ins

diff --git a/python_binding/lsm/_cmdline.py b/python_binding/lsm/_cmdline.py
index eb44507..ebdd03b 100644
--- a/python_binding/lsm/_cmdline.py
+++ b/python_binding/lsm/_cmdline.py
@@ -761,7 +761,7 @@ class CmdLine:
def display_available_plugins(self):
d = []
sep = '<}{>'
- plugins = Client.get_available_plugins(sep)
+ plugins = Client.available_plugins(sep)

for p in plugins:
desc, version = p.split(sep)
--
1.8.2.1
Tony Asleson
2014-05-20 22:28:05 UTC
Permalink
The naming was inconsistent with other methods.

Signed-off-by: Tony Asleson <***@redhat.com>
---
c_binding/lsm_mgmt.cpp | 2 +-
c_binding/lsm_plugin_ipc.cpp | 4 ++--
plugin/nstor/nstor.py | 2 +-
plugin/ontap/ontap.py | 2 +-
plugin/sim/simarray.py | 6 +++---
plugin/sim/simulator.py | 6 +++---
python_binding/lsm/_client.py | 4 ++--
python_binding/lsm/_cmdline.py | 2 +-
python_binding/lsm/_iplugin.py | 4 ++--
test/plugin_test.py | 2 +-
10 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/c_binding/lsm_mgmt.cpp b/c_binding/lsm_mgmt.cpp
index a6a8615..5df3048 100644
--- a/c_binding/lsm_mgmt.cpp
+++ b/c_binding/lsm_mgmt.cpp
@@ -2039,7 +2039,7 @@ int lsm_fs_file_clone(lsm_connect *c, lsm_fs *fs, const char *src_file_name,
Value parameters(p);
Value response;

- int rc = rpc(c, "file_clone", parameters, response);
+ int rc = rpc(c, "fs_file_clone", parameters, response);
return jobCheck(c, rc, response, job);
}

diff --git a/c_binding/lsm_plugin_ipc.cpp b/c_binding/lsm_plugin_ipc.cpp
index 484ad3e..8d1acb7 100644
--- a/c_binding/lsm_plugin_ipc.cpp
+++ b/c_binding/lsm_plugin_ipc.cpp
@@ -1719,7 +1719,7 @@ static int fs_clone(lsm_plugin_ptr p, Value &params, Value &response)
return rc;
}

-static int file_clone(lsm_plugin_ptr p, Value &params, Value &response)
+static int fs_file_clone(lsm_plugin_ptr p, Value &params, Value &response)
{
int rc = LSM_ERR_OK;

@@ -2372,7 +2372,7 @@ static std::map<std::string,handler> dispatch = static_map<std::string,handler>
("export_fs", export_fs)
("export_remove", export_remove)
("exports", exports)
- ("file_clone", file_clone)
+ ("fs_file_clone", fs_file_clone)
("fs_child_dependency", fs_child_dependency)
("fs_child_dependency_rm", fs_child_dependency_rm)
("fs_clone", fs_clone)
diff --git a/plugin/nstor/nstor.py b/plugin/nstor/nstor.py
index a906b5f..57a8191 100644
--- a/plugin/nstor/nstor.py
+++ b/plugin/nstor/nstor.py
@@ -301,7 +301,7 @@ class NexentaStor(INfs, IStorageAreaNetwork):
self.system.id)
return None, fs

- def file_clone(self, fs, src_file_name, dest_file_name, snapshot=None,
+ def fs_file_clone(self, fs, src_file_name, dest_file_name, snapshot=None,
flags=0):
return

diff --git a/plugin/ontap/ontap.py b/plugin/ontap/ontap.py
index e8c528e..1a9acab 100644
--- a/plugin/ontap/ontap.py
+++ b/plugin/ontap/ontap.py
@@ -895,7 +895,7 @@ class Ontap(IStorageAreaNetwork, INfs):
return "/vol/%s/%s" % (volume_name, relative_name)

@handle_ontap_errors
- def file_clone(self, fs, src_file_name, dest_file_name, snapshot=None,
+ def fs_file_clone(self, fs, src_file_name, dest_file_name, snapshot=None,
flags=0):
full_src = Ontap.build_name(fs.name, src_file_name)
full_dest = Ontap.build_name(fs.name, dest_file_name)
diff --git a/plugin/sim/simarray.py b/plugin/sim/simarray.py
index 80ef3bd..6a3c1fa 100644
--- a/plugin/sim/simarray.py
+++ b/plugin/sim/simarray.py
@@ -288,9 +288,9 @@ class SimArray(object):
sim_fs = self.data.fs_clone(src_fs_id, dst_fs_name, snap_id, flags)
return self.data.job_create(SimArray._sim_fs_2_lsm(sim_fs))

- def file_clone(self, fs_id, src_fs_name, dst_fs_name, snap_id, flags=0):
+ def fs_file_clone(self, fs_id, src_fs_name, dst_fs_name, snap_id, flags=0):
return self.data.job_create(
- self.data.file_clone(
+ self.data.fs_file_clone(
fs_id, src_fs_name, dst_fs_name, snap_id, flags))[0]

@staticmethod
@@ -1292,7 +1292,7 @@ class SimData(object):
}
return dst_sim_fs

- def file_clone(self, fs_id, src_fs_name, dst_fs_name, snap_id, flags=0):
+ def fs_file_clone(self, fs_id, src_fs_name, dst_fs_name, snap_id, flags=0):
if fs_id not in self.fs_dict.keys():
raise LsmError(ErrorNumber.INVALID_INIT,
"No such File System: %s" % fs_id)
diff --git a/plugin/sim/simulator.py b/plugin/sim/simulator.py
index bdd9cf2..168bd3e 100644
--- a/plugin/sim/simulator.py
+++ b/plugin/sim/simulator.py
@@ -258,13 +258,13 @@ class SimPlugin(INfs, IStorageAreaNetwork):
return self.sim_array.fs_clone(
src_fs.id, dest_fs_name, snapshot.id, flags)

- def file_clone(self, fs, src_file_name, dest_file_name, snapshot=None,
+ def fs_file_clone(self, fs, src_file_name, dest_file_name, snapshot=None,
flags=0):
if snapshot is None:
- return self.sim_array.file_clone(
+ return self.sim_array.fs_file_clone(
fs.id, src_file_name, dest_file_name, None, flags)

- return self.sim_array.file_clone(
+ return self.sim_array.fs_file_clone(
fs.id, src_file_name, dest_file_name, snapshot.id, flags)

def fs_snapshots(self, fs, flags=0):
diff --git a/python_binding/lsm/_client.py b/python_binding/lsm/_client.py
index 472f5a8..a87e557 100644
--- a/python_binding/lsm/_client.py
+++ b/python_binding/lsm/_client.py
@@ -924,7 +924,7 @@ class Client(INetworkAttachedStorage):
# @param flags Reserved for future use, must be zero.
# @returns None on success, else job id
@_return_requires(unicode)
- def file_clone(self, fs, src_file_name, dest_file_name, snapshot=None,
+ def fs_file_clone(self, fs, src_file_name, dest_file_name, snapshot=None,
flags=0):
"""
Creates a thinly provisioned clone of src to dest.
@@ -933,7 +933,7 @@ class Client(INetworkAttachedStorage):

Returns None on success, else job id
"""
- return self._tp.rpc('file_clone', _del_self(locals()))
+ return self._tp.rpc('fs_file_clone', _del_self(locals()))

## Returns a list of snapshots
# @param self The this pointer
diff --git a/python_binding/lsm/_cmdline.py b/python_binding/lsm/_cmdline.py
index 7e8078c..c1f7e64 100644
--- a/python_binding/lsm/_cmdline.py
+++ b/python_binding/lsm/_cmdline.py
@@ -1041,7 +1041,7 @@ class CmdLine:
ss = None

self._wait_for_it(
- "file_clone", self.c.file_clone(fs, args.src, args.dst, ss), None)
+ "fs_file_clone", self.c.fs_file_clone(fs, args.src, args.dst, ss), None)

##Converts a size parameter into the appropriate number of bytes
# @param s Size to convert to bytes handles B, K, M, G, T, P postfix
diff --git a/python_binding/lsm/_iplugin.py b/python_binding/lsm/_iplugin.py
index d4bbab5..143146a 100644
--- a/python_binding/lsm/_iplugin.py
+++ b/python_binding/lsm/_iplugin.py
@@ -451,8 +451,8 @@ class INetworkAttachedStorage(IPlugin):
"""
raise LsmError(ErrorNumber.NO_SUPPORT, "Not supported")

- def file_clone(self, fs, src_file_name, dest_file_name, snapshot=None,
- flags=0):
+ def fs_file_clone(self, fs, src_file_name, dest_file_name, snapshot=None,
+ flags=0):
"""
Creates a thinly provisioned clone of src to dest.
Note: Source and Destination are required to be on same filesystem
diff --git a/test/plugin_test.py b/test/plugin_test.py
index d5a65f6..005048a 100755
--- a/test/plugin_test.py
+++ b/test/plugin_test.py
@@ -111,7 +111,7 @@ class TestProxy(object):
'fs_resize': (unicode, lsm.FileSystem),
'fs_create': (unicode, lsm.FileSystem),
'fs_clone': (unicode, lsm.FileSystem),
- 'file_clone': (unicode,),
+ 'fs_file_clone': (unicode,),
'fs_snapshot_create': (unicode, lsm.FsSnapshot),
'fs_snapshot_delete': (unicode,),
'fs_snapshot_revert': (unicode,),
--
1.8.2.1
Tony Asleson
2014-05-20 22:28:06 UTC
Permalink
Block API will be using restore, not revert thus changing this
to match for snapshots.

Signed-off-by: Tony Asleson <***@redhat.com>
---
c_binding/include/libstoragemgmt/libstoragemgmt.h | 10 +++++-----
.../include/libstoragemgmt/libstoragemgmt_plug_interface.h | 6 +++---
c_binding/lsm_mgmt.cpp | 4 ++--
c_binding/lsm_plugin_ipc.cpp | 8 ++++----
plugin/nstor/nstor.py | 2 +-
plugin/ontap/ontap.py | 8 ++++----
plugin/sim/simarray.py | 10 +++++-----
plugin/sim/simulator.py | 4 ++--
plugin/simc/simc_lsmplugin.c | 4 ++--
python_binding/lsm/_client.py | 14 +++++++-------
python_binding/lsm/_cmdline.py | 2 +-
python_binding/lsm/_iplugin.py | 4 ++--
test/plugin_test.py | 2 +-
test/tester.c | 14 +++++++-------
14 files changed, 46 insertions(+), 46 deletions(-)

diff --git a/c_binding/include/libstoragemgmt/libstoragemgmt.h b/c_binding/include/libstoragemgmt/libstoragemgmt.h
index 3c922c8..96be652 100644
--- a/c_binding/include/libstoragemgmt/libstoragemgmt.h
+++ b/c_binding/include/libstoragemgmt/libstoragemgmt.h
@@ -903,20 +903,20 @@ extern "C" {
char **job, lsm_flag flags);

/**
- * Reverts a file system or files to a previous state as specified in the
+ * Restores a file system or files to a previous state as specified in the
* snapshot.
* @param c Valid connection
* @param fs File system which contains the snapshot
- * @param ss Snapshot to revert to
- * @param files Optional list of files to revert
- * @param restore_files Optional list of file names to revert to
+ * @param ss Snapshot to restore to
+ * @param files Optional list of files to restore
+ * @param restore_files Optional list of file names to restore to
* @param all_files 0 = False else True
* @param job Job id if operation is 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 lsm_fs_ss_revert(lsm_connect *c, lsm_fs *fs, lsm_fs_ss *ss,
+ int LSM_DLL_EXPORT lsm_fs_ss_restore(lsm_connect *c, lsm_fs *fs, lsm_fs_ss *ss,
lsm_string_list *files,
lsm_string_list *restore_files,
int all_files, char **job, lsm_flag flags);
diff --git a/c_binding/include/libstoragemgmt/libstoragemgmt_plug_interface.h b/c_binding/include/libstoragemgmt/libstoragemgmt_plug_interface.h
index 1970985..dc18fa4 100644
--- a/c_binding/include/libstoragemgmt/libstoragemgmt_plug_interface.h
+++ b/c_binding/include/libstoragemgmt/libstoragemgmt_plug_interface.h
@@ -805,11 +805,11 @@ typedef int (*lsm_plug_fs_ss_delete)(lsm_plugin_ptr c, lsm_fs *fs, lsm_fs_ss *ss
* @param[in] fs File system of interest
* @param[in] files Optional list of files
* @param[in] restore_files Optional path and name of restored files
- * @param[in] all_files boolean to indicate all files should be reverted
+ * @param[in] all_files boolean to indicate all files should be restored
* @param[out] job Job ID
* @return LSM_ERR_OK, else error reason
*/
-typedef int (*lsm_plug_fs_ss_revert)(lsm_plugin_ptr c, lsm_fs *fs, lsm_fs_ss *ss,
+typedef int (*lsm_plug_fs_ss_restore)(lsm_plugin_ptr c, lsm_fs *fs, lsm_fs_ss *ss,
lsm_string_list *files,
lsm_string_list *restore_files,
int all_files, char **job, lsm_flag flags);
@@ -927,7 +927,7 @@ struct lsm_fs_ops_v1 {
lsm_plug_fs_ss_list fs_ss_list; /**< list snapshots */
lsm_plug_fs_ss_create fs_ss_create; /**< create a snapshot */
lsm_plug_fs_ss_delete fs_ss_delete; /**< delete a snapshot */
- lsm_plug_fs_ss_revert fs_ss_revert; /**< revert a snapshot */
+ lsm_plug_fs_ss_restore fs_ss_restore; /**< restore a snapshot */
};

/** \struct lsm_nas_ops_v1
diff --git a/c_binding/lsm_mgmt.cpp b/c_binding/lsm_mgmt.cpp
index 5df3048..61c8ce2 100644
--- a/c_binding/lsm_mgmt.cpp
+++ b/c_binding/lsm_mgmt.cpp
@@ -2242,7 +2242,7 @@ int lsm_fs_ss_delete(lsm_connect *c, lsm_fs *fs, lsm_fs_ss *ss, char **job,
return jobCheck(c, rc, response, job);
}

-int lsm_fs_ss_revert(lsm_connect *c, lsm_fs *fs, lsm_fs_ss *ss,
+int lsm_fs_ss_restore(lsm_connect *c, lsm_fs *fs, lsm_fs_ss *ss,
lsm_string_list *files,
lsm_string_list *restore_files,
int all_files, char **job, lsm_flag flags)
@@ -2284,7 +2284,7 @@ int lsm_fs_ss_revert(lsm_connect *c, lsm_fs *fs, lsm_fs_ss *ss,
Value parameters(p);
Value response;

- int rc = rpc(c, "fs_snapshot_revert", parameters, response);
+ int rc = rpc(c, "fs_snapshot_restore", parameters, response);
return jobCheck(c, rc, response, job);

}
diff --git a/c_binding/lsm_plugin_ipc.cpp b/c_binding/lsm_plugin_ipc.cpp
index 8d1acb7..a9ff530 100644
--- a/c_binding/lsm_plugin_ipc.cpp
+++ b/c_binding/lsm_plugin_ipc.cpp
@@ -1976,10 +1976,10 @@ static int ss_delete(lsm_plugin_ptr p, Value &params, Value &response)
return rc;
}

-static int ss_revert(lsm_plugin_ptr p, Value &params, Value &response)
+static int ss_restore(lsm_plugin_ptr p, Value &params, Value &response)
{
int rc = LSM_ERR_NO_SUPPORT;
- if( p && p->san_ops && p->fs_ops->fs_ss_revert ) {
+ if( p && p->san_ops && p->fs_ops->fs_ss_restore ) {

Value v_fs = params["fs"];
Value v_ss = params["snapshot"];
@@ -2003,7 +2003,7 @@ static int ss_revert(lsm_plugin_ptr p, Value &params, Value &response)
int all_files = (v_all_files.asBool()) ? 1 : 0;

if( fs && ss && files && restore_files ) {
- rc = p->fs_ops->fs_ss_revert(p, fs, ss, files, restore_files,
+ rc = p->fs_ops->fs_ss_restore(p, fs, ss, files, restore_files,
all_files, &job,
LSM_FLAG_GET_VALUE(params));

@@ -2382,7 +2382,7 @@ static std::map<std::string,handler> dispatch = static_map<std::string,handler>
("fs_resize", fs_resize)
("fs_snapshot_create", ss_create)
("fs_snapshot_delete", ss_delete)
- ("fs_snapshot_revert", ss_revert)
+ ("fs_snapshot_restore", ss_restore)
("fs_snapshots", ss_list)
("time_out_get", handle_get_time_out)
("initiators", handle_initiators)
diff --git a/plugin/nstor/nstor.py b/plugin/nstor/nstor.py
index 57a8191..479af78 100644
--- a/plugin/nstor/nstor.py
+++ b/plugin/nstor/nstor.py
@@ -305,7 +305,7 @@ class NexentaStor(INfs, IStorageAreaNetwork):
flags=0):
return

- def fs_snapshot_revert(self, fs, snapshot, files, restore_files,
+ def fs_snapshot_restore(self, fs, snapshot, files, restore_files,
all_files=False, flags=0):
self._request("rollback", "snapshot", [snapshot.name, '-r'])
return
diff --git a/plugin/ontap/ontap.py b/plugin/ontap/ontap.py
index 1a9acab..229e609 100644
--- a/plugin/ontap/ontap.py
+++ b/plugin/ontap/ontap.py
@@ -641,7 +641,7 @@ class Ontap(IStorageAreaNetwork, INfs):
self._na_volume_resize_restore(na_vol, diff)

try:
- #if this raises an exception we need to revert the volume
+ #if this raises an exception we need to restore the volume
self.f.lun_resize(volume.name, new_size_bytes)
except Exception as e:
#Put the volume back to previous size
@@ -922,7 +922,7 @@ class Ontap(IStorageAreaNetwork, INfs):
def fs_snapshot_delete(self, fs, snapshot, flags=0):
self.f.snapshot_delete(fs.name, snapshot.name)

- def _ss_revert_files(self, volume_name, snapshot_name, files,
+ def _ss_restore_files(self, volume_name, snapshot_name, files,
restore_files):
for i in range(len(files)):
src = Ontap.build_name(volume_name, files[i])
@@ -932,7 +932,7 @@ class Ontap(IStorageAreaNetwork, INfs):
self.f.snapshot_restore_file(snapshot_name, src, dest)

@handle_ontap_errors
- def fs_snapshot_revert(self, fs, snapshot, files, restore_files,
+ def fs_snapshot_restore(self, fs, snapshot, files, restore_files,
all_files=False, flags=0):
"""
Restores a FS or files on a FS.
@@ -948,7 +948,7 @@ class Ontap(IStorageAreaNetwork, INfs):
raise LsmError(ErrorNumber.INVALID_ARGUMENT,
"num files != num restore_files")

- self._ss_revert_files(fs.name, snapshot.name, files,
+ self._ss_restore_files(fs.name, snapshot.name, files,
restore_files)
return "%s@%d" % (Ontap.SS_JOB, len(files))
else:
diff --git a/plugin/sim/simarray.py b/plugin/sim/simarray.py
index 6a3c1fa..fd940b6 100644
--- a/plugin/sim/simarray.py
+++ b/plugin/sim/simarray.py
@@ -311,10 +311,10 @@ class SimArray(object):
return self.data.job_create(
self.data.fs_snapshot_delete(fs_id, snap_id, flags))[0]

- def fs_snapshot_revert(self, fs_id, snap_id, files, restore_files,
- flag_all_files, flags):
+ def fs_snapshot_restore(self, fs_id, snap_id, files, restore_files,
+ flag_all_files, flags):
return self.data.job_create(
- self.data.fs_snapshot_revert(
+ self.data.fs_snapshot_restore(
fs_id, snap_id, files, restore_files,
flag_all_files, flags))[0]

@@ -1347,7 +1347,7 @@ class SimData(object):
self.fs_dict[fs_id]['snaps'] = new_snap_ids
return None

- def fs_snapshot_revert(self, fs_id, snap_id, files, restore_files,
+ def fs_snapshot_restore(self, fs_id, snap_id, files, restore_files,
flag_all_files, flags):
if fs_id not in self.fs_dict.keys():
raise LsmError(ErrorNumber.INVALID_INIT,
@@ -1355,7 +1355,7 @@ class SimData(object):
if snap_id not in self.snap_dict.keys():
raise LsmError(ErrorNumber.INVALID_SS,
"No such Snapshot: %s" % snap_id)
- # Nothing need to done internally for revert.
+ # Nothing need to done internally for restore.
return None

def fs_child_dependency(self, fs_id, files, flags=0):
diff --git a/plugin/sim/simulator.py b/plugin/sim/simulator.py
index 168bd3e..e109639 100644
--- a/plugin/sim/simulator.py
+++ b/plugin/sim/simulator.py
@@ -279,9 +279,9 @@ class SimPlugin(INfs, IStorageAreaNetwork):
return self.sim_array.fs_snapshot_delete(
fs.id, snapshot.id, flags)

- def fs_snapshot_revert(self, fs, snapshot, files, restore_files,
+ def fs_snapshot_restore(self, fs, snapshot, files, restore_files,
all_files=False, flags=0):
- return self.sim_array.fs_snapshot_revert(
+ return self.sim_array.fs_snapshot_restore(
fs.id, snapshot.id, files, restore_files, all_files, flags)

def fs_child_dependency(self, fs, files, flags=0):
diff --git a/plugin/simc/simc_lsmplugin.c b/plugin/simc/simc_lsmplugin.c
index 3532dfe..b4fa9b2 100644
--- a/plugin/simc/simc_lsmplugin.c
+++ b/plugin/simc/simc_lsmplugin.c
@@ -2196,7 +2196,7 @@ static int ss_delete(lsm_plugin_ptr c, lsm_fs *fs, lsm_fs_ss *ss,
return rc;
}

-static int ss_revert(lsm_plugin_ptr c, lsm_fs *fs, lsm_fs_ss *ss,
+static int ss_restore(lsm_plugin_ptr c, lsm_fs *fs, lsm_fs_ss *ss,
lsm_string_list *files,
lsm_string_list *restore_files,
int all_files, char **job, lsm_flag flags)
@@ -2232,7 +2232,7 @@ static struct lsm_fs_ops_v1 fs_ops = {
ss_list,
ss_create,
ss_delete,
- ss_revert
+ ss_restore
};

static int nfs_auth_types(lsm_plugin_ptr c, lsm_string_list **types,
diff --git a/python_binding/lsm/_client.py b/python_binding/lsm/_client.py
index a87e557..7aded84 100644
--- a/python_binding/lsm/_client.py
+++ b/python_binding/lsm/_client.py
@@ -993,16 +993,16 @@ class Client(INetworkAttachedStorage):

## Reverts a snapshot
# @param self The this pointer
- # @param fs The file system object to revert snapshot for
- # @param snapshot The snapshot file to revert back too
- # @param files The specific files to revert
+ # @param fs The file system object to restore snapshot for
+ # @param snapshot The snapshot file to restore back too
+ # @param files The specific files to restore
# @param restore_files Individual files to restore
- # @param all_files Set to True if all files should be reverted
+ # @param all_files Set to True if all files should be restored
# back
# @param flags Reserved for future use, must be zero.
# @return None on success, else job id
@_return_requires(unicode)
- def fs_snapshot_revert(self, fs, snapshot, files, restore_files,
+ def fs_snapshot_restore(self, fs, snapshot, files, restore_files,
all_files=False, flags=0):
"""
WARNING: Destructive!
@@ -1010,14 +1010,14 @@ class Client(INetworkAttachedStorage):
Reverts a file-system or just the specified files from the snapshot.
If a list of files is supplied but the array cannot restore just them
then the operation will fail with an LsmError raised. If files == None
- and all_files = True then all files on the file-system are reverted.
+ and all_files = True then all files on the file-system are restored.

Restore_file if None none must be the same length as files with each
index in each list referring to the associated file.

Returns None on success, else job id, LsmError exception on error
"""
- return self._tp.rpc('fs_snapshot_revert', _del_self(locals()))
+ return self._tp.rpc('fs_snapshot_restore', _del_self(locals()))

## Checks to see if a file system has child dependencies.
# @param fs The file system to check
diff --git a/python_binding/lsm/_cmdline.py b/python_binding/lsm/_cmdline.py
index c1f7e64..f5d5932 100644
--- a/python_binding/lsm/_cmdline.py
+++ b/python_binding/lsm/_cmdline.py
@@ -1213,7 +1213,7 @@ class CmdLine:
if self.confirm_prompt(True):
self._wait_for_it(
'fs-snap-restore',
- self.c.fs_snapshot_revert(
+ self.c.fs_snapshot_restore(
fs, ss, self.args.file, self.args.fileas, flag_all_files),
None)

diff --git a/python_binding/lsm/_iplugin.py b/python_binding/lsm/_iplugin.py
index 143146a..92cd6ae 100644
--- a/python_binding/lsm/_iplugin.py
+++ b/python_binding/lsm/_iplugin.py
@@ -497,7 +497,7 @@ class INetworkAttachedStorage(IPlugin):
"""
raise LsmError(ErrorNumber.NO_SUPPORT, "Not supported")

- def fs_snapshot_revert(self, fs, snapshot, files, restore_files,
+ def fs_snapshot_restore(self, fs, snapshot, files, restore_files,
all_files=False, flags=0):
"""
WARNING: Destructive!
@@ -506,7 +506,7 @@ class INetworkAttachedStorage(IPlugin):
If a list of files is supplied but the array cannot restore just them
then the operation will fail with an LsmError raised.
If files == None and all_files = True then all files on the
- file-system are reverted.
+ file-system are restored.

Restore_file if not None must be the same length as files with each
index in each list referring to the associated file.
diff --git a/test/plugin_test.py b/test/plugin_test.py
index 005048a..139b1d4 100755
--- a/test/plugin_test.py
+++ b/test/plugin_test.py
@@ -114,7 +114,7 @@ class TestProxy(object):
'fs_file_clone': (unicode,),
'fs_snapshot_create': (unicode, lsm.FsSnapshot),
'fs_snapshot_delete': (unicode,),
- 'fs_snapshot_revert': (unicode,),
+ 'fs_snapshot_restore': (unicode,),
'fs_child_dependency_rm': (unicode,)}

## The constructor.
diff --git a/test/tester.c b/test/tester.c
index 4a20b88..aa67460 100644
--- a/test/tester.c
+++ b/test/tester.c
@@ -944,9 +944,9 @@ START_TEST(test_ss)
fail_unless( LSM_ERR_OK == rc, "lsmStringListElemSet rc = %d", rc);
}

- rc = lsm_fs_ss_revert(c, fs, ss, files, files, 0, &job, LSM_FLAG_RSVD);
+ rc = lsm_fs_ss_restore(c, fs, ss, files, files, 0, &job, LSM_FLAG_RSVD);
if( LSM_ERR_JOB_STARTED == rc ) {
- printf("Waiting for lsmSsRevert!\n");
+ printf("Waiting for lsm_fs_ss_restore!\n");
wait_for_job(c, &job);
} else {
fail_unless(LSM_ERR_OK == rc);
@@ -1721,19 +1721,19 @@ START_TEST(test_invalid_input)
fail_unless(rc == LSM_ERR_INVALID_ARGUMENT, "rc = %d", rc);


- rc = lsm_fs_ss_revert(c, NULL, NULL, NULL, NULL, 0, NULL, LSM_FLAG_RSVD);
+ rc = lsm_fs_ss_restore(c, NULL, NULL, NULL, NULL, 0, NULL, LSM_FLAG_RSVD);
fail_unless(rc == LSM_ERR_INVALID_FS, "rc = %d", rc);

- rc = lsm_fs_ss_revert(c, arg_fs, NULL, NULL, NULL, 0, NULL, LSM_FLAG_RSVD);
+ rc = lsm_fs_ss_restore(c, arg_fs, NULL, NULL, NULL, 0, NULL, LSM_FLAG_RSVD);
fail_unless(rc == LSM_ERR_INVALID_SS, "rc = %d", rc);

- rc = lsm_fs_ss_revert(c, arg_fs, arg_ss, badf, NULL, 0, NULL, LSM_FLAG_RSVD);
+ rc = lsm_fs_ss_restore(c, arg_fs, arg_ss, badf, NULL, 0, NULL, LSM_FLAG_RSVD);
fail_unless(rc == LSM_ERR_INVALID_SL, "rc = %d", rc);

- rc = lsm_fs_ss_revert(c, arg_fs, arg_ss, badf, badf, 0, NULL, LSM_FLAG_RSVD);
+ rc = lsm_fs_ss_restore(c, arg_fs, arg_ss, badf, badf, 0, NULL, LSM_FLAG_RSVD);
fail_unless(rc == LSM_ERR_INVALID_SL, "rc = %d", rc);

- rc = lsm_fs_ss_revert(c, arg_fs, arg_ss, f, f, 0, NULL, LSM_FLAG_RSVD);
+ rc = lsm_fs_ss_restore(c, arg_fs, arg_ss, f, f, 0, NULL, LSM_FLAG_RSVD);
fail_unless(rc == LSM_ERR_INVALID_ARGUMENT, "rc = %d", rc);

rc = lsm_nfs_list(c, NULL, NULL, LSM_FLAG_RSVD);
--
1.8.2.1
Tony Asleson
2014-05-20 22:28:02 UTC
Permalink
The base class will provide the default unsupported methods,
thus they don't need to exist here.

Signed-off-by: Tony Asleson <***@redhat.com>
---
plugin/v7k/ibmv7k.py | 69 ----------------------------------------------------
1 file changed, 69 deletions(-)

diff --git a/plugin/v7k/ibmv7k.py b/plugin/v7k/ibmv7k.py
index 130e28d..d0005ca 100644
--- a/plugin/v7k/ibmv7k.py
+++ b/plugin/v7k/ibmv7k.py
@@ -453,38 +453,6 @@ class IbmV7k(IStorageAreaNetwork):
self._delete_volume(volume.id, force=True)
return None

- def volume_resize(self, volume, new_size_bytes, flags=0):
- raise LsmError(ErrorNumber.NOT_IMPLEMENTED,
- "API not implemented at this time")
-
- def volume_replicate(self, pool, rep_type, volume_src, name, flags=0):
- raise LsmError(ErrorNumber.NOT_IMPLEMENTED,
- "API not implemented at this time")
-
- def volume_replicate_range_block_size(self, system, flags=0):
- raise LsmError(ErrorNumber.NOT_IMPLEMENTED,
- "API not implemented at this time")
-
- def volume_replicate_range(self, rep_type, volume_src, volume_dest, ranges,
- flags=0):
- raise LsmError(ErrorNumber.NOT_IMPLEMENTED,
- "API not implemented at this time")
-
- def volume_online(self, volume, flags=0):
- # NOTE: Closest cli is mkvdiskhostmap, but that needs host id/name
- # as well... hence doesn't fit under this API
- raise LsmError(ErrorNumber.NO_SUPPORT, "Feature not supported")
-
- def volume_offline(self, volume, flags=0):
- # NOTE: Closest cli is rmvdiskhostmap, but that needs host id/name
- # as well... hence doesn't fit under this API
- raise LsmError(ErrorNumber.NO_SUPPORT, "Feature not supported")
-
- def iscsi_chap_auth(self, initiator, in_user, in_password, out_user,
- out_password, flags=0):
- raise LsmError(ErrorNumber.NOT_IMPLEMENTED,
- "API not implemented at this time")
-
def initiator_grant(self, initiator_id, initiator_type, volume, access,
flags=0):
# TODO: How to pass -force param ? For now, assume -force.
@@ -507,43 +475,6 @@ class IbmV7k(IStorageAreaNetwork):
self._initiator_revoke(initiator.id, volume.id)
return

- def access_group_list(self, flags=0):
- raise LsmError(ErrorNumber.NO_SUPPORT, "Feature not supported")
-
- def access_group_create(self, name, initiator_id, id_type, system_id,
- flags=0):
- raise LsmError(ErrorNumber.NO_SUPPORT, "Feature not supported")
-
- def access_group_del(self, group, flags=0):
- raise LsmError(ErrorNumber.NO_SUPPORT, "Feature not supported")
-
- def access_group_add_initiator(self, group, initiator_id, id_type,
- flags=0):
- raise LsmError(ErrorNumber.NO_SUPPORT, "Feature not supported")
-
- def access_group_del_initiator(self, group, initiator_id, flags=0):
- raise LsmError(ErrorNumber.NO_SUPPORT, "Feature not supported")
-
- def access_group_grant(self, group, volume, access, flags=0):
- raise LsmError(ErrorNumber.NO_SUPPORT, "Feature not supported")
-
- def access_group_revoke(self, group, volume, flags=0):
- raise LsmError(ErrorNumber.NO_SUPPORT, "Feature not supported")
-
- def volumes_accessible_by_access_group(self, group, flags=0):
- raise LsmError(ErrorNumber.NO_SUPPORT, "Feature not supported")
-
- def access_groups_granted_to_volume(self, volume, flags=0):
- raise LsmError(ErrorNumber.NO_SUPPORT, "Feature not supported")
-
- def volume_child_dependency(self, volume, flags=0):
- raise LsmError(ErrorNumber.NOT_IMPLEMENTED,
- "API not implemented at this time")
-
- def volume_child_dependency_rm(self, volume, flags=0):
- raise LsmError(ErrorNumber.NOT_IMPLEMENTED,
- "API not implemented at this time")
-
def volumes_accessible_by_initiator(self, initiator, flags=0):
gvabi = self._get_volumes_accessible_by_initiator(initiator.id)
--
1.8.2.1
Tony Asleson
2014-05-20 22:28:03 UTC
Permalink
Signed-off-by: Tony Asleson <***@redhat.com>
---
c_binding/lsm_mgmt.cpp | 2 +-
c_binding/lsm_plugin_ipc.cpp | 2 +-
plugin/nstor/nstor.py | 2 +-
plugin/ontap/ontap.py | 2 +-
plugin/sim/simarray.py | 6 +++---
plugin/sim/simulator.py | 4 ++--
plugin/smispy/eseries.py | 4 ++--
python_binding/lsm/_client.py | 4 ++--
python_binding/lsm/_cmdline.py | 2 +-
python_binding/lsm/_iplugin.py | 2 +-
10 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/c_binding/lsm_mgmt.cpp b/c_binding/lsm_mgmt.cpp
index b92a44b..8d51237 100644
--- a/c_binding/lsm_mgmt.cpp
+++ b/c_binding/lsm_mgmt.cpp
@@ -1539,7 +1539,7 @@ int lsm_access_group_delete(lsm_connect *c, lsm_access_group *group, lsm_flag fl
Value parameters(p);
Value response;

- return rpc(c, "access_group_del", parameters, response);
+ return rpc(c, "access_group_delete", parameters, response);
}

int lsm_access_group_initiator_add(lsm_connect *c,
diff --git a/c_binding/lsm_plugin_ipc.cpp b/c_binding/lsm_plugin_ipc.cpp
index cca61a6..18ac7d0 100644
--- a/c_binding/lsm_plugin_ipc.cpp
+++ b/c_binding/lsm_plugin_ipc.cpp
@@ -2360,7 +2360,7 @@ static int vol_accessible_by_init(lsm_plugin_ptr p, Value &params, Value &respon
static std::map<std::string,handler> dispatch = static_map<std::string,handler>
("access_group_add_initiator", ag_initiator_add)
("access_group_create", ag_create)
- ("access_group_del", ag_delete)
+ ("access_group_delete", ag_delete)
("access_group_del_initiator", ag_initiator_del)
("access_group_grant", ag_grant)
("access_group_list", ag_list)
diff --git a/plugin/nstor/nstor.py b/plugin/nstor/nstor.py
index 8254ab5..107cdb3 100644
--- a/plugin/nstor/nstor.py
+++ b/plugin/nstor/nstor.py
@@ -724,7 +724,7 @@ class NexentaStor(INfs, IStorageAreaNetwork):

return AccessGroup(name, name, [initiator_id], self.system.id)

- def access_group_del(self, group, flags=0):
+ def access_group_delete(self, group, flags=0):
"""
Deletes an access group
"""
diff --git a/plugin/ontap/ontap.py b/plugin/ontap/ontap.py
index 3f87ecd..40e3d00 100644
--- a/plugin/ontap/ontap.py
+++ b/plugin/ontap/ontap.py
@@ -771,7 +771,7 @@ class Ontap(IStorageAreaNetwork, INfs):
"Unable to find group just created!")

@handle_ontap_errors
- def access_group_del(self, group, flags=0):
+ def access_group_delete(self, group, flags=0):
return self.f.igroup_delete(group.name)

@handle_ontap_errors
diff --git a/plugin/sim/simarray.py b/plugin/sim/simarray.py
index 29268ad..80ef3bd 100644
--- a/plugin/sim/simarray.py
+++ b/plugin/sim/simarray.py
@@ -362,8 +362,8 @@ class SimArray(object):
name, init_id, init_type, sys_id, flags)
return SimArray._sim_ag_2_lsm(sim_ag)

- def access_group_del(self, ag_id, flags=0):
- return self.data.access_group_del(ag_id, flags)
+ def access_group_delete(self, ag_id, flags=0):
+ return self.data.access_group_delete(ag_id, flags)

def access_group_add_initiator(self, ag_id, init_id, init_type, flags=0):
return self.data.access_group_add_initiator(
@@ -1048,7 +1048,7 @@ class SimData(object):
self.ag_dict[sim_ag['ag_id']] = sim_ag
return sim_ag

- def access_group_del(self, ag_id, flags=0):
+ def access_group_delete(self, ag_id, flags=0):
if ag_id not in self.ag_dict.keys():
raise LsmError(ErrorNumber.NOT_FOUND_ACCESS_GROUP,
"Access group not found")
diff --git a/plugin/sim/simulator.py b/plugin/sim/simulator.py
index b489cb5..e64296b 100644
--- a/plugin/sim/simulator.py
+++ b/plugin/sim/simulator.py
@@ -172,8 +172,8 @@ class SimPlugin(INfs, IStorageAreaNetwork):
name, initiator_id, id_type, system_id, flags)
return SimPlugin._sim_data_2_lsm(sim_ag)

- def access_group_del(self, group, flags=0):
- return self.sim_array.access_group_del(group.id, flags)
+ def access_group_delete(self, group, flags=0):
+ return self.sim_array.access_group_delete(group.id, flags)

def access_group_add_initiator(self, group, initiator_id, id_type,
flags=0):
diff --git a/plugin/smispy/eseries.py b/plugin/smispy/eseries.py
index 6b470ec..8aa3d18 100644
--- a/plugin/smispy/eseries.py
+++ b/plugin/smispy/eseries.py
@@ -57,14 +57,14 @@ class ESeries(Smis):
return True

@handle_cim_errors
- def access_group_del(self, group, flags=0):
+ def access_group_delete(self, group, flags=0):
ccs = self._get_class_instance('CIM_ControllerConfigurationService')

pc = self._get_cim_instance_by_id('AccessGroup', group.id)

in_params = {'ProtocolController': pc.path}

- return self._pi("access_group_del", Smis.JOB_RETRIEVE_NONE,
+ return self._pi("access_group_delete", Smis.JOB_RETRIEVE_NONE,
*(self._c.InvokeMethod('DeleteProtocolController',
ccs.path, **in_params)))[0]

diff --git a/python_binding/lsm/_client.py b/python_binding/lsm/_client.py
index e271c3a..74a6524 100644
--- a/python_binding/lsm/_client.py
+++ b/python_binding/lsm/_client.py
@@ -735,11 +735,11 @@ class Client(INetworkAttachedStorage):
# @param flags Reserved for future use, must be zero.
# @returns None on success, throws LsmError on errors.
@_return_requires(None)
- def access_group_del(self, group, flags=0):
+ def access_group_delete(self, group, flags=0):
"""
Deletes an access group
"""
- return self._tp.rpc('access_group_del', _del_self(locals()))
+ return self._tp.rpc('access_group_delete', _del_self(locals()))

## Adds an initiator to an access group
# @param self The this pointer
diff --git a/python_binding/lsm/_cmdline.py b/python_binding/lsm/_cmdline.py
index ebdd03b..64db2fe 100644
--- a/python_binding/lsm/_cmdline.py
+++ b/python_binding/lsm/_cmdline.py
@@ -988,7 +988,7 @@ class CmdLine:
def access_group_delete(self, args):
agl = self.c.access_groups()
group = _get_item(agl, args.ag, "access group id")
- return self.c.access_group_del(group)
+ return self.c.access_group_delete(group)

## Used to delete a file system
def fs_delete(self, args):
diff --git a/python_binding/lsm/_iplugin.py b/python_binding/lsm/_iplugin.py
index 493a093..3fc9ca7 100644
--- a/python_binding/lsm/_iplugin.py
+++ b/python_binding/lsm/_iplugin.py
@@ -328,7 +328,7 @@ class IStorageAreaNetwork(IPlugin):
"""
raise LsmError(ErrorNumber.NO_SUPPORT, "Not supported")

- def access_group_del(self, group, flags=0):
+ def access_group_delete(self, group, flags=0):
"""
Deletes an access group, Raises LsmError on error
"""
--
1.8.2.1
Tony Asleson
2014-05-20 22:28:04 UTC
Permalink
IRC discussions suggested changing this from:

startup -> plugin_startup
shutdown -> plugin_shutdown

However, the C API call backs were already called:

plugin_register, plugin_unregister

So I adopted that across the code base to make consistent.

Signed-off-by: Tony Asleson <***@redhat.com>
---
c_binding/lsm_datatypes.cpp | 2 +-
c_binding/lsm_mgmt.cpp | 4 ++--
c_binding/lsm_plugin_ipc.cpp | 8 ++++----
daemon/lsm_rest.c | 8 ++++----
plugin/nstor/nstor.py | 4 ++--
plugin/ontap/ontap.py | 4 ++--
plugin/sim/simulator.py | 4 ++--
plugin/smispy/smis.py | 6 +++---
plugin/smispy/smisproxy.py | 4 ++--
plugin/targetd/targetd.py | 4 ++--
plugin/v7k/ibmv7k.py | 4 ++--
python_binding/lsm/_client.py | 12 ++++++------
python_binding/lsm/_cmdline.py | 2 +-
python_binding/lsm/_iplugin.py | 10 +++++-----
python_binding/lsm/_pluginrunner.py | 8 ++++----
15 files changed, 42 insertions(+), 42 deletions(-)

diff --git a/c_binding/lsm_datatypes.cpp b/c_binding/lsm_datatypes.cpp
index 44ba0c3..892445f 100644
--- a/c_binding/lsm_datatypes.cpp
+++ b/c_binding/lsm_datatypes.cpp
@@ -251,7 +251,7 @@ static int connection_establish( lsm_connect *c, const char * password,
params["flags"] = Value(flags);
Value p(params);

- c->tp->rpc("startup", p);
+ c->tp->rpc("plugin_register", p);
} catch (const ValueException &ve) {
*e = lsm_error_create(LSM_ERR_TRANSPORT_SERIALIZATION,
LSM_ERR_DOMAIN_FRAME_WORK,
diff --git a/c_binding/lsm_mgmt.cpp b/c_binding/lsm_mgmt.cpp
index 8d51237..a6a8615 100644
--- a/c_binding/lsm_mgmt.cpp
+++ b/c_binding/lsm_mgmt.cpp
@@ -197,8 +197,8 @@ int lsm_connect_close(lsm_connect *c, lsm_flag flags)
Value parameters(p);
Value response;

- //No response data needed on shutdown.
- int rc = rpc(c, "shutdown", parameters, response);
+ //No response data needed on plugin_unregister
+ int rc = rpc(c, "plugin_unregister", parameters, response);

//Free the connection.
connection_free(c);
diff --git a/c_binding/lsm_plugin_ipc.cpp b/c_binding/lsm_plugin_ipc.cpp
index 18ac7d0..484ad3e 100644
--- a/c_binding/lsm_plugin_ipc.cpp
+++ b/c_binding/lsm_plugin_ipc.cpp
@@ -256,12 +256,12 @@ int lsm_plugin_init_v1( int argc, char *argv[], lsm_plugin_register reg,

typedef int (*handler)(lsm_plugin_ptr p, Value &params, Value &response);

-static int handle_shutdown(lsm_plugin_ptr p, Value &params, Value &response)
+static int handle_unregister(lsm_plugin_ptr p, Value &params, Value &response)
{
return LSM_ERR_OK;
}

-static int handle_startup(lsm_plugin_ptr p, Value &params, Value &response)
+static int handle_register(lsm_plugin_ptr p, Value &params, Value &response)
{
int rc = LSM_ERR_NO_SUPPORT;
std::string uri_string;
@@ -2400,8 +2400,8 @@ static std::map<std::string,handler> dispatch = static_map<std::string,handler>
("pool_create_from_pool", handle_pool_create_from_pool)
("pool_delete", handle_pool_delete)
("time_out_set", handle_set_time_out)
- ("shutdown", handle_shutdown)
- ("startup", handle_startup)
+ ("plugin_unregister", handle_unregister)
+ ("plugin_register", handle_register)
("systems", handle_system_list)
("volume_child_dependency_rm", volume_dependency_rm)
("volume_child_dependency", volume_dependency)
diff --git a/daemon/lsm_rest.c b/daemon/lsm_rest.c
index 587efeb..6fba3bf 100644
--- a/daemon/lsm_rest.c
+++ b/daemon/lsm_rest.c
@@ -328,7 +328,7 @@ int plugin_startup(int socket_fd, const char *uri, const char *pass, int tmo)
para_list_add(para_list, "uri", uri, lsm_json_type_string, 0);
para_list_add(para_list, "password", pass, pass_type, 0);
para_list_add(para_list, "timeout", &tmo, lsm_json_type_int, 0);
- rpc(socket_fd, "startup", para_list, &error_no);
+ rpc(socket_fd, "plugin_register", para_list, &error_no);
return error_no;
}

@@ -340,7 +340,7 @@ int plugin_shutdown(int socket_fd)
para_list_init(para_list);
int lsm_flags = 0;
para_list_add(para_list, "flags", &lsm_flags, lsm_json_type_int, 0);
- rpc(socket_fd, "shutdown", para_list, &error_no);
+ rpc(socket_fd, "plugin_unregister", para_list, &error_no);
return error_no;
}

@@ -377,7 +377,7 @@ const char *lsm_api_0_1(struct MHD_Connection *connection,
}
error_no = plugin_startup(socket_fd, uri, pass, LSM_REST_TMO);
if (error_no != 0){
- fprintf(stderr, "Failed to startup plugin, "
+ fprintf(stderr, "Failed to register plugin, "
"error_no %d", error_no);
plugin_shutdown(socket_fd);
shutdown(socket_fd, 0);
@@ -405,7 +405,7 @@ const char *lsm_api_0_1(struct MHD_Connection *connection,
}
error_no = plugin_shutdown(socket_fd);
if (error_no != 0){
- fprintf(stderr, "Failed to shutdown plugin, "
+ fprintf(stderr, "Failed to unregister plugin, "
"error_no %d", error_no);
}
shutdown(socket_fd, 0);
diff --git a/plugin/nstor/nstor.py b/plugin/nstor/nstor.py
index 107cdb3..a906b5f 100644
--- a/plugin/nstor/nstor.py
+++ b/plugin/nstor/nstor.py
@@ -82,7 +82,7 @@ class NexentaStor(INfs, IStorageAreaNetwork):
System.STATUS_OK, '')
return self._system

- def startup(self, uri, password, timeout, flags=0):
+ def plugin_register(self, uri, password, timeout, flags=0):
self.uparse = urlparse.urlparse(uri)
self.password = password or 'nexenta'
self.timeout = timeout
@@ -195,7 +195,7 @@ class NexentaStor(INfs, IStorageAreaNetwork):
def time_out_get(self, flags=0):
return self.timeout

- def shutdown(self, flags=0):
+ def plugin_unregister(self, flags=0):
return

def job_status(self, job_id, flags=0):
diff --git a/plugin/ontap/ontap.py b/plugin/ontap/ontap.py
index 40e3d00..e8c528e 100644
--- a/plugin/ontap/ontap.py
+++ b/plugin/ontap/ontap.py
@@ -143,7 +143,7 @@ class Ontap(IStorageAreaNetwork, INfs):
self.sys_info = None

@handle_ontap_errors
- def startup(self, uri, password, timeout, flags=0):
+ def plugin_register(self, uri, password, timeout, flags=0):
ssl = False
u = urlparse.urlparse(uri)

@@ -165,7 +165,7 @@ class Ontap(IStorageAreaNetwork, INfs):
def time_out_get(self, flags=0):
return self.f.timeout * Ontap.TMO_CONV

- def shutdown(self, flags=0):
+ def plugin_unregister(self, flags=0):
pass

@staticmethod
diff --git a/plugin/sim/simulator.py b/plugin/sim/simulator.py
index e64296b..bdd9cf2 100644
--- a/plugin/sim/simulator.py
+++ b/plugin/sim/simulator.py
@@ -31,7 +31,7 @@ class SimPlugin(INfs, IStorageAreaNetwork):
self.tmo = 0
self.sim_array = None

- def startup(self, uri, password, timeout, flags=0):
+ def plugin_register(self, uri, password, timeout, flags=0):
self.uri = uri
self.password = password

@@ -46,7 +46,7 @@ class SimPlugin(INfs, IStorageAreaNetwork):

return None

- def shutdown(self, flags=0):
+ def plugin_unregister(self, flags=0):
self.sim_array.save_state()

def job_status(self, job_id, flags=0):
diff --git a/plugin/smispy/smis.py b/plugin/smispy/smis.py
index 77fbc2b..a8ad4d0 100644
--- a/plugin/smispy/smis.py
+++ b/plugin/smispy/smis.py
@@ -489,7 +489,7 @@ class Smis(IStorageAreaNetwork):
'Error: ' + msg + " rc= " + str(rc))

@handle_cim_errors
- def startup(self, uri, password, timeout, flags=0):
+ def plugin_register(self, uri, password, timeout, flags=0):
"""
Called when the plug-in runner gets the start request from the client.
Checkout interop support status via:
@@ -593,7 +593,7 @@ class Smis(IStorageAreaNetwork):
def time_out_get(self, flags=0):
return self.tmo

- def shutdown(self, flags=0):
+ def plugin_unregister(self, flags=0):
self._c = None

def _scs_supported_capabilities(self, system, cap):
@@ -3453,7 +3453,7 @@ class Smis(IStorageAreaNetwork):
v
CIM_ComputerSystem # vendor namespace

- We depend on self.cim_reg_profiles which was updated by startup().
+ We depend on self.cim_reg_profiles which was updated by plugin_register().
But this method does not check it, you should check
self.fallback_mode == True before call this method.

diff --git a/plugin/smispy/smisproxy.py b/plugin/smispy/smisproxy.py
index b06c835..19a32ce 100644
--- a/plugin/smispy/smisproxy.py
+++ b/plugin/smispy/smisproxy.py
@@ -32,7 +32,7 @@ class SmisProxy(Proxy):
def plugin_info(self, flags=0):
return "Generic SMI-S support", VERSION

- def startup(self, uri, password, timeout, flags=0):
+ def plugin_register(self, uri, password, timeout, flags=0):
"""
We will provide a concrete implementation of this to get the process
started. All other method will be delegated to implementation.
@@ -48,4 +48,4 @@ class SmisProxy(Proxy):
else:
self.proxied_obj = Smis()

- self.proxied_obj.startup(uri, password, timeout, flags)
+ self.proxied_obj.plugin_register(uri, password, timeout, flags)
diff --git a/plugin/targetd/targetd.py b/plugin/targetd/targetd.py
index b437ce5..0f82349 100644
--- a/plugin/targetd/targetd.py
+++ b/plugin/targetd/targetd.py
@@ -61,7 +61,7 @@ class TargetdStorage(IStorageAreaNetwork, INfs):
System.STATUS_UNKNOWN, '')

@handle_errors
- def startup(self, uri, password, timeout, flags=0):
+ def plugin_register(self, uri, password, timeout, flags=0):
self.uri = uri_parse(uri)
self.password = password
self.tmo = timeout
@@ -91,7 +91,7 @@ class TargetdStorage(IStorageAreaNetwork, INfs):
return self.tmo

@handle_errors
- def shutdown(self, flags=0):
+ def plugin_unregister(self, flags=0):
pass

@handle_errors
diff --git a/plugin/v7k/ibmv7k.py b/plugin/v7k/ibmv7k.py
index d0005ca..f7ef393 100644
--- a/plugin/v7k/ibmv7k.py
+++ b/plugin/v7k/ibmv7k.py
@@ -373,7 +373,7 @@ class IbmV7k(IStorageAreaNetwork):

return

- def startup(self, uri, password, timeout, flags=0):
+ def plugin_register(self, uri, password, timeout, flags=0):
self.password = password
self.tmo = timeout
self.up = uri_parse(uri)
@@ -393,7 +393,7 @@ class IbmV7k(IStorageAreaNetwork):
def time_out_get(self, flags=0):
return self.tmo

- def shutdown(self, flags=0):
+ def plugin_unregister(self, flags=0):
self.ssh.close()
return

diff --git a/python_binding/lsm/_client.py b/python_binding/lsm/_client.py
index 74a6524..472f5a8 100644
--- a/python_binding/lsm/_client.py
+++ b/python_binding/lsm/_client.py
@@ -61,7 +61,7 @@ class Client(INetworkAttachedStorage):
"""
## Method added so that the interface for the client RPC and the plug-in
## itself match.
- def startup(self, uri, plain_text_password, timeout_ms, flags=0):
+ def plugin_register(self, uri, plain_text_password, timeout_ms, flags=0):
raise RuntimeError("Do not call directly!")

## Called when we are ready to initialize the plug-in.
@@ -75,7 +75,7 @@ class Client(INetworkAttachedStorage):
"""
Instruct the plug-in to get ready
"""
- self._tp.rpc('startup', _del_self(locals()))
+ self._tp.rpc('plugin_register', _del_self(locals()))

## Checks to see if any unix domain sockets exist in the base directory
# and opens a socket to one to see if the server is actually there.
@@ -150,21 +150,21 @@ class Client(INetworkAttachedStorage):

## Synonym for close.
@_return_requires(None)
- def shutdown(self, flags=0):
+ def plugin_unregister(self, flags=0):
"""
Synonym for close.
"""
self.close(flags)

- ## Does an orderly shutdown of the plug-in
+ ## Does an orderly plugin_unregister of the plug-in
# @param self The this pointer
# @param flags Reserved for future use, must be zero.
@_return_requires(None)
def close(self, flags=0):
"""
- Does an orderly shutdown of the plug-in
+ Does an orderly plugin_unregister of the plug-in
"""
- self._tp.rpc('shutdown', _del_self(locals()))
+ self._tp.rpc('plugin_unregister', _del_self(locals()))
self._tp.close()
self._tp = None

diff --git a/python_binding/lsm/_cmdline.py b/python_binding/lsm/_cmdline.py
index 64db2fe..7e8078c 100644
--- a/python_binding/lsm/_cmdline.py
+++ b/python_binding/lsm/_cmdline.py
@@ -1634,7 +1634,7 @@ class CmdLine:
#Directly invoking code though a wrapper to catch unsupported
#operations.
self.c = Proxy(cli())
- self.c.startup(self.uri, self.password, self.tmo)
+ self.c.plugin_register(self.uri, self.password, self.tmo)
self.cleanup = self.c.shutdown
else:
#Going across the ipc pipe
diff --git a/python_binding/lsm/_iplugin.py b/python_binding/lsm/_iplugin.py
index 3fc9ca7..d4bbab5 100644
--- a/python_binding/lsm/_iplugin.py
+++ b/python_binding/lsm/_iplugin.py
@@ -28,7 +28,7 @@ class IPlugin(object):
__metaclass__ = _ABCMeta

@_abstractmethod
- def startup(self, uri, password, timeout, flags=0):
+ def plugin_register(self, uri, password, timeout, flags=0):
"""
Method first called to setup the plug-in (except for plugin_info)

@@ -57,12 +57,12 @@ class IPlugin(object):
pass

@_abstractmethod
- def shutdown(self, flags=0):
+ def plugin_unregister(self, flags=0):
"""
Called when the client wants to finish up or the socket goes eof.
Plug-in should clean up all resources. Note: In the case where
- the socket goes EOF and the shutdown runs into errors the exception(s)
- will not be delivered to the client!
+ the socket goes EOF and the plugin_unregister runs into errors the
+ exception(s) will not be delivered to the client!

Returns None on success, else LsmError exception
"""
@@ -100,7 +100,7 @@ class IPlugin(object):
"""
Returns the description and version for plug-in, raises LsmError

- Note: Make sure plugin can handle this call before startup is called.
+ Note: Make sure plugin can handle this call before plugin_register is called.
"""
pass

diff --git a/python_binding/lsm/_pluginrunner.py b/python_binding/lsm/_pluginrunner.py
index cb29b5e..7e8121b 100644
--- a/python_binding/lsm/_pluginrunner.py
+++ b/python_binding/lsm/_pluginrunner.py
@@ -99,11 +99,11 @@ class PluginRunner(object):

self.tp.send_resp(result)

- if method == 'startup':
+ if method == 'plugin_register':
need_shutdown = True

- if method == 'shutdown':
- #This is a graceful shutdown
+ if method == 'plugin_unregister':
+ #This is a graceful plugin_unregister
need_shutdown = False
self.tp.close()
break
@@ -133,5 +133,5 @@ class PluginRunner(object):
finally:
if need_shutdown:
#Client wasn't nice, we will allow plug-in to cleanup
- self.plugin.shutdown()
+ self.plugin.plugin_unregister()
sys.exit(2)
--
1.8.2.1
Tony Asleson
2014-05-20 22:28:07 UTC
Permalink
access_group_add_initiator -> access_group_initiator_add
access_group_del_initiator -> access_group_initiator_delete

Follow noun->verb and expand del to delete.

Signed-off-by: Tony Asleson <***@redhat.com>
---
c_binding/lsm_mgmt.cpp | 4 ++--
c_binding/lsm_plugin_ipc.cpp | 4 ++--
plugin/nstor/nstor.py | 4 ++--
plugin/ontap/ontap.py | 4 ++--
plugin/sim/simarray.py | 12 ++++++------
plugin/sim/simulator.py | 8 ++++----
plugin/simc/simc_lsmplugin.c | 8 ++++----
plugin/smispy/smis.py | 6 +++---
python_binding/lsm/_client.py | 8 ++++----
python_binding/lsm/_cmdline.py | 4 ++--
python_binding/lsm/_iplugin.py | 4 ++--
test/cmdtest.py | 4 ++--
12 files changed, 35 insertions(+), 35 deletions(-)

diff --git a/c_binding/lsm_mgmt.cpp b/c_binding/lsm_mgmt.cpp
index 61c8ce2..08dda5c 100644
--- a/c_binding/lsm_mgmt.cpp
+++ b/c_binding/lsm_mgmt.cpp
@@ -1568,7 +1568,7 @@ int lsm_access_group_initiator_add(lsm_connect *c,
Value parameters(p);
Value response;

- return rpc(c, "access_group_add_initiator", parameters, response);
+ return rpc(c, "access_group_initiator_add", parameters, response);
}

int lsm_access_group_initiator_delete(lsm_connect *c, lsm_access_group *group,
@@ -1592,7 +1592,7 @@ int lsm_access_group_initiator_delete(lsm_connect *c, lsm_access_group *group,
Value parameters(p);
Value response;

- return rpc(c, "access_group_del_initiator", parameters, response);
+ return rpc(c, "access_group_initiator_delete", parameters, response);
}

int lsm_access_group_grant(lsm_connect *c, lsm_access_group *group,
diff --git a/c_binding/lsm_plugin_ipc.cpp b/c_binding/lsm_plugin_ipc.cpp
index a9ff530..a508305 100644
--- a/c_binding/lsm_plugin_ipc.cpp
+++ b/c_binding/lsm_plugin_ipc.cpp
@@ -2358,10 +2358,10 @@ static int vol_accessible_by_init(lsm_plugin_ptr p, Value &params, Value &respon
* map of function pointers
*/
static std::map<std::string,handler> dispatch = static_map<std::string,handler>
- ("access_group_add_initiator", ag_initiator_add)
+ ("access_group_initiator_add", ag_initiator_add)
("access_group_create", ag_create)
("access_group_delete", ag_delete)
- ("access_group_del_initiator", ag_initiator_del)
+ ("access_group_initiator_delete", ag_initiator_del)
("access_group_grant", ag_grant)
("access_group_list", ag_list)
("access_group_revoke", ag_revoke)
diff --git a/plugin/nstor/nstor.py b/plugin/nstor/nstor.py
index 479af78..ba60677 100644
--- a/plugin/nstor/nstor.py
+++ b/plugin/nstor/nstor.py
@@ -739,7 +739,7 @@ class NexentaStor(INfs, IStorageAreaNetwork):
self._request(command, "stmf", [group_name, initiator_id])
return

- def access_group_add_initiator(self, group, initiator_id, id_type,
+ def access_group_initiator_add(self, group, initiator_id, id_type,
flags=0):
"""
Adds an initiator to an access group
@@ -751,7 +751,7 @@ class NexentaStor(INfs, IStorageAreaNetwork):
self._add_initiator(group.name, initiator_id)
return None

- def access_group_del_initiator(self, group, initiator_id, flags=0):
+ def access_group_initiator_delete(self, group, initiator_id, flags=0):
"""
Deletes an initiator from an access group
"""
diff --git a/plugin/ontap/ontap.py b/plugin/ontap/ontap.py
index 229e609..9f3965b 100644
--- a/plugin/ontap/ontap.py
+++ b/plugin/ontap/ontap.py
@@ -775,12 +775,12 @@ class Ontap(IStorageAreaNetwork, INfs):
return self.f.igroup_delete(group.name)

@handle_ontap_errors
- def access_group_add_initiator(self, group, initiator_id, id_type,
+ def access_group_initiator_add(self, group, initiator_id, id_type,
flags=0):
return self.f.igroup_add_initiator(group.name, initiator_id)

@handle_ontap_errors
- def access_group_del_initiator(self, group, initiator_id, flags=0):
+ def access_group_initiator_delete(self, group, initiator_id, flags=0):
return self.f.igroup_del_initiator(group.name, initiator_id)

@handle_ontap_errors
diff --git a/plugin/sim/simarray.py b/plugin/sim/simarray.py
index fd940b6..4ee2b9b 100644
--- a/plugin/sim/simarray.py
+++ b/plugin/sim/simarray.py
@@ -365,12 +365,12 @@ class SimArray(object):
def access_group_delete(self, ag_id, flags=0):
return self.data.access_group_delete(ag_id, flags)

- def access_group_add_initiator(self, ag_id, init_id, init_type, flags=0):
- return self.data.access_group_add_initiator(
+ def access_group_initiator_add(self, ag_id, init_id, init_type, flags=0):
+ return self.data.access_group_initiator_add(
ag_id, init_id, init_type, flags)

- def access_group_del_initiator(self, ag_id, init_id, flags=0):
- return self.data.access_group_del_initiator(ag_id, init_id, flags)
+ def access_group_initiator_delete(self, ag_id, init_id, flags=0):
+ return self.data.access_group_initiator_delete(ag_id, init_id, flags)

def access_group_grant(self, ag_id, vol_id, access, flags=0):
return self.data.access_group_grant(ag_id, vol_id, access, flags)
@@ -1055,7 +1055,7 @@ class SimData(object):
del(self.ag_dict[ag_id])
return None

- def access_group_add_initiator(self, ag_id, init_id, init_type, flags=0):
+ def access_group_initiator_add(self, ag_id, init_id, init_type, flags=0):
if ag_id not in self.ag_dict.keys():
raise LsmError(ErrorNumber.NOT_FOUND_ACCESS_GROUP,
"Access group not found")
@@ -1073,7 +1073,7 @@ class SimData(object):

return None

- def access_group_del_initiator(self, ag_id, init_id, flags=0):
+ def access_group_initiator_delete(self, ag_id, init_id, flags=0):
if ag_id not in self.ag_dict.keys():
raise LsmError(ErrorNumber.NOT_FOUND_ACCESS_GROUP,
"Access group not found: %s" % ag_id)
diff --git a/plugin/sim/simulator.py b/plugin/sim/simulator.py
index e109639..6370f1b 100644
--- a/plugin/sim/simulator.py
+++ b/plugin/sim/simulator.py
@@ -175,14 +175,14 @@ class SimPlugin(INfs, IStorageAreaNetwork):
def access_group_delete(self, group, flags=0):
return self.sim_array.access_group_delete(group.id, flags)

- def access_group_add_initiator(self, group, initiator_id, id_type,
+ def access_group_initiator_add(self, group, initiator_id, id_type,
flags=0):
- sim_ag = self.sim_array.access_group_add_initiator(
+ sim_ag = self.sim_array.access_group_initiator_add(
group.id, initiator_id, id_type, flags)
return SimPlugin._sim_data_2_lsm(sim_ag)

- def access_group_del_initiator(self, group, initiator_id, flags=0):
- return self.sim_array.access_group_del_initiator(
+ def access_group_initiator_delete(self, group, initiator_id, flags=0):
+ return self.sim_array.access_group_initiator_delete(
group.id, initiator_id, flags)

def access_group_grant(self, group, volume, access, flags=0):
diff --git a/plugin/simc/simc_lsmplugin.c b/plugin/simc/simc_lsmplugin.c
index b4fa9b2..3749ede 100644
--- a/plugin/simc/simc_lsmplugin.c
+++ b/plugin/simc/simc_lsmplugin.c
@@ -1290,7 +1290,7 @@ static int access_group_delete( lsm_plugin_ptr c,
return rc;
}

-static int access_group_add_initiator( lsm_plugin_ptr c,
+static int access_group_initiator_add( lsm_plugin_ptr c,
lsm_access_group *group,
const char *initiator_id,
lsm_initiator_type id_type,
@@ -1313,7 +1313,7 @@ static int access_group_add_initiator( lsm_plugin_ptr c,
return rc;
}

-static int access_group_del_initiator( lsm_plugin_ptr c,
+static int access_group_initiator_delete( lsm_plugin_ptr c,
lsm_access_group *group,
const char *init,
lsm_flag flags)
@@ -1850,8 +1850,8 @@ static struct lsm_san_ops_v1 san_ops = {
access_group_list,
access_group_create,
access_group_delete,
- access_group_add_initiator,
- access_group_del_initiator,
+ access_group_initiator_add,
+ access_group_initiator_delete,
access_group_grant,
access_group_revoke,
vol_accessible_by_ag,
diff --git a/plugin/smispy/smis.py b/plugin/smispy/smis.py
index a8ad4d0..7d9f14d 100644
--- a/plugin/smispy/smis.py
+++ b/plugin/smispy/smis.py
@@ -2159,7 +2159,7 @@ class Smis(IStorageAreaNetwork):
return initiator

@handle_cim_errors
- def access_group_add_initiator(self, group, initiator_id, id_type,
+ def access_group_initiator_add(self, group, initiator_id, id_type,
flags=0):
# Check to see if we have this initiator already, if we don't create
# it and then add to the view.
@@ -2178,12 +2178,12 @@ class Smis(IStorageAreaNetwork):
'ProtocolControllers': [spc.path]}

# Returns None or job id
- return self._pi("access_group_add_initiator", Smis.JOB_RETRIEVE_NONE,
+ return self._pi("access_group_initiator_add", Smis.JOB_RETRIEVE_NONE,
*(self._c.InvokeMethod('ExposePaths', ccs.path,
**in_params)))[0]

@handle_cim_errors
- def access_group_del_initiator(self, group, initiator, flags=0):
+ def access_group_initiator_delete(self, group, initiator, flags=0):
spc = self._get_cim_instance_by_id('AccessGroup', group.id)
ccs = self._get_class_instance('CIM_ControllerConfigurationService',
'SystemName', group.system_id)
diff --git a/python_binding/lsm/_client.py b/python_binding/lsm/_client.py
index 7aded84..f3f2bd1 100644
--- a/python_binding/lsm/_client.py
+++ b/python_binding/lsm/_client.py
@@ -749,12 +749,12 @@ class Client(INetworkAttachedStorage):
# @param flags Reserved for future use, must be zero.
# @returns None on success, throws LsmError on errors.
@_return_requires(None)
- def access_group_add_initiator(self, group, initiator_id, id_type,
+ def access_group_initiator_add(self, group, initiator_id, id_type,
flags=0):
"""
Adds an initiator to an access group
"""
- return self._tp.rpc('access_group_add_initiator', _del_self(locals()))
+ return self._tp.rpc('access_group_initiator_add', _del_self(locals()))

## Deletes an initiator from an access group
# @param self The this pointer
@@ -763,11 +763,11 @@ class Client(INetworkAttachedStorage):
# @param flags Reserved for future use, must be zero.
# @returns None on success, throws LsmError on errors.
@_return_requires(None)
- def access_group_del_initiator(self, group, initiator_id, flags=0):
+ def access_group_initiator_delete(self, group, initiator_id, flags=0):
"""
Deletes an initiator from an access group
"""
- return self._tp.rpc('access_group_del_initiator', _del_self(locals()))
+ return self._tp.rpc('access_group_initiator_delete', _del_self(locals()))

## Returns the list of volumes that access group has access to.
# @param self The this pointer
diff --git a/python_binding/lsm/_cmdline.py b/python_binding/lsm/_cmdline.py
index f5d5932..e0d5c01 100644
--- a/python_binding/lsm/_cmdline.py
+++ b/python_binding/lsm/_cmdline.py
@@ -942,11 +942,11 @@ class CmdLine:

if op:
init = CmdLine._init_type_to_enum(args.init_type)
- self.c.access_group_add_initiator(
+ self.c.access_group_initiator_add(
group, args.init, init)
else:
init = _get_item(self.c.initiators(), args.init, "initiator id")
- self.c.access_group_del_initiator(group, init.id)
+ self.c.access_group_initiator_delete(group, init.id)

## Adds an initiator from an access group
def access_group_add(self, args):
diff --git a/python_binding/lsm/_iplugin.py b/python_binding/lsm/_iplugin.py
index 92cd6ae..3448163 100644
--- a/python_binding/lsm/_iplugin.py
+++ b/python_binding/lsm/_iplugin.py
@@ -334,14 +334,14 @@ class IStorageAreaNetwork(IPlugin):
"""
raise LsmError(ErrorNumber.NO_SUPPORT, "Not supported")

- def access_group_add_initiator(self, group, initiator_id, id_type,
+ def access_group_initiator_add(self, group, initiator_id, id_type,
flags=0):
"""
Adds an initiator to an access group, Raises LsmError on error
"""
raise LsmError(ErrorNumber.NO_SUPPORT, "Not supported")

- def access_group_del_initiator(self, group, initiator_id, flags=0):
+ def access_group_initiator_delete(self, group, initiator_id, flags=0):
"""
Deletes an initiator from an access group, Raises LsmError on error
"""
diff --git a/test/cmdtest.py b/test/cmdtest.py
index 9a9edd1..3042a40 100755
--- a/test/cmdtest.py
+++ b/test/cmdtest.py
@@ -199,7 +199,7 @@ def access_group_create(init_id, system_id):
return r[0][ID]


-def access_group_add_init(group, initiator):
+def access_group_initiator_add(group, initiator):
call([cmd, 'access-group-add', '--ag', group, '--init', initiator,
'--init-type', 'ISCSI'])

@@ -597,7 +597,7 @@ def test_mapping(cap, system_id):
ag_id = access_group_create(iqn1, system_id)

if cap['ACCESS_GROUP_ADD_INITIATOR']:
- access_group_add_init(ag_id, iqn2)
+ access_group_initiator_add(ag_id, iqn2)

if cap['ACCESS_GROUP_GRANT'] and cap['VOLUME_CREATE']:
vol_id = create_volume(pool_id)
--
1.8.2.1
Loading...