]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
cls/lock: always store v1 addr in locker_info_t
authorSage Weil <sage@redhat.com>
Mon, 14 Jan 2019 20:50:54 +0000 (14:50 -0600)
committerSage Weil <sage@redhat.com>
Mon, 14 Jan 2019 20:50:58 +0000 (14:50 -0600)
Signed-off-by: Sage Weil <sage@redhat.com>
src/cls/lock/cls_lock.cc
src/cls/lock/cls_lock_ops.cc
src/cls/lock/cls_lock_types.cc

index 88ea6a71b0c93f78308f5fc3961a026b28b3816f..3d5b243e29244ccc24fe30e25efbe417633f6780 100644 (file)
@@ -216,6 +216,13 @@ static int lock_obj(cls_method_context_t hctx,
     expiration += duration;
 
   }
+  // make all addrs of type legacy, because v2 clients speak v2 or v1,
+  // even depending on which OSD they are talking to, and the type
+  // isn't what uniquely identifies them.  also, storing a v1 addr
+  // here means that old clients who get this locker_info won't see an
+  // old "msgr2:" prefix.
+  inst.addr.set_type(entity_addr_t::TYPE_LEGACY);
+
   struct locker_info_t info(expiration, inst.addr, description);
 
   linfo.lockers[id] = info;
index 28c08f344763fb999dbb0081f67690bdf13c8f65..aa5f8245d2fad9f6ca6b9a5d236ae4d2dbe99666 100644 (file)
@@ -121,7 +121,7 @@ void cls_lock_get_info_reply::dump(Formatter *f) const
     f->dump_string("description", info.description);
     f->dump_string("cookie", id.cookie);
     f->dump_stream("expiration") << info.expiration;
-    f->dump_stream("addr") << info.addr;
+    f->dump_string("addr", info.addr.get_legacy_str());
     f->close_section();
   }
   f->close_section();
index d7691e08b75224a864fc7e63d2fdab476303ed0f..d1aa63342126009efb6672c09a0173b215e9fe1a 100644 (file)
@@ -41,7 +41,7 @@ void locker_id_t::generate_test_instances(list<locker_id_t*>& o)
 void locker_info_t::dump(Formatter *f) const
 {
   f->dump_stream("expiration") << expiration;
-  f->dump_stream("addr") << addr;
+  f->dump_string("addr", addr.get_legacy_str());
   f->dump_string("description", description);
 }