[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v4 3/8] Replace migrate_get_connect_uri inplace of migrate_ge
From: |
Fabiano Rosas |
Subject: |
Re: [PATCH v4 3/8] Replace migrate_get_connect_uri inplace of migrate_get_socket_address |
Date: |
Mon, 11 Mar 2024 15:19:47 -0300 |
Het Gala <het.gala@nutanix.com> writes:
> migrate_get_socket_address implicitly converts SocketAddress into str.
> Move migrate_get_socket_address inside migrate_get_connect_uri which
> should return the uri string instead.
>
> Signed-off-by: Het Gala <het.gala@nutanix.com>
> Suggested-by: Fabiano Rosas <farosas@suse.de>
> ---
> tests/qtest/migration-helpers.c | 26 ++++++++++++++++++--------
> 1 file changed, 18 insertions(+), 8 deletions(-)
>
> diff --git a/tests/qtest/migration-helpers.c b/tests/qtest/migration-helpers.c
> index 9af3c7d4d5..3c3fe9d8aa 100644
> --- a/tests/qtest/migration-helpers.c
> +++ b/tests/qtest/migration-helpers.c
> @@ -49,12 +49,12 @@ static char *SocketAddress_to_str(SocketAddress *addr)
> }
> }
>
> -static char *
> +static SocketAddress *
> migrate_get_socket_address(QTestState *who, const char *parameter)
> {
> QDict *rsp;
> - char *result;
> SocketAddressList *addrs;
> + SocketAddress *addr;
> Visitor *iv = NULL;
> QObject *object;
>
> @@ -63,14 +63,24 @@ migrate_get_socket_address(QTestState *who, const char
> *parameter)
>
> iv = qobject_input_visitor_new(object);
> visit_type_SocketAddressList(iv, NULL, &addrs, &error_abort);
> + addr = addrs->value;
> visit_free(iv);
>
> - /* we are only using a single address */
> - result = SocketAddress_to_str(addrs->value);
> -
> - qapi_free_SocketAddressList(addrs);
> qobject_unref(rsp);
> - return result;
> + return addr;
> +}
> +
> +static char *
> +migrate_get_connect_uri(QTestState *who, const char *parameter)
> +{
> + SocketAddress *addrs;
> + char *connect_uri;
> +
> + addrs = migrate_get_socket_address(who, parameter);
> + connect_uri = SocketAddress_to_str(addrs);
> +
> + qapi_free_SocketAddress(addrs);
> + return connect_uri;
> }
>
> bool migrate_watch_for_events(QTestState *who, const char *name,
> @@ -130,7 +140,7 @@ void migrate_qmp(QTestState *who, QTestState *to, const
> char *uri,
>
> g_assert(!qdict_haskey(args, "uri"));
> if (!uri) {
> - connect_uri = migrate_get_socket_address(to, "socket-address");
> + connect_uri = migrate_get_connect_uri(to, "socket-address");
What's the point of the "socket-address" argument here? Seems a bit
nonsensical to me to call: migrate_get_socket_address(..., "socket-address").
What about we just suppress this throughout the stack and directly call:
object = qdict_get(rsp, "socket-address");
[PATCH v4 5/8] Add migrate_set_ports into migrate_qmp to update migration port value, Het Gala, 2024/03/08
[PATCH v4 6/8] Add channels parameter in migrate_qmp, Het Gala, 2024/03/08
[PATCH v4 7/8] Add multifd_tcp_plain test using list of channels instead of uri, Het Gala, 2024/03/08