diff --git a/debian/patched-qemu.Dockerfile b/debian/patched-qemu.Dockerfile index d815dbe78..cfc9709f6 100644 --- a/debian/patched-qemu.Dockerfile +++ b/debian/patched-qemu.Dockerfile @@ -7,11 +7,11 @@ ARG REL= WORKDIR /root -RUN if [ "$REL" = "buster" ]; then \ - echo 'deb http://deb.debian.org/debian buster-backports main' >> /etc/apt/sources.list; \ +RUN if [ "$REL" = "buster" -o "$REL" = "bullseye" ]; then \ + echo "deb http://deb.debian.org/debian $REL-backports main" >> /etc/apt/sources.list; \ echo >> /etc/apt/preferences; \ echo 'Package: *' >> /etc/apt/preferences; \ - echo 'Pin: release a=buster-backports' >> /etc/apt/preferences; \ + echo "Pin: release a=$REL-backports" >> /etc/apt/preferences; \ echo 'Pin-Priority: 500' >> /etc/apt/preferences; \ fi; \ grep '^deb ' /etc/apt/sources.list | perl -pe 's/^deb/deb-src/' >> /etc/apt/sources.list; \ @@ -27,15 +27,20 @@ RUN apt-get -y build-dep fio RUN apt-get --download-only source qemu RUN apt-get --download-only source fio -ADD patches/qemu-5.0-vitastor.patch patches/qemu-5.1-vitastor.patch /root/vitastor/patches/ +ADD patches/qemu-5.0-vitastor.patch patches/qemu-5.1-vitastor.patch patches/qemu-6.1-vitastor.patch /root/vitastor/patches/ RUN set -e; \ mkdir -p /root/packages/qemu-$REL; \ rm -rf /root/packages/qemu-$REL/*; \ cd /root/packages/qemu-$REL; \ dpkg-source -x /root/qemu*.dsc; \ - if [ -d /root/packages/qemu-$REL/qemu-5.0 ]; then \ - cp /root/vitastor/patches/qemu-5.0-vitastor.patch /root/packages/qemu-$REL/qemu-5.0/debian/patches; \ - echo qemu-5.0-vitastor.patch >> /root/packages/qemu-$REL/qemu-5.0/debian/patches/series; \ + if ls -d /root/packages/qemu-$REL/qemu-5.0*; then \ + D=$(ls -d /root/packages/qemu-$REL/qemu-5.0*); \ + cp /root/vitastor/patches/qemu-5.0-vitastor.patch $D/debian/patches; \ + echo qemu-5.0-vitastor.patch >> $D/debian/patches/series; \ + elif ls /root/packages/qemu-$REL/qemu-6.1*; then \ + D=$(ls -d /root/packages/qemu-$REL/qemu-6.1*); \ + cp /root/vitastor/patches/qemu-6.1-vitastor.patch $D/debian/patches; \ + echo qemu-6.1-vitastor.patch >> $D/debian/patches/series; \ else \ cp /root/vitastor/patches/qemu-5.1-vitastor.patch /root/packages/qemu-$REL/qemu-*/debian/patches; \ P=`ls -d /root/packages/qemu-$REL/qemu-*/debian/patches`; \ diff --git a/debian/vitastor.Dockerfile b/debian/vitastor.Dockerfile index 43863d4b2..0d228a3c3 100644 --- a/debian/vitastor.Dockerfile +++ b/debian/vitastor.Dockerfile @@ -7,11 +7,11 @@ ARG REL= WORKDIR /root -RUN if [ "$REL" = "buster" ]; then \ - echo 'deb http://deb.debian.org/debian buster-backports main' >> /etc/apt/sources.list; \ +RUN if [ "$REL" = "buster" -o "$REL" = "bullseye" ]; then \ + echo "deb http://deb.debian.org/debian $REL-backports main" >> /etc/apt/sources.list; \ echo >> /etc/apt/preferences; \ echo 'Package: *' >> /etc/apt/preferences; \ - echo 'Pin: release a=buster-backports' >> /etc/apt/preferences; \ + echo "Pin: release a=$REL-backports" >> /etc/apt/preferences; \ echo 'Pin-Priority: 500' >> /etc/apt/preferences; \ fi; \ grep '^deb ' /etc/apt/sources.list | perl -pe 's/^deb/deb-src/' >> /etc/apt/sources.list; \ diff --git a/patches/cinder-vitastor.py b/patches/cinder-vitastor.py index d08792650..b7264cc1e 100644 --- a/patches/cinder-vitastor.py +++ b/patches/cinder-vitastor.py @@ -489,7 +489,7 @@ class VitastorDriver(driver.CloneableImageVD, # FIXME use etcd_address in qemu driver kk = 'etcd_host' if v: - args += ':'+kk+'='+v.replace(':', '\\:') + args += ':'+kk.replace('_', '-')+'='+v.replace(':', '\\:') return args def delete_volume(self, volume): diff --git a/patches/libvirt-5.0-vitastor.diff b/patches/libvirt-5.0-vitastor.diff index cf77268d3..0f03c2a24 100644 --- a/patches/libvirt-5.0-vitastor.diff +++ b/patches/libvirt-5.0-vitastor.diff @@ -245,9 +245,9 @@ index cbf0aa4..096700d 100644 + + if (virJSONValueObjectCreate(&ret, + "s:driver", "vitastor", -+ "S:etcd_host", etcd, -+ "S:etcd_prefix", src->relPath, -+ "S:config_path", src->configFile, ++ "S:etcd-host", etcd, ++ "S:etcd-prefix", src->relPath, ++ "S:config-path", src->configFile, + "s:image", src->path, + NULL) < 0) + goto cleanup; @@ -293,7 +293,7 @@ index 822d5f8..e375cef 100644 + virBufferStrcat(&buf, "vitastor:image=", src->path, NULL); + + if (src->nhosts > 0) { -+ virBufferAddLit(&buf, ":etcd_host="); ++ virBufferAddLit(&buf, ":etcd-host="); + for (i = 0; i < src->nhosts; i++) { + if (i) + virBufferAddLit(&buf, ","); @@ -311,10 +311,10 @@ index 822d5f8..e375cef 100644 + } + + if (src->configFile) -+ virBufferEscape(&buf, '\\', ":", ":config_path=%s", src->configFile); ++ virBufferEscape(&buf, '\\', ":", ":config-path=%s", src->configFile); + + if (src->relPath) -+ virBufferEscape(&buf, '\\', ":", ":etcd_prefix=%s", src->relPath); ++ virBufferEscape(&buf, '\\', ":", ":etcd-prefix=%s", src->relPath); + + ret = virBufferContentAndReset(&buf); + break; @@ -438,16 +438,16 @@ index bd4b027..b323cd6 100644 + if (STRPREFIX(p, "image=")) { + if (VIR_STRDUP(src->path, p + strlen("image=")) < 0) + return -1; -+ } else if (STRPREFIX(p, "etcd_prefix=")) { -+ if (VIR_STRDUP(src->relPath, p + strlen("etcd_prefix=")) < 0) ++ } else if (STRPREFIX(p, "etcd-prefix=")) { ++ if (VIR_STRDUP(src->relPath, p + strlen("etcd-prefix=")) < 0) + return -1; -+ } else if (STRPREFIX(p, "config_file=")) { -+ if (VIR_STRDUP(src->configFile, p + strlen("config_file=")) < 0) ++ } else if (STRPREFIX(p, "config-path=")) { ++ if (VIR_STRDUP(src->configFile, p + strlen("config-path=")) < 0) + return -1; -+ } else if (STRPREFIX(p, "etcd_host=")) { ++ } else if (STRPREFIX(p, "etcd-host=")) { + char *h, *sep; + -+ h = p + strlen("etcd_host="); ++ h = p + strlen("etcd-host="); + while (h < e) { + for (sep = h; sep < e; ++sep) { + if (*sep == '\\' && (sep[1] == ',' || @@ -507,8 +507,8 @@ index bd4b027..b323cd6 100644 +{ + const char *filename; + const char *image = virJSONValueObjectGetString(json, "image"); -+ const char *conf = virJSONValueObjectGetString(json, "config_path"); -+ const char *etcd_prefix = virJSONValueObjectGetString(json, "etcd_prefix"); ++ const char *conf = virJSONValueObjectGetString(json, "config-path"); ++ const char *etcd_prefix = virJSONValueObjectGetString(json, "etcd-prefix"); + virJSONValuePtr servers = virJSONValueObjectGetArray(json, "server"); + size_t nservers; + size_t i; diff --git a/patches/libvirt-7.0-vitastor.diff b/patches/libvirt-7.0-vitastor.diff index 1d5777de2..f7d910d45 100644 --- a/patches/libvirt-7.0-vitastor.diff +++ b/patches/libvirt-7.0-vitastor.diff @@ -244,9 +244,9 @@ index f9c6da2..922dde5 100644 + } + + if (virJSONValueObjectCreate(&ret, -+ "S:etcd_host", etcd, -+ "S:etcd_prefix", src->query, -+ "S:config_path", src->configFile, ++ "S:etcd-host", etcd, ++ "S:etcd-prefix", src->query, ++ "S:config-path", src->configFile, + "s:image", src->path, + NULL) < 0) + return NULL; @@ -311,7 +311,7 @@ index 6f970a3..10b39ca 100644 + virBufferStrcat(&buf, "vitastor:image=", src->path, NULL); + + if (src->nhosts > 0) { -+ virBufferAddLit(&buf, ":etcd_host="); ++ virBufferAddLit(&buf, ":etcd-host="); + for (i = 0; i < src->nhosts; i++) { + if (i) + virBufferAddLit(&buf, ","); @@ -329,10 +329,10 @@ index 6f970a3..10b39ca 100644 + } + + if (src->configFile) -+ virBufferEscape(&buf, '\\', ":", ":config_path=%s", src->configFile); ++ virBufferEscape(&buf, '\\', ":", ":config-path=%s", src->configFile); + + if (src->query) -+ virBufferEscape(&buf, '\\', ":", ":etcd_prefix=%s", src->query); ++ virBufferEscape(&buf, '\\', ":", ":etcd-prefix=%s", src->query); + + ret = virBufferContentAndReset(&buf); + break; @@ -462,14 +462,14 @@ index 0d3c2af..36e3afc 100644 + + if (STRPREFIX(p, "image=")) { + src->path = g_strdup(p + strlen("image=")); -+ } else if (STRPREFIX(p, "etcd_prefix=")) { -+ src->query = g_strdup(p + strlen("etcd_prefix=")); -+ } else if (STRPREFIX(p, "config_file=")) { -+ src->configFile = g_strdup(p + strlen("config_file=")); -+ } else if (STRPREFIX(p, "etcd_host=")) { ++ } else if (STRPREFIX(p, "etcd-prefix=")) { ++ src->query = g_strdup(p + strlen("etcd-prefix=")); ++ } else if (STRPREFIX(p, "config-path=")) { ++ src->configFile = g_strdup(p + strlen("config-path=")); ++ } else if (STRPREFIX(p, "etcd-host=")) { + char *h, *sep; + -+ h = p + strlen("etcd_host="); ++ h = p + strlen("etcd-host="); + while (h < e) { + for (sep = h; sep < e; ++sep) { + if (*sep == '\\' && (sep[1] == ',' || @@ -526,8 +526,8 @@ index 0d3c2af..36e3afc 100644 +{ + const char *filename; + const char *image = virJSONValueObjectGetString(json, "image"); -+ const char *conf = virJSONValueObjectGetString(json, "config_path"); -+ const char *etcd_prefix = virJSONValueObjectGetString(json, "etcd_prefix"); ++ const char *conf = virJSONValueObjectGetString(json, "config-path"); ++ const char *etcd_prefix = virJSONValueObjectGetString(json, "etcd-prefix"); + virJSONValuePtr servers = virJSONValueObjectGetArray(json, "server"); + size_t nservers; + size_t i; diff --git a/patches/libvirt-7.5-vitastor.diff b/patches/libvirt-7.5-vitastor.diff index 620fbed06..0c6fc034a 100644 --- a/patches/libvirt-7.5-vitastor.diff +++ b/patches/libvirt-7.5-vitastor.diff @@ -276,9 +276,9 @@ index 6627d04..c33f428 100644 + } + + if (virJSONValueObjectCreate(&ret, -+ "S:etcd_host", etcd, -+ "S:etcd_prefix", src->query, -+ "S:config_path", src->configFile, ++ "S:etcd-host", etcd, ++ "S:etcd-prefix", src->query, ++ "S:config-path", src->configFile, + "s:image", src->path, + NULL) < 0) + return NULL; @@ -343,7 +343,7 @@ index ea51369..8258632 100644 + virBufferStrcat(&buf, "vitastor:image=", src->path, NULL); + + if (src->nhosts > 0) { -+ virBufferAddLit(&buf, ":etcd_host="); ++ virBufferAddLit(&buf, ":etcd-host="); + for (i = 0; i < src->nhosts; i++) { + if (i) + virBufferAddLit(&buf, ","); @@ -361,10 +361,10 @@ index ea51369..8258632 100644 + } + + if (src->configFile) -+ virBufferEscape(&buf, '\\', ":", ":config_path=%s", src->configFile); ++ virBufferEscape(&buf, '\\', ":", ":config-path=%s", src->configFile); + + if (src->query) -+ virBufferEscape(&buf, '\\', ":", ":etcd_prefix=%s", src->query); ++ virBufferEscape(&buf, '\\', ":", ":etcd-prefix=%s", src->query); + + ret = virBufferContentAndReset(&buf); + break; @@ -474,14 +474,14 @@ index e48ae72..d7a9b72 100644 + + if (STRPREFIX(p, "image=")) { + src->path = g_strdup(p + strlen("image=")); -+ } else if (STRPREFIX(p, "etcd_prefix=")) { -+ src->query = g_strdup(p + strlen("etcd_prefix=")); -+ } else if (STRPREFIX(p, "config_file=")) { -+ src->configFile = g_strdup(p + strlen("config_file=")); -+ } else if (STRPREFIX(p, "etcd_host=")) { ++ } else if (STRPREFIX(p, "etcd-prefix=")) { ++ src->query = g_strdup(p + strlen("etcd-prefix=")); ++ } else if (STRPREFIX(p, "config-path=")) { ++ src->configFile = g_strdup(p + strlen("config-path=")); ++ } else if (STRPREFIX(p, "etcd-host=")) { + char *h, *sep; + -+ h = p + strlen("etcd_host="); ++ h = p + strlen("etcd-host="); + while (h < e) { + for (sep = h; sep < e; ++sep) { + if (*sep == '\\' && (sep[1] == ',' || @@ -538,8 +538,8 @@ index e48ae72..d7a9b72 100644 +{ + const char *filename; + const char *image = virJSONValueObjectGetString(json, "image"); -+ const char *conf = virJSONValueObjectGetString(json, "config_path"); -+ const char *etcd_prefix = virJSONValueObjectGetString(json, "etcd_prefix"); ++ const char *conf = virJSONValueObjectGetString(json, "config-path"); ++ const char *etcd_prefix = virJSONValueObjectGetString(json, "etcd-prefix"); + virJSONValue *servers = virJSONValueObjectGetArray(json, "server"); + size_t nservers; + size_t i; diff --git a/patches/nova-20.diff b/patches/nova-20.diff index 268ac2056..17b75f48a 100644 --- a/patches/nova-20.diff +++ b/patches/nova-20.diff @@ -124,7 +124,7 @@ index 391231c527..34dc60dcdd 100644 + if kk == 'etcd_address': + # FIXME use etcd_address in qemu driver + kk = 'etcd_host' -+ path += ":"+kk+"="+connection_info['data'][k].replace(':', '\\:') ++ path += ":"+kk.replace('_', '-')+"="+connection_info['data'][k].replace(':', '\\:') else: path = 'unknown' raise exception.DiskNotFound(location='unknown') diff --git a/patches/qemu-3.1-vitastor.patch b/patches/qemu-3.1-vitastor.patch index 35880d21a..5817d3133 100644 --- a/patches/qemu-3.1-vitastor.patch +++ b/patches/qemu-3.1-vitastor.patch @@ -23,18 +23,18 @@ Index: qemu-3.1+dfsg/qapi/block-core.json +# @inode: Inode number +# @pool: Pool ID +# @size: Desired image size in bytes -+# @config_path: Path to Vitastor configuration -+# @etcd_host: etcd connection address(es) -+# @etcd_prefix: etcd key/value prefix ++# @config-path: Path to Vitastor configuration ++# @etcd-host: etcd connection address(es) ++# @etcd-prefix: etcd key/value prefix +## +{ 'struct': 'BlockdevOptionsVitastor', + 'data': { '*inode': 'uint64', + '*pool': 'uint64', + '*size': 'uint64', + '*image': 'str', -+ '*config_path': 'str', -+ '*etcd_host': 'str', -+ '*etcd_prefix': 'str' } } ++ '*config-path': 'str', ++ '*etcd-host': 'str', ++ '*etcd-prefix': 'str' } } + +## # @ReplicationMode: diff --git a/patches/qemu-4.2-vitastor.patch b/patches/qemu-4.2-vitastor.patch index 4617f106e..189f7f7ae 100644 --- a/patches/qemu-4.2-vitastor.patch +++ b/patches/qemu-4.2-vitastor.patch @@ -23,18 +23,18 @@ Index: qemu/qapi/block-core.json +# @inode: Inode number +# @pool: Pool ID +# @size: Desired image size in bytes -+# @config_path: Path to Vitastor configuration -+# @etcd_host: etcd connection address(es) -+# @etcd_prefix: etcd key/value prefix ++# @config-path: Path to Vitastor configuration ++# @etcd-host: etcd connection address(es) ++# @etcd-prefix: etcd key/value prefix +## +{ 'struct': 'BlockdevOptionsVitastor', + 'data': { '*inode': 'uint64', + '*pool': 'uint64', + '*size': 'uint64', + '*image': 'str', -+ '*config_path': 'str', -+ '*etcd_host': 'str', -+ '*etcd_prefix': 'str' } } ++ '*config-path': 'str', ++ '*etcd-host': 'str', ++ '*etcd-prefix': 'str' } } + +## # @ReplicationMode: diff --git a/patches/qemu-5.0-vitastor.patch b/patches/qemu-5.0-vitastor.patch index 30b84a595..549b4bb24 100644 --- a/patches/qemu-5.0-vitastor.patch +++ b/patches/qemu-5.0-vitastor.patch @@ -23,18 +23,18 @@ Index: qemu/qapi/block-core.json +# @inode: Inode number +# @pool: Pool ID +# @size: Desired image size in bytes -+# @config_path: Path to Vitastor configuration -+# @etcd_host: etcd connection address(es) -+# @etcd_prefix: etcd key/value prefix ++# @config-path: Path to Vitastor configuration ++# @etcd-host: etcd connection address(es) ++# @etcd-prefix: etcd key/value prefix +## +{ 'struct': 'BlockdevOptionsVitastor', + 'data': { '*inode': 'uint64', + '*pool': 'uint64', + '*size': 'uint64', + '*image': 'str', -+ '*config_path': 'str', -+ '*etcd_host': 'str', -+ '*etcd_prefix': 'str' } } ++ '*config-path': 'str', ++ '*etcd-host': 'str', ++ '*etcd-prefix': 'str' } } + +## # @ReplicationMode: diff --git a/patches/qemu-5.1-vitastor.patch b/patches/qemu-5.1-vitastor.patch index 6c52fd995..dec5d5f42 100644 --- a/patches/qemu-5.1-vitastor.patch +++ b/patches/qemu-5.1-vitastor.patch @@ -23,18 +23,18 @@ Index: qemu-5.1+dfsg/qapi/block-core.json +# @inode: Inode number +# @pool: Pool ID +# @size: Desired image size in bytes -+# @config_path: Path to Vitastor configuration -+# @etcd_host: etcd connection address(es) -+# @etcd_prefix: etcd key/value prefix ++# @config-path: Path to Vitastor configuration ++# @etcd-host: etcd connection address(es) ++# @etcd-prefix: etcd key/value prefix +## +{ 'struct': 'BlockdevOptionsVitastor', + 'data': { '*inode': 'uint64', + '*pool': 'uint64', + '*size': 'uint64', + '*image': 'str', -+ '*config_path': 'str', -+ '*etcd_host': 'str', -+ '*etcd_prefix': 'str' } } ++ '*config-path': 'str', ++ '*etcd-host': 'str', ++ '*etcd-prefix': 'str' } } + +## # @ReplicationMode: diff --git a/patches/qemu-6.1-vitastor.patch b/patches/qemu-6.1-vitastor.patch new file mode 100644 index 000000000..ea528e45b --- /dev/null +++ b/patches/qemu-6.1-vitastor.patch @@ -0,0 +1,88 @@ +Index: qemu-6.1+dfsg/qapi/block-core.json +=================================================================== +--- qemu-6.1+dfsg.orig/qapi/block-core.json ++++ qemu-6.1+dfsg/qapi/block-core.json +@@ -2838,7 +2838,7 @@ + 'luks', 'nbd', 'nfs', 'null-aio', 'null-co', 'nvme', 'parallels', + 'preallocate', 'qcow', 'qcow2', 'qed', 'quorum', 'raw', 'rbd', + { 'name': 'replication', 'if': 'defined(CONFIG_REPLICATION)' }, +- 'ssh', 'throttle', 'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat' ] } ++ 'ssh', 'throttle', 'vdi', 'vhdx', 'vitastor', 'vmdk', 'vpc', 'vvfat' ] } + + ## + # @BlockdevOptionsFile: +@@ -3763,6 +3763,28 @@ + '*server': ['InetSocketAddressBase'] } } + + ## ++# @BlockdevOptionsVitastor: ++# ++# Driver specific block device options for vitastor ++# ++# @image: Image name ++# @inode: Inode number ++# @pool: Pool ID ++# @size: Desired image size in bytes ++# @config-path: Path to Vitastor configuration ++# @etcd-host: etcd connection address(es) ++# @etcd-prefix: etcd key/value prefix ++## ++{ 'struct': 'BlockdevOptionsVitastor', ++ 'data': { '*inode': 'uint64', ++ '*pool': 'uint64', ++ '*size': 'uint64', ++ '*image': 'str', ++ '*config-path': 'str', ++ '*etcd-host': 'str', ++ '*etcd-prefix': 'str' } } ++ ++## + # @ReplicationMode: + # + # An enumeration of replication modes. +@@ -4134,6 +4156,7 @@ + 'throttle': 'BlockdevOptionsThrottle', + 'vdi': 'BlockdevOptionsGenericFormat', + 'vhdx': 'BlockdevOptionsGenericFormat', ++ 'vitastor': 'BlockdevOptionsVitastor', + 'vmdk': 'BlockdevOptionsGenericCOWFormat', + 'vpc': 'BlockdevOptionsGenericFormat', + 'vvfat': 'BlockdevOptionsVVFAT' +@@ -4523,6 +4546,17 @@ + '*encrypt' : 'RbdEncryptionCreateOptions' } } + + ## ++# @BlockdevCreateOptionsVitastor: ++# ++# Driver specific image creation options for Vitastor. ++# ++# @size: Size of the virtual disk in bytes ++## ++{ 'struct': 'BlockdevCreateOptionsVitastor', ++ 'data': { 'location': 'BlockdevOptionsVitastor', ++ 'size': 'size' } } ++ ++## + # @BlockdevVmdkSubformat: + # + # Subformat options for VMDK images +@@ -4718,6 +4752,7 @@ + 'ssh': 'BlockdevCreateOptionsSsh', + 'vdi': 'BlockdevCreateOptionsVdi', + 'vhdx': 'BlockdevCreateOptionsVhdx', ++ 'vitastor': 'BlockdevCreateOptionsVitastor', + 'vmdk': 'BlockdevCreateOptionsVmdk', + 'vpc': 'BlockdevCreateOptionsVpc' + } } +Index: qemu-6.1+dfsg/scripts/modules/module_block.py +=================================================================== +--- qemu-6.1+dfsg.orig/scripts/modules/module_block.py ++++ qemu-6.1+dfsg/scripts/modules/module_block.py +@@ -86,6 +86,7 @@ if __name__ == '__main__': + output_file = sys.argv[1] + with open(output_file, 'w') as fheader: + print_top(fheader) ++ add_module(fheader, "vitastor", "vitastor", "vitastor") + + for filename in sys.argv[2:]: + if os.path.isfile(filename): diff --git a/src/qemu_driver.c b/src/qemu_driver.c index ba2a61da5..455e92537 100644 --- a/src/qemu_driver.c +++ b/src/qemu_driver.c @@ -132,16 +132,19 @@ static void vitastor_parse_filename(const char *filename, QDict *options, Error error_setg(errp, "conf option %s has no value", name); break; } + for (int i = 0; i < strlen(name); i++) + if (name[i] == '_') + name[i] = '-'; qemu_vitastor_unescape(name); value = qemu_vitastor_next_tok(p, ':', &p); qemu_vitastor_unescape(value); if (!strcmp(name, "inode") || !strcmp(name, "pool") || !strcmp(name, "size") || - !strcmp(name, "use_rdma") || - !strcmp(name, "rdma_port_num") || - !strcmp(name, "rdma_gid_index") || - !strcmp(name, "rdma_mtu")) + !strcmp(name, "use-rdma") || + !strcmp(name, "rdma-port_num") || + !strcmp(name, "rdma-gid-index") || + !strcmp(name, "rdma-mtu")) { unsigned long long num_val; if (parse_uint_full(value, &num_val, 0)) @@ -202,15 +205,15 @@ static int vitastor_file_open(BlockDriverState *bs, QDict *options, int flags, E VitastorClient *client = bs->opaque; int64_t ret = 0; 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 - client->etcd_host = g_strdup(qdict_get_try_str(options, "etcd_host")); - 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")); - client->rdma_port_num = qdict_get_try_int(options, "rdma_port_num", 0); - client->rdma_gid_index = qdict_get_try_int(options, "rdma_gid_index", 0); - client->rdma_mtu = qdict_get_try_int(options, "rdma_mtu", 0); + client->etcd_host = g_strdup(qdict_get_try_str(options, "etcd-host")); + 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")); + client->rdma_port_num = qdict_get_try_int(options, "rdma-port-num", 0); + client->rdma_gid_index = qdict_get_try_int(options, "rdma-gid-index", 0); + client->rdma_mtu = qdict_get_try_int(options, "rdma-mtu", 0); client->proxy = vitastor_c_create_qemu( (QEMUSetFDHandler*)aio_set_fd_handler, bdrv_get_aio_context(bs), client->config_path, client->etcd_host, client->etcd_prefix, client->use_rdma, client->rdma_device, client->rdma_port_num, client->rdma_gid_index, client->rdma_mtu, 0 @@ -264,14 +267,14 @@ static int vitastor_file_open(BlockDriverState *bs, QDict *options, int flags, E } bs->total_sectors = client->size / BDRV_SECTOR_SIZE; //client->aio_context = bdrv_get_aio_context(bs); - qdict_del(options, "use_rdma"); - qdict_del(options, "rdma_mtu"); - qdict_del(options, "rdma_gid_index"); - qdict_del(options, "rdma_port_num"); - qdict_del(options, "rdma_device"); - qdict_del(options, "config_path"); - qdict_del(options, "etcd_host"); - qdict_del(options, "etcd_prefix"); + qdict_del(options, "use-rdma"); + qdict_del(options, "rdma-mtu"); + qdict_del(options, "rdma-gid-index"); + qdict_del(options, "rdma-port-num"); + qdict_del(options, "rdma-device"); + qdict_del(options, "config-path"); + qdict_del(options, "etcd-host"); + qdict_del(options, "etcd-prefix"); qdict_del(options, "image"); qdict_del(options, "inode"); qdict_del(options, "pool"); @@ -515,9 +518,9 @@ static QEMUOptionParameter vitastor_create_opts[] = { static const char *vitastor_strong_runtime_opts[] = { "inode", "pool", - "config_path", - "etcd_host", - "etcd_prefix", + "config-path", + "etcd-host", + "etcd-prefix", NULL };