Signed-off-by: Tony Asleson <tasle...@redhat.com>
---
 c_binding/lsm_mgmt.cpp | 30 +++++++++++++-----------------
 1 file changed, 13 insertions(+), 17 deletions(-)

diff --git a/c_binding/lsm_mgmt.cpp b/c_binding/lsm_mgmt.cpp
index 08dddd0..43c65db 100644
--- a/c_binding/lsm_mgmt.cpp
+++ b/c_binding/lsm_mgmt.cpp
@@ -1133,6 +1133,15 @@ int lsm_volume_replicate_range(lsm_connect *c,
     return jobCheck(c, rc, response, job);
 }
 
+static Value _create_volume_flag_param(lsm_volume *volume, lsm_flag flags)
+{
+    std::map<std::string, Value> p;
+    p["volume"] = volume_to_value(volume);
+    p["flags"] = Value(flags);
+
+    return Value(p);
+}
+
 int lsm_volume_delete(lsm_connect *c, lsm_volume *volume, char **job,
                     lsm_flag flags)
 {
@@ -1148,11 +1157,8 @@ int lsm_volume_delete(lsm_connect *c, lsm_volume 
*volume, char **job,
     }
 
     try {
-        std::map<std::string, Value> p;
-        p["volume"] = volume_to_value(volume);
-        p["flags"] = Value(flags);
 
-        Value parameters(p);
+        Value parameters = _create_volume_flag_param(volume, flags);
         Value response;
 
         rc = rpc(c, "volume_delete", parameters, response);
@@ -1199,11 +1205,8 @@ int lsm_volume_raid_info(lsm_connect *c, lsm_volume 
*volume,
     }
 
      try {
-        std::map<std::string, Value> p;
-        p["volume"] = volume_to_value(volume);
-        p["flags"] = Value(flags);
 
-        Value parameters(p);
+        Value parameters = _create_volume_flag_param(volume, flags);
         Value response;
 
         rc = rpc(c, "volume_raid_info", parameters, response);
@@ -1585,11 +1588,8 @@ int lsm_volume_child_dependency(lsm_connect *c, 
lsm_volume *volume,
     }
 
     try {
-        std::map<std::string, Value> p;
-        p["volume"] = volume_to_value(volume);
-        p["flags"] = Value(flags);
 
-        Value parameters(p);
+        Value parameters = _create_volume_flag_param(volume, flags);
         Value response;
 
         rc = rpc(c, "volume_child_dependency", parameters, response);
@@ -1610,11 +1610,7 @@ int lsm_volume_child_dependency_delete(lsm_connect *c, 
lsm_volume *volume,
         return LSM_ERR_INVALID_ARGUMENT;
     }
 
-    std::map<std::string, Value> p;
-    p["volume"] = volume_to_value(volume);
-    p["flags"] = Value(flags);
-
-    Value parameters(p);
+    Value parameters = _create_volume_flag_param(volume, flags);
     Value response;
 
     int rc = rpc(c, "volume_child_dependency_rm", parameters, response);
-- 
1.8.2.1


------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Libstoragemgmt-devel mailing list
Libstoragemgmt-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libstoragemgmt-devel

Reply via email to