From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: qemu-block@nongnu.org, kwolf@redhat.com,
mitake.hitoshi@lab.ntt.co.jp, namei.unix@gmail.com,
jcody@redhat.com
Subject: [Qemu-devel] [PATCH 14/15] qapi-schema: Rename SocketAddressFlat's variant tcp to inet
Date: Thu, 2 Mar 2017 22:44:05 +0100 [thread overview]
Message-ID: <1488491046-2549-15-git-send-email-armbru@redhat.com> (raw)
In-Reply-To: <1488491046-2549-1-git-send-email-armbru@redhat.com>
QAPI type SocketAddressFlat differs from SocketAddress pointlessly:
the discriminator value for variant InetSocketAddress is 'tcp' instead
of 'inet'. Rename.
The type is far only used by the Gluster block drivers. Take care to
keep 'tcp' working there.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
block/gluster.c | 59 +++++++++++++++++++++++++++++---------------------------
qapi-schema.json | 8 ++++----
2 files changed, 35 insertions(+), 32 deletions(-)
diff --git a/block/gluster.c b/block/gluster.c
index 77ce45b..0155188 100644
--- a/block/gluster.c
+++ b/block/gluster.c
@@ -152,7 +152,7 @@ static QemuOptsList runtime_type_opts = {
{
.name = GLUSTER_OPT_TYPE,
.type = QEMU_OPT_STRING,
- .help = "tcp|unix",
+ .help = "inet|unix",
},
{ /* end of list */ }
},
@@ -171,14 +171,14 @@ static QemuOptsList runtime_unix_opts = {
},
};
-static QemuOptsList runtime_tcp_opts = {
- .name = "gluster_tcp",
- .head = QTAILQ_HEAD_INITIALIZER(runtime_tcp_opts.head),
+static QemuOptsList runtime_inet_opts = {
+ .name = "gluster_inet",
+ .head = QTAILQ_HEAD_INITIALIZER(runtime_inet_opts.head),
.desc = {
{
.name = GLUSTER_OPT_TYPE,
.type = QEMU_OPT_STRING,
- .help = "tcp|unix",
+ .help = "inet|unix",
},
{
.name = GLUSTER_OPT_HOST,
@@ -337,14 +337,14 @@ static int qemu_gluster_parse_uri(BlockdevOptionsGluster *gconf,
/* transport */
if (!uri->scheme || !strcmp(uri->scheme, "gluster")) {
- gsconf->type = SOCKET_ADDRESS_FLAT_TYPE_TCP;
+ gsconf->type = SOCKET_ADDRESS_FLAT_TYPE_INET;
} else if (!strcmp(uri->scheme, "gluster+tcp")) {
- gsconf->type = SOCKET_ADDRESS_FLAT_TYPE_TCP;
+ gsconf->type = SOCKET_ADDRESS_FLAT_TYPE_INET;
} else if (!strcmp(uri->scheme, "gluster+unix")) {
gsconf->type = SOCKET_ADDRESS_FLAT_TYPE_UNIX;
is_unix = true;
} else if (!strcmp(uri->scheme, "gluster+rdma")) {
- gsconf->type = SOCKET_ADDRESS_FLAT_TYPE_TCP;
+ gsconf->type = SOCKET_ADDRESS_FLAT_TYPE_INET;
error_report("Warning: rdma feature is not supported, falling "
"back to tcp");
} else {
@@ -374,11 +374,11 @@ static int qemu_gluster_parse_uri(BlockdevOptionsGluster *gconf,
}
gsconf->u.q_unix.path = g_strdup(qp->p[0].value);
} else {
- gsconf->u.tcp.host = g_strdup(uri->server ? uri->server : "localhost");
+ gsconf->u.inet.host = g_strdup(uri->server ? uri->server : "localhost");
if (uri->port) {
- gsconf->u.tcp.port = g_strdup_printf("%d", uri->port);
+ gsconf->u.inet.port = g_strdup_printf("%d", uri->port);
} else {
- gsconf->u.tcp.port = g_strdup_printf("%d", GLUSTER_DEFAULT_PORT);
+ gsconf->u.inet.port = g_strdup_printf("%d", GLUSTER_DEFAULT_PORT);
}
}
@@ -416,15 +416,15 @@ static struct glfs *qemu_gluster_glfs_init(BlockdevOptionsGluster *gconf,
ret = glfs_set_volfile_server(glfs, "unix",
server->value->u.q_unix.path, 0);
} else {
- if (parse_uint_full(server->value->u.tcp.port, &port, 10) < 0 ||
+ if (parse_uint_full(server->value->u.inet.port, &port, 10) < 0 ||
port > 65535) {
error_setg(errp, "'%s' is not a valid port number",
- server->value->u.tcp.port);
+ server->value->u.inet.port);
errno = EINVAL;
goto out;
}
ret = glfs_set_volfile_server(glfs, "tcp",
- server->value->u.tcp.host,
+ server->value->u.inet.host,
(int)port);
}
@@ -448,8 +448,8 @@ static struct glfs *qemu_gluster_glfs_init(BlockdevOptionsGluster *gconf,
server->value->u.q_unix.path);
} else {
error_append_hint(errp, "hint: failed on host %s and port %s ",
- server->value->u.tcp.host,
- server->value->u.tcp.port);
+ server->value->u.inet.host,
+ server->value->u.inet.port);
}
}
@@ -536,21 +536,24 @@ static int qemu_gluster_parse_json(BlockdevOptionsGluster *gconf,
}
gsconf = g_new0(SocketAddressFlat, 1);
+ if (!strcmp(ptr, "tcp")) {
+ ptr = "inet"; /* accept legacy "tcp" */
+ }
gsconf->type = qapi_enum_parse(SocketAddressFlatType_lookup, ptr,
SOCKET_ADDRESS_FLAT_TYPE__MAX, 0,
&local_err);
if (local_err) {
error_append_hint(&local_err,
- "Parameter '%s' may be 'tcp' or 'unix'\n",
+ "Parameter '%s' may be 'inet' or 'unix'\n",
GLUSTER_OPT_TYPE);
error_append_hint(&local_err, GERR_INDEX_HINT, i);
goto out;
}
qemu_opts_del(opts);
- if (gsconf->type == SOCKET_ADDRESS_FLAT_TYPE_TCP) {
- /* create opts info from runtime_tcp_opts list */
- opts = qemu_opts_create(&runtime_tcp_opts, NULL, 0, &error_abort);
+ if (gsconf->type == SOCKET_ADDRESS_FLAT_TYPE_INET) {
+ /* create opts info from runtime_inet_opts list */
+ opts = qemu_opts_create(&runtime_inet_opts, NULL, 0, &error_abort);
qemu_opts_absorb_qdict(opts, backing_options, &local_err);
if (local_err) {
goto out;
@@ -563,7 +566,7 @@ static int qemu_gluster_parse_json(BlockdevOptionsGluster *gconf,
error_append_hint(&local_err, GERR_INDEX_HINT, i);
goto out;
}
- gsconf->u.tcp.host = g_strdup(ptr);
+ gsconf->u.inet.host = g_strdup(ptr);
ptr = qemu_opt_get(opts, GLUSTER_OPT_PORT);
if (!ptr) {
error_setg(&local_err, QERR_MISSING_PARAMETER,
@@ -571,28 +574,28 @@ static int qemu_gluster_parse_json(BlockdevOptionsGluster *gconf,
error_append_hint(&local_err, GERR_INDEX_HINT, i);
goto out;
}
- gsconf->u.tcp.port = g_strdup(ptr);
+ gsconf->u.inet.port = g_strdup(ptr);
/* defend for unsupported fields in InetSocketAddress,
* i.e. @ipv4, @ipv6 and @to
*/
ptr = qemu_opt_get(opts, GLUSTER_OPT_TO);
if (ptr) {
- gsconf->u.tcp.has_to = true;
+ gsconf->u.inet.has_to = true;
}
ptr = qemu_opt_get(opts, GLUSTER_OPT_IPV4);
if (ptr) {
- gsconf->u.tcp.has_ipv4 = true;
+ gsconf->u.inet.has_ipv4 = true;
}
ptr = qemu_opt_get(opts, GLUSTER_OPT_IPV6);
if (ptr) {
- gsconf->u.tcp.has_ipv6 = true;
+ gsconf->u.inet.has_ipv6 = true;
}
- if (gsconf->u.tcp.has_to) {
+ if (gsconf->u.inet.has_to) {
error_setg(&local_err, "Parameter 'to' not supported");
goto out;
}
- if (gsconf->u.tcp.has_ipv4 || gsconf->u.tcp.has_ipv6) {
+ if (gsconf->u.inet.has_ipv4 || gsconf->u.inet.has_ipv6) {
error_setg(&local_err, "Parameters 'ipv4/ipv6' not supported");
goto out;
}
@@ -669,7 +672,7 @@ static struct glfs *qemu_gluster_init(BlockdevOptionsGluster *gconf,
"file.volume=testvol,file.path=/path/a.qcow2"
"[,file.debug=9]"
"[,file.logfile=/path/filename.log],"
- "file.server.0.type=tcp,"
+ "file.server.0.type=inet,"
"file.server.0.host=1.2.3.4,"
"file.server.0.port=24007,"
"file.server.1.transport=unix,"
diff --git a/qapi-schema.json b/qapi-schema.json
index a57afeb..dfaebce 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -4105,14 +4105,14 @@
#
# Available SocketAddressFlat types
#
-# @tcp: Internet address
+# @inet: Internet address
#
# @unix: Unix domain socket
#
# Since: 2.9
##
{ 'enum': 'SocketAddressFlatType',
- 'data': [ 'unix', 'tcp' ] }
+ 'data': [ 'unix', 'inet' ] }
##
# @SocketAddressFlat:
@@ -4127,7 +4127,7 @@
# A flat union is nicer than simple because it avoids nesting
# (i.e. more {}) on the wire.
#
-# 2. SocketAddressFlat supports only types 'unix' and 'tcp', because
+# 2. SocketAddressFlat supports only types 'unix' and 'inet', because
# that's what its current users need.
#
# Since: 2.9
@@ -4136,7 +4136,7 @@
'base': { 'type': 'SocketAddressFlatType' },
'discriminator': 'type',
'data': { 'unix': 'UnixSocketAddress',
- 'tcp': 'InetSocketAddress' } }
+ 'inet': 'InetSocketAddress' } }
##
# @getfd:
--
2.7.4
next prev parent reply other threads:[~2017-03-02 21:44 UTC|newest]
Thread overview: 61+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-02 21:43 [Qemu-devel] [PATCH 00/15] block: A bunch of fixes for Sheepdog and Gluster Markus Armbruster
2017-03-02 21:43 ` [Qemu-devel] [PATCH 01/15] sheepdog: Defuse time bomb in sd_open() error handling Markus Armbruster
2017-03-02 22:46 ` Eric Blake
2017-03-03 5:18 ` Markus Armbruster
2017-03-02 21:43 ` [Qemu-devel] [PATCH 02/15] sheepdog: Fix error handling in sd_snapshot_delete() Markus Armbruster
2017-03-02 23:13 ` Eric Blake
2017-03-03 5:22 ` Markus Armbruster
2017-03-03 13:07 ` Kevin Wolf
2017-03-03 13:31 ` Markus Armbruster
2017-03-02 21:43 ` [Qemu-devel] [PATCH 03/15] sheepdog: Fix error handling sd_create() Markus Armbruster
2017-03-02 23:16 ` Eric Blake
2017-03-03 0:07 ` Philippe Mathieu-Daudé
2017-03-03 13:13 ` Kevin Wolf
2017-03-02 21:43 ` [Qemu-devel] [PATCH 04/15] sheepdog: Mark sd_snapshot_delete() lossage FIXME Markus Armbruster
2017-03-02 23:18 ` Eric Blake
2017-03-02 21:43 ` [Qemu-devel] [PATCH 05/15] sheepdog: Fix snapshot ID parsing in _open(), _create, _goto() Markus Armbruster
2017-03-02 23:30 ` Eric Blake
2017-03-03 13:25 ` Kevin Wolf
2017-03-03 13:41 ` Markus Armbruster
2017-03-02 21:43 ` [Qemu-devel] [PATCH 06/15] sheepdog: Don't truncate long VDI name in _open(), _create() Markus Armbruster
2017-03-02 23:32 ` Eric Blake
2017-03-03 0:25 ` Philippe Mathieu-Daudé
2017-03-03 5:21 ` Markus Armbruster
2017-03-03 5:21 ` Markus Armbruster
2017-03-03 0:10 ` Philippe Mathieu-Daudé
2017-03-02 21:43 ` [Qemu-devel] [PATCH 07/15] sheepdog: Report errors in pseudo-filename more usefully Markus Armbruster
2017-03-03 13:36 ` Kevin Wolf
2017-03-03 14:53 ` Markus Armbruster
2017-03-03 13:49 ` Kevin Wolf
2017-03-03 14:57 ` Markus Armbruster
2017-03-02 21:43 ` [Qemu-devel] [PATCH 08/15] sheepdog: Use SocketAddress and socket_connect() Markus Armbruster
2017-03-03 13:47 ` Kevin Wolf
2017-03-02 21:44 ` [Qemu-devel] [PATCH 09/15] sheepdog: Implement bdrv_parse_filename() Markus Armbruster
2017-03-03 20:17 ` Eric Blake
2017-03-02 21:44 ` [Qemu-devel] [PATCH 10/15] gluster: Drop assumptions on SocketTransport names Markus Armbruster
2017-03-03 6:40 ` [Qemu-devel] [Qemu-block] " Niels de Vos
2017-03-03 7:31 ` Markus Armbruster
2017-03-02 21:44 ` [Qemu-devel] [PATCH 11/15] gluster: Don't duplicate qapi-util.c's qapi_enum_parse() Markus Armbruster
2017-03-03 6:35 ` [Qemu-devel] [Qemu-block] " Niels de Vos
2017-03-02 21:44 ` [Qemu-devel] [PATCH 12/15] gluster: Plug memory leaks in qemu_gluster_parse_json() Markus Armbruster
2017-03-03 7:11 ` [Qemu-devel] [Qemu-block] " Niels de Vos
2017-03-03 7:38 ` Markus Armbruster
2017-03-03 8:17 ` Niels de Vos
2017-03-03 8:35 ` Markus Armbruster
2017-03-03 17:06 ` Niels de Vos
2017-03-02 21:44 ` [Qemu-devel] [PATCH 13/15] qapi-schema: Rename GlusterServer to SocketAddressFlat Markus Armbruster
2017-03-03 16:31 ` Eric Blake
2017-03-03 17:05 ` Markus Armbruster
2017-03-03 18:33 ` Eric Blake
2017-03-02 21:44 ` Markus Armbruster [this message]
2017-03-03 18:35 ` [Qemu-devel] [PATCH 14/15] qapi-schema: Rename SocketAddressFlat's variant tcp to inet Eric Blake
2017-03-03 20:03 ` Markus Armbruster
2017-03-06 15:00 ` Markus Armbruster
2017-03-02 21:44 ` [Qemu-devel] [PATCH 15/15] sheepdog: Support blockdev-add Markus Armbruster
2017-03-03 18:42 ` Eric Blake
2017-03-02 23:35 ` [Qemu-devel] [PATCH 00/15] block: A bunch of fixes for Sheepdog and Gluster Eric Blake
2017-03-03 5:39 ` Markus Armbruster
2017-03-03 16:27 ` Eric Blake
2017-03-03 17:14 ` Peter Maydell
2017-03-03 18:37 ` Markus Armbruster
2017-03-03 18:50 ` Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1488491046-2549-15-git-send-email-armbru@redhat.com \
--to=armbru@redhat.com \
--cc=jcody@redhat.com \
--cc=kwolf@redhat.com \
--cc=mitake.hitoshi@lab.ntt.co.jp \
--cc=namei.unix@gmail.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).