From a23f5535a3cee500572d8fb796a2ed0eb8be8883 Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Thu, 8 Jul 2021 01:08:27 +0300 Subject: [PATCH] Change etcd_host to etcd_address in QEMU driver, add etcd_host and etcd aliases for convenience --- qemu-3.1-vitastor.patch | 4 ++-- qemu-4.2-vitastor.patch | 4 ++-- qemu-5.0-vitastor.patch | 4 ++-- qemu-5.1-vitastor.patch | 4 ++-- src/qemu_driver.c | 14 +++++++++++--- 5 files changed, 19 insertions(+), 11 deletions(-) diff --git a/qemu-3.1-vitastor.patch b/qemu-3.1-vitastor.patch index 35880d21a..fad466863 100644 --- a/qemu-3.1-vitastor.patch +++ b/qemu-3.1-vitastor.patch @@ -24,7 +24,7 @@ Index: qemu-3.1+dfsg/qapi/block-core.json +# @pool: Pool ID +# @size: Desired image size in bytes +# @config_path: Path to Vitastor configuration -+# @etcd_host: etcd connection address(es) ++# @etcd_address: etcd connection address(es) +# @etcd_prefix: etcd key/value prefix +## +{ 'struct': 'BlockdevOptionsVitastor', @@ -33,7 +33,7 @@ Index: qemu-3.1+dfsg/qapi/block-core.json + '*size': 'uint64', + '*image': 'str', + '*config_path': 'str', -+ '*etcd_host': 'str', ++ '*etcd_address': 'str', + '*etcd_prefix': 'str' } } + +## diff --git a/qemu-4.2-vitastor.patch b/qemu-4.2-vitastor.patch index 4617f106e..9907a5674 100644 --- a/qemu-4.2-vitastor.patch +++ b/qemu-4.2-vitastor.patch @@ -24,7 +24,7 @@ Index: qemu/qapi/block-core.json +# @pool: Pool ID +# @size: Desired image size in bytes +# @config_path: Path to Vitastor configuration -+# @etcd_host: etcd connection address(es) ++# @etcd_address: etcd connection address(es) +# @etcd_prefix: etcd key/value prefix +## +{ 'struct': 'BlockdevOptionsVitastor', @@ -33,7 +33,7 @@ Index: qemu/qapi/block-core.json + '*size': 'uint64', + '*image': 'str', + '*config_path': 'str', -+ '*etcd_host': 'str', ++ '*etcd_address': 'str', + '*etcd_prefix': 'str' } } + +## diff --git a/qemu-5.0-vitastor.patch b/qemu-5.0-vitastor.patch index 30b84a595..4c10adaf8 100644 --- a/qemu-5.0-vitastor.patch +++ b/qemu-5.0-vitastor.patch @@ -24,7 +24,7 @@ Index: qemu/qapi/block-core.json +# @pool: Pool ID +# @size: Desired image size in bytes +# @config_path: Path to Vitastor configuration -+# @etcd_host: etcd connection address(es) ++# @etcd_address: etcd connection address(es) +# @etcd_prefix: etcd key/value prefix +## +{ 'struct': 'BlockdevOptionsVitastor', @@ -33,7 +33,7 @@ Index: qemu/qapi/block-core.json + '*size': 'uint64', + '*image': 'str', + '*config_path': 'str', -+ '*etcd_host': 'str', ++ '*etcd_address': 'str', + '*etcd_prefix': 'str' } } + +## diff --git a/qemu-5.1-vitastor.patch b/qemu-5.1-vitastor.patch index 6c52fd995..d307e2d9d 100644 --- a/qemu-5.1-vitastor.patch +++ b/qemu-5.1-vitastor.patch @@ -24,7 +24,7 @@ Index: qemu-5.1+dfsg/qapi/block-core.json +# @pool: Pool ID +# @size: Desired image size in bytes +# @config_path: Path to Vitastor configuration -+# @etcd_host: etcd connection address(es) ++# @etcd_address: etcd connection address(es) +# @etcd_prefix: etcd key/value prefix +## +{ 'struct': 'BlockdevOptionsVitastor', @@ -33,7 +33,7 @@ Index: qemu-5.1+dfsg/qapi/block-core.json + '*size': 'uint64', + '*image': 'str', + '*config_path': 'str', -+ '*etcd_host': 'str', ++ '*etcd_address': 'str', + '*etcd_prefix': 'str' } } + +## diff --git a/src/qemu_driver.c b/src/qemu_driver.c index 4ee4af270..496603646 100644 --- a/src/qemu_driver.c +++ b/src/qemu_driver.c @@ -102,7 +102,7 @@ static void qemu_vitastor_unescape(char *src) } // vitastor[:key=value]* -// vitastor[:etcd_host=127.0.0.1]:inode=1:pool=1[:rdma_gid_index=3] +// vitastor[:(etcd|etcd_host|etcd_address)=127.0.0.1]:inode=1:pool=1[:rdma_gid_index=3] // vitastor:config_path=/etc/vitastor/vitastor.conf:image=testimg static void vitastor_parse_filename(const char *filename, QDict *options, Error **errp) { @@ -199,8 +199,12 @@ static int vitastor_file_open(BlockDriverState *bs, QDict *options, int flags, E int64_t ret = 0; qemu_mutex_init(&client->mutex); client->config_path = g_strdup(qdict_get_try_str(options, "config_path")); - // FIXME: Rename to etcd_address - client->etcd_host = g_strdup(qdict_get_try_str(options, "etcd_host")); + if (qdict_get_try_str(options, "etcd_address")) + client->etcd_host = g_strdup(qdict_get_try_str(options, "etcd_address")); + else if (qdict_get_try_str(options, "etcd_host")) + client->etcd_host = g_strdup(qdict_get_try_str(options, "etcd_host")); + else if (qdict_get_try_str(options, "etcd")) + client->etcd_host = g_strdup(qdict_get_try_str(options, "etcd")); client->etcd_prefix = g_strdup(qdict_get_try_str(options, "etcd_prefix")); client->use_rdma = qdict_get_try_int(options, "use_rdma", -1); client->rdma_device = g_strdup(qdict_get_try_str(options, "rdma_device")); @@ -267,6 +271,8 @@ static int vitastor_file_open(BlockDriverState *bs, QDict *options, int flags, E qdict_del(options, "rdma_device"); qdict_del(options, "config_path"); qdict_del(options, "etcd_host"); + qdict_del(options, "etcd_address"); + qdict_del(options, "etcd"); qdict_del(options, "etcd_prefix"); qdict_del(options, "image"); qdict_del(options, "inode"); @@ -512,6 +518,8 @@ static const char *vitastor_strong_runtime_opts[] = { "inode", "pool", "config_path", + "etcd", + "etcd_address", "etcd_host", "etcd_prefix",