]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: lock related modifications
authorBabu Shanmugam <anbu@enovance.com>
Tue, 18 Jun 2013 10:36:36 +0000 (16:06 +0530)
committerYehuda Sadeh <yehuda@inktank.com>
Thu, 20 Jun 2013 20:38:47 +0000 (13:38 -0700)
1. zone-id inclusion in lock/unlock for mdlog and datalog
2. renewal of lock if the locker request lock again
3. modified lock_id param to locker-id

Signed-off-by: Babu Shanmugam <anbu@enovance.com>
Conflicts:
src/rgw/rgw_rest_log.cc

src/rgw/rgw_bucket.h
src/rgw/rgw_metadata.cc
src/rgw/rgw_metadata.h
src/rgw/rgw_rados.cc
src/rgw/rgw_rados.h
src/rgw/rgw_rest_log.cc
src/test/test_rgw_admin_log.cc

index 4431c77f97e0073ef2890a183f88e27ec5667977..f4ff4ec15cc5b611acefde6bac0f14ada7dbab32 100644 (file)
@@ -344,11 +344,11 @@ public:
                list<rgw_data_change>& entries, string& marker, bool *truncated);
   int trim_entries(int shard_id, utime_t& start_time, utime_t& end_time);
   int trim_entries(utime_t& start_time, utime_t& end_time);
-  int lock_exclusive(int shard_id, utime_t& duration, string& owner_id) {
-    return store->lock_exclusive(store->zone.log_pool, oids[shard_id], duration, owner_id);
+  int lock_exclusive(int shard_id, utime_t& duration, string& zone_id, string& owner_id) {
+    return store->lock_exclusive(store->zone.log_pool, oids[shard_id], duration, zone_id, owner_id);
   }
-  int unlock(int shard_id, string& owner_id) {
-    return store->unlock(store->zone.log_pool, oids[shard_id], owner_id);
+  int unlock(int shard_id, string& zone_id, string& owner_id) {
+    return store->unlock(store->zone.log_pool, oids[shard_id], zone_id, owner_id);
   }
   struct LogMarker {
     int shard;
index 6e0d4b3b6322026193f8b3f370208170836607be..6242806ef4d486b68f10d7682ce0035d21d8eb70 100644 (file)
@@ -136,18 +136,18 @@ int RGWMetadataLog::trim(int shard_id, utime_t& from_time, utime_t& end_time)
   return ret;
 }
   
-int RGWMetadataLog::lock_exclusive(int shard_id, utime_t& duration, string& owner_id) {
+int RGWMetadataLog::lock_exclusive(int shard_id, utime_t& duration, string& zone_id, string& owner_id) {
   string oid;
   get_shard_oid(shard_id, oid);
 
-  return store->lock_exclusive(store->zone.log_pool, oid, duration, owner_id);
+  return store->lock_exclusive(store->zone.log_pool, oid, duration, zone_id, owner_id);
 }
 
-int RGWMetadataLog::unlock(int shard_id, string& owner_id) {
+int RGWMetadataLog::unlock(int shard_id, string& zone_id, string& owner_id) {
   string oid;
   get_shard_oid(shard_id, oid);
 
-  return store->unlock(store->zone.log_pool, oid, owner_id);
+  return store->unlock(store->zone.log_pool, oid, zone_id, owner_id);
 }
 
 obj_version& RGWMetadataObject::get_version()
@@ -359,6 +359,7 @@ int RGWMetadataManager::remove(string& metadata_key)
 int RGWMetadataManager::lock_exclusive(string& metadata_key, utime_t duration, string& owner_id) {
   RGWMetadataHandler *handler;
   string entry;
+  string zone_id;
 
   int ret = find_handler(metadata_key, &handler, entry);
   if (ret < 0) 
@@ -369,13 +370,14 @@ int RGWMetadataManager::lock_exclusive(string& metadata_key, utime_t duration, s
 
   handler->get_pool_and_oid(store, entry, pool, oid);
 
-  return store->lock_exclusive(pool, oid, duration, owner_id);  
+  return store->lock_exclusive(pool, oid, duration, zone_id, owner_id);  
 }
 
 int RGWMetadataManager::unlock(string& metadata_key, string& owner_id) {
   librados::IoCtx io_ctx;
   RGWMetadataHandler *handler;
   string entry;
+  string zone_id;
 
   int ret = find_handler(metadata_key, &handler, entry);
   if (ret < 0) 
@@ -386,7 +388,7 @@ int RGWMetadataManager::unlock(string& metadata_key, string& owner_id) {
 
   handler->get_pool_and_oid(store, entry, pool, oid);
 
-  return store->unlock(pool, oid, owner_id);  
+  return store->unlock(pool, oid, zone_id, owner_id);  
 }
 
 struct list_keys_handle {
index 5f0fafefc5f427786936fcd743f06c3a79b8d048..ba12decdd41fad434da6100fe3eade2879a1ee72 100644 (file)
@@ -98,8 +98,8 @@ public:
                    list<cls_log_entry>& entries, bool *truncated);
 
   int trim(int shard_id, utime_t& from_time, utime_t& end_time);
-  int lock_exclusive(int shard_id, utime_t& duration, string& owner_id);
-  int unlock(int shard_id, string& owner_id);
+  int lock_exclusive(int shard_id, utime_t& duration, string&zone_id, string& owner_id);
+  int unlock(int shard_id, string& zone_id, string& owner_id);
 };
 
 class RGWMetadataLogData;
index 9a485600b6d8ec3a9c0f556ddda86e66e1499a96..055e7ad02839ae3a6a216798b086884fc8405270 100644 (file)
@@ -1481,7 +1481,8 @@ int RGWRados::time_log_trim(const string& oid, utime_t& start_time, utime_t& end
 }
 
 
-int RGWRados::lock_exclusive(rgw_bucket& pool, const string& oid, utime_t& duration, string& owner_id) {
+int RGWRados::lock_exclusive(rgw_bucket& pool, const string& oid, utime_t& duration, 
+                             string& zone_id, string& owner_id) {
   librados::IoCtx io_ctx;
 
   const char *pool_name = pool.name.c_str();
@@ -1493,11 +1494,13 @@ int RGWRados::lock_exclusive(rgw_bucket& pool, const string& oid, utime_t& durat
   rados::cls::lock::Lock l(log_lock_name);
   l.set_duration(duration);
   l.set_cookie(owner_id);
+  l.set_tag(zone_id);
+  l.set_renew(true);
   
   return l.lock_exclusive(&io_ctx, oid);
 }
 
-int RGWRados::unlock(rgw_bucket& pool, const string& oid, string& owner_id) {
+int RGWRados::unlock(rgw_bucket& pool, const string& oid, string& zone_id, string& owner_id) {
   librados::IoCtx io_ctx;
 
   const char *pool_name = pool.name.c_str();
@@ -1507,6 +1510,7 @@ int RGWRados::unlock(rgw_bucket& pool, const string& oid, string& owner_id) {
     return r;
   
   rados::cls::lock::Lock l(log_lock_name);
+  l.set_tag(zone_id);
   l.set_cookie(owner_id);
   
   return l.unlock(&io_ctx, oid);
index 7e08d8016c0fc48fcc5f43fe74826aadc6becad6..9c43f001452c162d882b983d00b6d858d21bb9ea 100644 (file)
@@ -1213,8 +1213,8 @@ public:
   int time_log_list(const string& oid, utime_t& start_time, utime_t& end_time,
                     int max_entries, list<cls_log_entry>& entries, string& marker, bool *truncated);
   int time_log_trim(const string& oid, utime_t& start_time, utime_t& end_time);
-  int lock_exclusive(rgw_bucket& pool, const string& oid, utime_t& duration, string& owner_id);
-  int unlock(rgw_bucket& pool, const string& oid, string& owner_id);
+  int lock_exclusive(rgw_bucket& pool, const string& oid, utime_t& duration, string& zone_id, string& owner_id);
+  int unlock(rgw_bucket& pool, const string& oid, string& zone_id, string& owner_id);
 
   /// clean up/process any temporary objects older than given date[/time]
   int remove_temp_objects(string date, string time);
index f066b6b4b0491effd152b45ca13bebae64aa99ab..43bb84fc763d6c81e10aa7dea9014ac1d879f8c1 100644 (file)
@@ -46,7 +46,7 @@ void RGWOp_MDLog_List::execute() {
   utime_t  ut_st, 
            ut_et;
   void    *handle;
-  unsigned shard_id, max_entries = 0;
+  unsigned shard_id, max_entries = LOG_CLASS_LIST_MAX_ENTRIES;
 
   shard_id = (unsigned)strict_strtol(shard.c_str(), 10, &err);
   if (!err.empty()) {
@@ -72,9 +72,8 @@ void RGWOp_MDLog_List::execute() {
       http_ret = -EINVAL;
       return;
     }
-  } else 
-    max_entries = LOG_CLASS_LIST_MAX_ENTRIES;
-
+  } 
+  
   RGWMetadataLog *meta_log = store->meta_mgr->get_log();
 
   meta_log->init_list_entries(shard_id, ut_st, ut_et, marker, &handle);
@@ -162,18 +161,20 @@ void RGWOp_MDLog_Delete::execute() {
 }
 
 void RGWOp_MDLog_Lock::execute() {
-  string shard_id_str, duration_str, lock_id;
+  string shard_id_str, duration_str, locker_id, zone_id;
   unsigned shard_id;
 
   http_ret = 0;
 
   shard_id_str = s->info.args.get("id");
   duration_str = s->info.args.get("length");
-  lock_id      = s->info.args.get("lock_id");
+  locker_id    = s->info.args.get("locker-id");
+  zone_id      = s->info.args.get("zone-id");
 
   if (shard_id_str.empty() ||
       (duration_str.empty()) ||
-      lock_id.empty()) {
+      locker_id.empty() ||
+      zone_id.empty()) {
     dout(5) << "Error invalid parameter list" << dendl;
     http_ret = -EINVAL;
     return;
@@ -196,20 +197,22 @@ void RGWOp_MDLog_Lock::execute() {
     return;
   }
   utime_t time(dur, 0);
-  http_ret = meta_log->lock_exclusive(shard_id, time, lock_id);
+  http_ret = meta_log->lock_exclusive(shard_id, time, zone_id, locker_id);
 }
 
 void RGWOp_MDLog_Unlock::execute() {
-  string shard_id_str, lock_id;
+  string shard_id_str, locker_id, zone_id;
   unsigned shard_id;
 
   http_ret = 0;
 
   shard_id_str = s->info.args.get("id");
-  lock_id      = s->info.args.get("lock_id");
+  locker_id    = s->info.args.get("locker-id");
+  zone_id      = s->info.args.get("zone-id");
 
   if (shard_id_str.empty() ||
-      lock_id.empty()) {
+      locker_id.empty() ||
+      zone_id.empty()) {
     dout(5) << "Error invalid parameter list" << dendl;
     http_ret = -EINVAL;
     return;
@@ -224,7 +227,7 @@ void RGWOp_MDLog_Unlock::execute() {
   }
 
   RGWMetadataLog *meta_log = store->meta_mgr->get_log();
-  http_ret = meta_log->unlock(shard_id, lock_id);
+  http_ret = meta_log->unlock(shard_id, zone_id, locker_id);
 }
 
 void RGWOp_BILog_List::execute() {
@@ -341,7 +344,7 @@ void RGWOp_DATALog_List::execute() {
            err;
   utime_t  ut_st, 
            ut_et;
-  unsigned shard_id, max_entries = 0;
+  unsigned shard_id, max_entries = LOG_CLASS_LIST_MAX_ENTRIES;
 
   shard_id = (unsigned)strict_strtol(shard.c_str(), 10, &err);
   if (!err.empty()) {
@@ -367,9 +370,8 @@ void RGWOp_DATALog_List::execute() {
       http_ret = -EINVAL;
       return;
     }
-  } else 
-    max_entries = LOG_CLASS_LIST_MAX_ENTRIES;
-
+  } 
+  
   bool truncated;
   do {
     http_ret = store->data_log->list_entries(shard_id, ut_st, ut_et, 
@@ -419,18 +421,20 @@ void RGWOp_DATALog_GetShardsInfo::send_response() {
 }
 
 void RGWOp_DATALog_Lock::execute() {
-  string shard_id_str, duration_str, lock_id;
+  string shard_id_str, duration_str, locker_id, zone_id;
   unsigned shard_id;
 
   http_ret = 0;
 
   shard_id_str = s->info.args.get("id");
   duration_str = s->info.args.get("length");
-  lock_id      = s->info.args.get("lock_id");
+  locker_id    = s->info.args.get("locker-id");
+  zone_id      = s->info.args.get("zone-id");
 
   if (shard_id_str.empty() ||
       (duration_str.empty()) ||
-      lock_id.empty()) {
+      locker_id.empty() ||
+      zone_id.empty()) {
     dout(5) << "Error invalid parameter list" << dendl;
     http_ret = -EINVAL;
     return;
@@ -452,20 +456,22 @@ void RGWOp_DATALog_Lock::execute() {
     return;
   }
   utime_t time(dur, 0);
-  http_ret = store->data_log->lock_exclusive(shard_id, time, lock_id);
+  http_ret = store->data_log->lock_exclusive(shard_id, time, zone_id, locker_id);
 }
 
 void RGWOp_DATALog_Unlock::execute() {
-  string shard_id_str, lock_id;
+  string shard_id_str, locker_id, zone_id;
   unsigned shard_id;
 
   http_ret = 0;
 
   shard_id_str = s->info.args.get("id");
-  lock_id      = s->info.args.get("lock_id");
+  locker_id    = s->info.args.get("locker-id");
+  zone_id      = s->info.args.get("zone-id");
 
   if (shard_id_str.empty() ||
-      lock_id.empty()) {
+      locker_id.empty() ||
+      zone_id.empty()) {
     dout(5) << "Error invalid parameter list" << dendl;
     http_ret = -EINVAL;
     return;
@@ -479,7 +485,7 @@ void RGWOp_DATALog_Unlock::execute() {
     return;
   }
 
-  http_ret = store->data_log->unlock(shard_id, lock_id);
+  http_ret = store->data_log->unlock(shard_id, zone_id, locker_id);
 }
 
 void RGWOp_DATALog_Delete::execute() {
index 3ce853ab67e19703a29fb1c760e65b2f00f843b7..7c419e7d3c456b197e4e9d3eea308bf394b4064d 100644 (file)
@@ -847,92 +847,104 @@ TEST(TestRGWAdmin, datalog_lock_unlock) {
   ASSERT_EQ(0, user_create(uid, display_name));
   ASSERT_EQ(0, caps_add(cname, perm));
 
-  rest_req = "/admin/log?type=data&lock&length=3&lock_id=ceph";
+  rest_req = "/admin/log?type=data&lock&length=3&locker-id=ceph&zone-id=1";
   g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
   EXPECT_EQ(400U, g_test->get_resp_code()); /*Bad request*/
   
-  rest_req = "/admin/log?type=data&lock&id=3&lock_id=ceph";
+  rest_req = "/admin/log?type=data&lock&id=3&locker-id=ceph&zone-id=1";
   g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
   EXPECT_EQ(400U, g_test->get_resp_code()); /*Bad request*/
   
-  rest_req = "/admin/log?type=data&lock&length=3&id=1";
+  rest_req = "/admin/log?type=data&lock&length=3&id=1&zone-id=1";
+  g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
+  EXPECT_EQ(400U, g_test->get_resp_code()); /*Bad request*/
+  
+  rest_req = "/admin/log?type=data&lock&length=3&id=1&locker-id=1";
   g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
   EXPECT_EQ(400U, g_test->get_resp_code()); /*Bad request*/
 
-  rest_req = "/admin/log?type=data&unlock&id=1";
+  rest_req = "/admin/log?type=data&unlock&id=1&zone-id=1";
   g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
   EXPECT_EQ(400U, g_test->get_resp_code()); /*Bad request*/
 
-  rest_req = "/admin/log?type=data&unlock&lock_id=ceph";
+  rest_req = "/admin/log?type=data&unlock&locker-id=ceph&zone-id=1";
+  g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
+  EXPECT_EQ(400U, g_test->get_resp_code()); /*Bad request*/
+  
+  rest_req = "/admin/log?type=data&unlock&locker-id=ceph&id=1";
   g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
   EXPECT_EQ(400U, g_test->get_resp_code()); /*Bad request*/
   
-  rest_req = "/admin/log?type=data&lock&id=1&length=3&lock_id=ceph";
+  rest_req = "/admin/log?type=data&lock&id=1&length=3&locker-id=ceph&zone-id=1";
   g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
   EXPECT_EQ(200U, g_test->get_resp_code()); 
   
-  rest_req = "/admin/log?type=data&unlock&id=1&lock_id=ceph";
+  rest_req = "/admin/log?type=data&unlock&id=1&locker-id=ceph&zone-id=1";
   g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
   EXPECT_EQ(200U, g_test->get_resp_code()); 
   
-  rest_req = "/admin/log?type=data&lock&id=1&length=3&lock_id=ceph1";
+  rest_req = "/admin/log?type=data&lock&id=1&length=3&locker-id=ceph1&zone-id=1";
   g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
   EXPECT_EQ(200U, g_test->get_resp_code()); 
   
-  rest_req = "/admin/log?type=data&unlock&id=1&lock_id=ceph1";
+  rest_req = "/admin/log?type=data&unlock&id=1&locker-id=ceph1&zone-id=1";
   g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
   EXPECT_EQ(200U, g_test->get_resp_code()); 
   
-  rest_req = "/admin/log?type=data&lock&id=1&length=3&lock_id=ceph";
+  rest_req = "/admin/log?type=data&lock&id=1&length=3&locker-id=ceph&zone-id=1";
   g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
   EXPECT_EQ(200U, g_test->get_resp_code()); 
   utime_t sleep_time(3, 0);
 
-  rest_req = "/admin/log?type=data&lock&id=1&length=3&lock_id=ceph1";
+  rest_req = "/admin/log?type=data&lock&id=1&length=3&locker-id=ceph1&zone-id=1";
   g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
   EXPECT_EQ(500U, g_test->get_resp_code()); 
 
-  rest_req = "/admin/log?type=data&lock&id=1&length=3&lock_id=ceph";
+  rest_req = "/admin/log?type=data&lock&id=1&length=3&locker-id=ceph1&zone-id=2";
   g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
-  EXPECT_EQ(409U, g_test->get_resp_code()); 
+  EXPECT_EQ(500U, g_test->get_resp_code()); 
+
+  rest_req = "/admin/log?type=data&lock&id=1&length=3&locker-id=ceph&zone-id=1";
+  g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
+  EXPECT_EQ(200U, g_test->get_resp_code()); 
   sleep_time.sleep();
 
-  rest_req = "/admin/log?type=data&lock&id=1&length=3&lock_id=ceph1";
+  rest_req = "/admin/log?type=data&lock&id=1&length=3&locker-id=ceph1&zone-id=1";
   g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
   EXPECT_EQ(200U, g_test->get_resp_code()); 
   
-  rest_req = "/admin/log?type=data&unlock&id=1&lock_id=ceph1";
+  rest_req = "/admin/log?type=data&unlock&id=1&locker-id=ceph1&zone-id=1";
   g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
   EXPECT_EQ(200U, g_test->get_resp_code()); 
 
   ASSERT_EQ(0, caps_rm(cname, perm));
   perm = "read";
   ASSERT_EQ(0, caps_add(cname, perm));
-  rest_req = "/admin/log?type=data&lock&id=1&length=3&lock_id=ceph";
+  rest_req = "/admin/log?type=data&lock&id=1&length=3&locker-id=ceph&zone-id=1";
   g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
   EXPECT_EQ(403U, g_test->get_resp_code()); 
   
-  rest_req = "/admin/log?type=data&unlock&id=1&lock_id=ceph";
+  rest_req = "/admin/log?type=data&unlock&id=1&locker-id=ceph&zone-id=1";
   g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
   EXPECT_EQ(403U, g_test->get_resp_code()); 
   
   ASSERT_EQ(0, caps_rm(cname, perm));
   perm = "write";
   ASSERT_EQ(0, caps_add(cname, perm));
-  rest_req = "/admin/log?type=data&lock&id=1&length=3&lock_id=ceph";
+  rest_req = "/admin/log?type=data&lock&id=1&length=3&locker-id=ceph&zone-id=1";
   g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
   EXPECT_EQ(200U, g_test->get_resp_code()); 
   
-  rest_req = "/admin/log?type=data&unlock&id=1&lock_id=ceph";
+  rest_req = "/admin/log?type=data&unlock&id=1&locker-id=ceph&zone-id=1";
   g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
   EXPECT_EQ(200U, g_test->get_resp_code()); 
   
   ASSERT_EQ(0, caps_rm(cname, perm));
-  rest_req = "/admin/log?type=data&lock&id=1&length=3&lock_id=ceph";
+  rest_req = "/admin/log?type=data&lock&id=1&length=3&locker-id=ceph&zone-id=1";
   g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
   EXPECT_EQ(403U, g_test->get_resp_code()); 
   
-  rest_req = "/admin/log?type=data&unlock&id=1&lock_id=ceph";
+  rest_req = "/admin/log?type=data&unlock&id=1&locker-id=ceph&zone-id=1";
   g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
   EXPECT_EQ(403U, g_test->get_resp_code()); 
   
@@ -1276,92 +1288,104 @@ TEST(TestRGWAdmin, mdlog_lock_unlock) {
   ASSERT_EQ(0, user_create(uid, display_name));
   ASSERT_EQ(0, caps_add(cname, perm));
 
-  rest_req = "/admin/log?type=metadata&lock&length=3&lock_id=ceph";
+  rest_req = "/admin/log?type=metadata&lock&length=3&locker-id=ceph&zone-id=1";
   g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
   EXPECT_EQ(400U, g_test->get_resp_code()); /*Bad request*/
   
-  rest_req = "/admin/log?type=metadata&lock&id=3&lock_id=ceph";
+  rest_req = "/admin/log?type=metadata&lock&id=3&locker-id=ceph&zone-id=1";
   g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
   EXPECT_EQ(400U, g_test->get_resp_code()); /*Bad request*/
   
-  rest_req = "/admin/log?type=metadata&lock&length=3&id=1";
+  rest_req = "/admin/log?type=metadata&lock&length=3&id=1&zone-id=1";
   g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
   EXPECT_EQ(400U, g_test->get_resp_code()); /*Bad request*/
 
-  rest_req = "/admin/log?type=metadata&unlock&id=1";
+  rest_req = "/admin/log?type=metadata&lock&id=3&locker-id=ceph&length=1";
+  g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
+  EXPECT_EQ(400U, g_test->get_resp_code()); /*Bad request*/
+  
+  rest_req = "/admin/log?type=metadata&unlock&id=1&zone-id=1";
   g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
   EXPECT_EQ(400U, g_test->get_resp_code()); /*Bad request*/
 
-  rest_req = "/admin/log?type=metadata&unlock&lock_id=ceph";
+  rest_req = "/admin/log?type=metadata&unlock&locker-id=ceph&zone-id=1";
+  g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
+  EXPECT_EQ(400U, g_test->get_resp_code()); /*Bad request*/
+  
+  rest_req = "/admin/log?type=metadata&unlock&locker-id=ceph&id=1";
   g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
   EXPECT_EQ(400U, g_test->get_resp_code()); /*Bad request*/
   
-  rest_req = "/admin/log?type=metadata&lock&id=1&length=3&lock_id=ceph";
+  rest_req = "/admin/log?type=metadata&lock&id=1&length=3&locker-id=ceph&zone-id=1";
   g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
   EXPECT_EQ(200U, g_test->get_resp_code()); 
   
-  rest_req = "/admin/log?type=metadata&unlock&id=1&lock_id=ceph";
+  rest_req = "/admin/log?type=metadata&unlock&id=1&locker-id=ceph&zone-id=1";
   g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
   EXPECT_EQ(200U, g_test->get_resp_code()); 
   
-  rest_req = "/admin/log?type=metadata&lock&id=1&length=3&lock_id=ceph1";
+  rest_req = "/admin/log?type=metadata&lock&id=1&length=3&locker-id=ceph1&zone-id=1";
   g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
   EXPECT_EQ(200U, g_test->get_resp_code()); 
   
-  rest_req = "/admin/log?type=metadata&unlock&id=1&lock_id=ceph1";
+  rest_req = "/admin/log?type=metadata&unlock&id=1&locker-id=ceph1&zone-id=1";
   g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
   EXPECT_EQ(200U, g_test->get_resp_code()); 
   
-  rest_req = "/admin/log?type=metadata&lock&id=1&length=3&lock_id=ceph";
+  rest_req = "/admin/log?type=metadata&lock&id=1&length=3&locker-id=ceph&zone-id=1";
   g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
   EXPECT_EQ(200U, g_test->get_resp_code()); 
   utime_t sleep_time(3, 0);
 
-  rest_req = "/admin/log?type=metadata&lock&id=1&length=3&lock_id=ceph1";
+  rest_req = "/admin/log?type=metadata&lock&id=1&length=3&locker-id=ceph1&zone-id=1";
   g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
   EXPECT_EQ(500U, g_test->get_resp_code()); 
 
-  rest_req = "/admin/log?type=metadata&lock&id=1&length=3&lock_id=ceph";
+  rest_req = "/admin/log?type=metadata&lock&id=1&length=3&locker-id=ceph&zone-id=2";
   g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
-  EXPECT_EQ(409U, g_test->get_resp_code()); 
+  EXPECT_EQ(500U, g_test->get_resp_code()); 
+
+  rest_req = "/admin/log?type=metadata&lock&id=1&length=3&locker-id=ceph&zone-id=1";
+  g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
+  EXPECT_EQ(200U, g_test->get_resp_code()); 
   sleep_time.sleep();
 
-  rest_req = "/admin/log?type=metadata&lock&id=1&length=3&lock_id=ceph1";
+  rest_req = "/admin/log?type=metadata&lock&id=1&length=3&locker-id=ceph1&zone-id=1";
   g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
   EXPECT_EQ(200U, g_test->get_resp_code()); 
   
-  rest_req = "/admin/log?type=metadata&unlock&id=1&lock_id=ceph1";
+  rest_req = "/admin/log?type=metadata&unlock&id=1&locker-id=ceph1&zone-id=1";
   g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
   EXPECT_EQ(200U, g_test->get_resp_code()); 
 
   ASSERT_EQ(0, caps_rm(cname, perm));
   perm = "read";
   ASSERT_EQ(0, caps_add(cname, perm));
-  rest_req = "/admin/log?type=metadata&lock&id=1&length=3&lock_id=ceph";
+  rest_req = "/admin/log?type=metadata&lock&id=1&length=3&locker-id=ceph&zone-id=1";
   g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
   EXPECT_EQ(403U, g_test->get_resp_code()); 
   
-  rest_req = "/admin/log?type=metadata&unlock&id=1&lock_id=ceph";
+  rest_req = "/admin/log?type=metadata&unlock&id=1&locker-id=ceph&zone-id=1";
   g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
   EXPECT_EQ(403U, g_test->get_resp_code()); 
   
   ASSERT_EQ(0, caps_rm(cname, perm));
   perm = "write";
   ASSERT_EQ(0, caps_add(cname, perm));
-  rest_req = "/admin/log?type=metadata&lock&id=1&length=3&lock_id=ceph";
+  rest_req = "/admin/log?type=metadata&lock&id=1&length=3&locker-id=ceph&zone-id=1";
   g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
   EXPECT_EQ(200U, g_test->get_resp_code()); 
   
-  rest_req = "/admin/log?type=metadata&unlock&id=1&lock_id=ceph";
+  rest_req = "/admin/log?type=metadata&unlock&id=1&locker-id=ceph&zone-id=1";
   g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
   EXPECT_EQ(200U, g_test->get_resp_code()); 
   
   ASSERT_EQ(0, caps_rm(cname, perm));
-  rest_req = "/admin/log?type=metadata&lock&id=1&length=3&lock_id=ceph";
+  rest_req = "/admin/log?type=metadata&lock&id=1&length=3&locker-id=ceph&zone-id=1";
   g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
   EXPECT_EQ(403U, g_test->get_resp_code()); 
   
-  rest_req = "/admin/log?type=metadata&unlock&id=1&lock_id=ceph";
+  rest_req = "/admin/log?type=metadata&unlock&id=1&locker-id=ceph&zone-id=1";
   g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
   EXPECT_EQ(403U, g_test->get_resp_code());