From: Fabiano Rosas <farosas@suse.de>
To: Het Gala <het.gala@nutanix.com>, qemu-devel@nongnu.org
Cc: marcandre.lureau@redhat.com, thuth@redhat.com,
lvivier@redhat.com, pbonzini@redhat.com, peterx@redhat.com
Subject: Re: [PATCH v3 4/7] Add migrate_set_ports into migrate_qmp to change migration port number
Date: Thu, 07 Mar 2024 08:37:17 -0300 [thread overview]
Message-ID: <87ttliqnma.fsf@suse.de> (raw)
In-Reply-To: <28018429-e5ab-4dec-b742-99d7daa416b2@nutanix.com>
Het Gala <het.gala@nutanix.com> writes:
> On 06/03/24 9:31 pm, Fabiano Rosas wrote:
>> Het Gala<het.gala@nutanix.com> writes:
>>
>>> On 06/03/24 8:06 pm, Fabiano Rosas wrote:
>>>> Het Gala<het.gala@nutanix.com> writes:
>>>>
>>>>> Add a migrate_set_ports() function that from each QDict, fills in
>>>>> the port in case it was 0 in the test.
>>>>> Handle a list of channels so we can add a negative test that
>>>>> passes more than one channel.
>>>>>
>>>>> 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, 26 insertions(+)
>>>>>
>>>>> diff --git a/tests/qtest/migration-helpers.c b/tests/qtest/migration-helpers.c
>>>>> index 478c1f259b..df4978bf17 100644
>>>>> --- a/tests/qtest/migration-helpers.c
>>>>> +++ b/tests/qtest/migration-helpers.c
>>>>> @@ -17,6 +17,8 @@
>>>>> #include "qapi/qapi-visit-sockets.h"
>>>>> #include "qapi/qobject-input-visitor.h"
>>>>> #include "qapi/error.h"
>>>>> +#include "qapi/qmp/qlist.h"
>>>>> +
>>>> Extra line here. This is unwanted because it sometimes trips git into
>>>> thinking there's a conflict here when another patch changes the
>>>> surrounding lines.
>>> Ack, that makes sense
>>>>>
>>>>> #include "migration-helpers.h"
>>>>>
>>>>> @@ -73,6 +75,29 @@ migrate_get_socket_address(QTestState *who, const char *parameter)
>>>>> return result;
>>>>> }
>>>>>
>>>>> +static void migrate_set_ports(QTestState *to, QList *channelList)
>>>>> +{
>>>>> + g_autofree char *addr = NULL;
>>>>> + g_autofree char *addr_port = NULL;
>>>>> + QListEntry *entry;
>>>>> +
>>>>> + addr = migrate_get_socket_address(to, "socket-address");
>>>>> + addr_port = g_strsplit(addr, ":", 3)[2];
>>>> Will this always do the right thing when the src/dst use different types
>>>> of channels? If there is some kind of mismatch (say one side uses vsock
>>>> and the other inet), it's better that this function doesn't touch the
>>>> channels dict instead of putting garbage in the port field.
>>> Yes you are right. This will fail if there is a mismatch in type of
>>> channels.
>>>
>>> Better idea would be to check if 'port' key is present in both, i.e. in
>>> 'addr'
>>> as well as 'addrdict' and only then change the port ?
>>>
>> Yep, either parse the type from string or add a version of
>> migrate_get_socket_address that returns a dict. Then check if type
>> matches and port exists.
>
> one silly question here, why are we not having tests for exec and rdma
> specifically ?
exec because we intend to deprecate it, so no one is paying too much
attention to it.
rdma because no one wants to write them.
>
> Another suggestion required: Parsing uri to qdict is easy to implement
> but (little)
> messy codewise, and the other hand migrate_get_qdict looks clean, but
> under the hood we would convert it to socketaddress and then call
> SocketAddress_to_qdict. Which one we can prefer more here ?
The latter. It's easier to work with.
static QDict *SocketAddress_to_qdict(SocketAddress *addr)
{
QDict *dict = qdict_new();
switch (addr->type) {
case SOCKET_ADDRESS_TYPE_INET:
qdict_put_str(dict, "type", "inet");
qdict_put_str(dict, "host", addr->u.inet.host);
qdict_put_str(dict, "port", addr->u.inet.port);
break;
case SOCKET_ADDRESS_TYPE_UNIX:
qdict_put_str(dict, "type", "unix");
qdict_put_str(dict, "path", addr->u.q_unix.path);
break;
case SOCKET_ADDRESS_TYPE_FD:
qdict_put_str(dict, "type", "fd");
qdict_put_str(dict, "str", addr->u.fd.str);
break;
case SOCKET_ADDRESS_TYPE_VSOCK:
qdict_put_str(dict, "type", "vsock");
qdict_put_str(dict, "cid", addr->u.vsock.cid);
qdict_put_str(dict, "port", addr->u.vsock.port);
break;
default:
g_assert_not_reached();
break;
}
return dict;
}
>
> Regards,
>
> Het Gala
next prev parent reply other threads:[~2024-03-07 12:30 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-06 10:49 [PATCH v3 0/7] qtest: migration: Add tests for introducing 'channels' argument in migrate QAPIs Het Gala
2024-03-06 10:49 ` [PATCH v3 1/7] Add 'to' object into migrate_qmp() Het Gala
2024-03-06 14:37 ` Fabiano Rosas
2024-03-06 10:49 ` [PATCH v3 2/7] Replace connect_uri and move migrate_get_socket_address inside migrate_qmp Het Gala
2024-03-06 14:37 ` Fabiano Rosas
2024-03-06 10:49 ` [PATCH v3 3/7] Add channels parameter in migrate_qmp_fail Het Gala
2024-03-06 14:40 ` Fabiano Rosas
2024-03-06 15:10 ` Het Gala
2024-03-06 10:49 ` [PATCH v3 4/7] Add migrate_set_ports into migrate_qmp to change migration port number Het Gala
2024-03-06 14:36 ` Fabiano Rosas
2024-03-06 15:06 ` Het Gala
2024-03-06 16:01 ` Fabiano Rosas
2024-03-06 19:36 ` Het Gala
2024-03-06 21:30 ` Het Gala
2024-03-07 11:37 ` Fabiano Rosas [this message]
2024-03-06 10:49 ` [PATCH v3 5/7] Add channels parameter in migrate_qmp Het Gala
2024-03-06 14:42 ` Fabiano Rosas
2024-03-06 15:31 ` Het Gala
2024-03-06 10:49 ` [PATCH v3 6/7] Add multifd_tcp_plain test using list of channels instead of uri Het Gala
2024-03-06 15:07 ` Fabiano Rosas
2024-03-06 18:40 ` Het Gala
2024-03-06 10:49 ` [PATCH v3 7/7] Add negative tests to validate migration QAPIs Het Gala
2024-03-06 15:08 ` Fabiano Rosas
2024-03-06 12:55 ` [PATCH v3 0/7] qtest: migration: Add tests for introducing 'channels' argument in migrate QAPIs Het Gala
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=87ttliqnma.fsf@suse.de \
--to=farosas@suse.de \
--cc=het.gala@nutanix.com \
--cc=lvivier@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=thuth@redhat.com \
/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).