From aef10e72b7ee38f25d7ee501934a30f9ccfb33b8 Mon Sep 17 00:00:00 2001 From: Josh Durgin Date: Thu, 26 Jul 2012 15:27:49 -0700 Subject: [PATCH] librbd: fix id initialization in new format 48bd839b1e25b063c675416a8f6233463f1af115 should have included this. I misread it due to the use of bid instead of id when generating the object prefix. Signed-off-by: Josh Durgin --- src/librbd.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/librbd.cc b/src/librbd.cc index cb76fa2d9d7ab..4d1d68e8be483 100644 --- a/src/librbd.cc +++ b/src/librbd.cc @@ -1132,7 +1132,8 @@ int create(IoCtx& io_ctx, const char *imgname, uint64_t size, } ostringstream bid_ss; - bid_ss << std::hex << bid; + uint32_t extra = rand() % 0xFFFFFFFF; + bid_ss << std::hex << bid << std::hex << extra; string id = bid_ss.str(); r = cls_client::set_id(&io_ctx, id_obj, id); if (r < 0) { @@ -1148,8 +1149,7 @@ int create(IoCtx& io_ctx, const char *imgname, uint64_t size, } ostringstream oss; - uint32_t extra = rand() % 0xFFFFFFFF; - oss << RBD_DATA_PREFIX << std::hex << bid << std::hex << extra; + oss << RBD_DATA_PREFIX << std::hex << id; r = cls_client::create_image(&io_ctx, header_name(id), size, *order, features, oss.str()); } -- 2.39.5