diff --git a/src/messenger.cpp b/src/messenger.cpp index 96da14a5..572bcf98 100644 --- a/src/messenger.cpp +++ b/src/messenger.cpp @@ -349,6 +349,15 @@ void osd_messenger_t::check_peer_config(osd_client_t *cl) err = true; printf("Connected to OSD %lu instead of OSD %lu, peer state is outdated, disconnecting peer\n", config["osd_num"].uint64_value(), cl->osd_num); } + else if (config["protocol_version"].uint64_value() != OSD_PROTOCOL_VERSION) + { + err = true; + printf( + "OSD %lu protocol version is %lu, but only version %u is supported.\n" + " If you need to upgrade from 0.5.x please request it via the issue tracker.\n", + cl->osd_num, config["protocol_version"].uint64_value(), OSD_PROTOCOL_VERSION + ); + } } if (err) { diff --git a/src/osd_ops.h b/src/osd_ops.h index ee80d742..76b3ad3a 100644 --- a/src/osd_ops.h +++ b/src/osd_ops.h @@ -35,6 +35,7 @@ #define MEM_ALIGNMENT 512 #endif #define OSD_RW_MAX 64*1024*1024 +#define OSD_PROTOCOL_VERSION 1 // common request and reply headers struct __attribute__((__packed__)) osd_op_header_t diff --git a/src/osd_secondary.cpp b/src/osd_secondary.cpp index 5f4fb46f..bb11269a 100644 --- a/src/osd_secondary.cpp +++ b/src/osd_secondary.cpp @@ -145,7 +145,9 @@ void osd_t::exec_secondary(osd_op_t *cur_op) void osd_t::exec_show_config(osd_op_t *cur_op) { // FIXME: Send the real config, not its source - std::string cfg_str = json11::Json(config).dump(); + auto cfg_copy = config; + cfg_copy["protocol_version"] = std::to_string(OSD_PROTOCOL_VERSION); + std::string cfg_str = json11::Json(cfg_copy).dump(); cur_op->buf = malloc_or_die(cfg_str.size()+1); memcpy(cur_op->buf, cfg_str.c_str(), cfg_str.size()+1); cur_op->iov.push_back(cur_op->buf, cfg_str.size()+1);