Compare commits

...

1 Commits

5 changed files with 19 additions and 11 deletions

View File

@ -24,7 +24,7 @@ Index: qemu-3.1+dfsg/qapi/block-core.json
+# @pool: Pool ID +# @pool: Pool ID
+# @size: Desired image size in bytes +# @size: Desired image size in bytes
+# @config_path: Path to Vitastor configuration +# @config_path: Path to Vitastor configuration
+# @etcd_host: etcd connection address(es) +# @etcd_address: etcd connection address(es)
+# @etcd_prefix: etcd key/value prefix +# @etcd_prefix: etcd key/value prefix
+## +##
+{ 'struct': 'BlockdevOptionsVitastor', +{ 'struct': 'BlockdevOptionsVitastor',
@ -33,7 +33,7 @@ Index: qemu-3.1+dfsg/qapi/block-core.json
+ '*size': 'uint64', + '*size': 'uint64',
+ '*image': 'str', + '*image': 'str',
+ '*config_path': 'str', + '*config_path': 'str',
+ '*etcd_host': 'str', + '*etcd_address': 'str',
+ '*etcd_prefix': 'str' } } + '*etcd_prefix': 'str' } }
+ +
+## +##

View File

@ -24,7 +24,7 @@ Index: qemu/qapi/block-core.json
+# @pool: Pool ID +# @pool: Pool ID
+# @size: Desired image size in bytes +# @size: Desired image size in bytes
+# @config_path: Path to Vitastor configuration +# @config_path: Path to Vitastor configuration
+# @etcd_host: etcd connection address(es) +# @etcd_address: etcd connection address(es)
+# @etcd_prefix: etcd key/value prefix +# @etcd_prefix: etcd key/value prefix
+## +##
+{ 'struct': 'BlockdevOptionsVitastor', +{ 'struct': 'BlockdevOptionsVitastor',
@ -33,7 +33,7 @@ Index: qemu/qapi/block-core.json
+ '*size': 'uint64', + '*size': 'uint64',
+ '*image': 'str', + '*image': 'str',
+ '*config_path': 'str', + '*config_path': 'str',
+ '*etcd_host': 'str', + '*etcd_address': 'str',
+ '*etcd_prefix': 'str' } } + '*etcd_prefix': 'str' } }
+ +
+## +##

View File

@ -24,7 +24,7 @@ Index: qemu/qapi/block-core.json
+# @pool: Pool ID +# @pool: Pool ID
+# @size: Desired image size in bytes +# @size: Desired image size in bytes
+# @config_path: Path to Vitastor configuration +# @config_path: Path to Vitastor configuration
+# @etcd_host: etcd connection address(es) +# @etcd_address: etcd connection address(es)
+# @etcd_prefix: etcd key/value prefix +# @etcd_prefix: etcd key/value prefix
+## +##
+{ 'struct': 'BlockdevOptionsVitastor', +{ 'struct': 'BlockdevOptionsVitastor',
@ -33,7 +33,7 @@ Index: qemu/qapi/block-core.json
+ '*size': 'uint64', + '*size': 'uint64',
+ '*image': 'str', + '*image': 'str',
+ '*config_path': 'str', + '*config_path': 'str',
+ '*etcd_host': 'str', + '*etcd_address': 'str',
+ '*etcd_prefix': 'str' } } + '*etcd_prefix': 'str' } }
+ +
+## +##

View File

@ -24,7 +24,7 @@ Index: qemu-5.1+dfsg/qapi/block-core.json
+# @pool: Pool ID +# @pool: Pool ID
+# @size: Desired image size in bytes +# @size: Desired image size in bytes
+# @config_path: Path to Vitastor configuration +# @config_path: Path to Vitastor configuration
+# @etcd_host: etcd connection address(es) +# @etcd_address: etcd connection address(es)
+# @etcd_prefix: etcd key/value prefix +# @etcd_prefix: etcd key/value prefix
+## +##
+{ 'struct': 'BlockdevOptionsVitastor', +{ 'struct': 'BlockdevOptionsVitastor',
@ -33,7 +33,7 @@ Index: qemu-5.1+dfsg/qapi/block-core.json
+ '*size': 'uint64', + '*size': 'uint64',
+ '*image': 'str', + '*image': 'str',
+ '*config_path': 'str', + '*config_path': 'str',
+ '*etcd_host': 'str', + '*etcd_address': 'str',
+ '*etcd_prefix': 'str' } } + '*etcd_prefix': 'str' } }
+ +
+## +##

View File

@ -102,7 +102,7 @@ static void qemu_vitastor_unescape(char *src)
} }
// vitastor[:key=value]* // 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 // vitastor:config_path=/etc/vitastor/vitastor.conf:image=testimg
static void vitastor_parse_filename(const char *filename, QDict *options, Error **errp) 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; int64_t ret = 0;
qemu_mutex_init(&client->mutex); qemu_mutex_init(&client->mutex);
client->config_path = g_strdup(qdict_get_try_str(options, "config_path")); client->config_path = g_strdup(qdict_get_try_str(options, "config_path"));
// FIXME: Rename to etcd_address if (qdict_get_try_str(options, "etcd_address"))
client->etcd_host = g_strdup(qdict_get_try_str(options, "etcd_host")); 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->etcd_prefix = g_strdup(qdict_get_try_str(options, "etcd_prefix"));
client->use_rdma = qdict_get_try_int(options, "use_rdma", -1); client->use_rdma = qdict_get_try_int(options, "use_rdma", -1);
client->rdma_device = g_strdup(qdict_get_try_str(options, "rdma_device")); 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, "rdma_device");
qdict_del(options, "config_path"); qdict_del(options, "config_path");
qdict_del(options, "etcd_host"); qdict_del(options, "etcd_host");
qdict_del(options, "etcd_address");
qdict_del(options, "etcd");
qdict_del(options, "etcd_prefix"); qdict_del(options, "etcd_prefix");
qdict_del(options, "image"); qdict_del(options, "image");
qdict_del(options, "inode"); qdict_del(options, "inode");
@ -512,6 +518,8 @@ static const char *vitastor_strong_runtime_opts[] = {
"inode", "inode",
"pool", "pool",
"config_path", "config_path",
"etcd",
"etcd_address",
"etcd_host", "etcd_host",
"etcd_prefix", "etcd_prefix",