All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Het Gala <het.gala@nutanix.com>
Cc: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	Prerna Saxena <prerna.saxena@nutanix.com>,
	"quintela@redhat.com" <quintela@redhat.com>,
	"dgilbert@redhat.com" <dgilbert@redhat.com>,
	"pbonzini@redhat.com" <pbonzini@redhat.com>,
	"armbru@redhat.com" <armbru@redhat.com>,
	"eblake@redhat.com" <eblake@redhat.com>,
	Manish Mishra <manish.mishra@nutanix.com>,
	Aravind Retnakaran <aravind.retnakaran@nutanix.com>
Subject: Re: [PATCH v9 06/10] migration: New migrate and migrate-incoming argument 'channels'
Date: Wed, 26 Jul 2023 09:35:53 +0100	[thread overview]
Message-ID: <ZMDa6WNFeylS00QK@redhat.com> (raw)
In-Reply-To: <f5109fbe-ce45-020d-fcb7-e32892d9135d@nutanix.com>

On Wed, Jul 26, 2023 at 01:24:48AM +0530, Het Gala wrote:
> Sorry, last reply on this patch was accidently replied only to Daniel.
> Pasting the reply again so it is received by all the active maintianers
> here. Apologies for the error 😅
> 
> On 26/07/23 12:07 am, Daniel P. Berrangé wrote:
> > On Tue, Jul 25, 2023 at 07:34:09PM +0100, Daniel P. Berrangé wrote:
> > > On Fri, Jul 21, 2023 at 02:49:31PM +0000, Het Gala wrote:
> > > > MigrateChannelList allows to connect accross multiple interfaces.
> > > > Add MigrateChannelList struct as argument to migration QAPIs.
> > > > 
> > > > We plan to include multiple channels in future, to connnect
> > > > multiple interfaces. Hence, we choose 'MigrateChannelList'
> > > > as the new argument over 'MigrateChannel' to make migration
> > > > QAPIs future proof.
> > > > 
> > > > Suggested-by: Aravind Retnakaran <aravind.retnakaran@nutanix.com>
> > > > Signed-off-by: Het Gala <het.gala@nutanix.com>
> > > > Acked-by: Markus Armbruster <armbru@redhat.com>
> > > > ---
> > > >   migration/migration-hmp-cmds.c |   6 +-
> > > >   migration/migration.c          |  34 ++++++++--
> > > >   qapi/migration.json            | 109 ++++++++++++++++++++++++++++++++-
> > > >   softmmu/vl.c                   |   2 +-
> > > >   4 files changed, 139 insertions(+), 12 deletions(-)
> > > > 
> > > > diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c
> > > > index 9885d7c9f7..49b150f33f 100644
> > > > --- a/migration/migration-hmp-cmds.c
> > > > +++ b/migration/migration-hmp-cmds.c
> > > > @@ -424,7 +424,7 @@ void hmp_migrate_incoming(Monitor *mon, const QDict *qdict)
> > > >       Error *err = NULL;
> > > >       const char *uri = qdict_get_str(qdict, "uri");
> > > > -    qmp_migrate_incoming(uri, &err);
> > > > +    qmp_migrate_incoming(uri, false, NULL, &err);
> > > >       hmp_handle_error(mon, err);
> > > >   }
> > > > @@ -705,8 +705,8 @@ void hmp_migrate(Monitor *mon, const QDict *qdict)
> > > >       const char *uri = qdict_get_str(qdict, "uri");
> > > >       Error *err = NULL;
> > > > -    qmp_migrate(uri, !!blk, blk, !!inc, inc,
> > > > -                false, false, true, resume, &err);
> > > > +    qmp_migrate(uri, false, NULL, !!blk, blk, !!inc, inc,
> > > > +                 false, false, true, resume, &err);
> > > >       if (hmp_handle_error(mon, err)) {
> > > >           return;
> > > >       }
> > > > diff --git a/migration/migration.c b/migration/migration.c
> > > > index f37b388876..bd3a93fc8c 100644
> > > > --- a/migration/migration.c
> > > > +++ b/migration/migration.c
> > > > @@ -466,10 +466,22 @@ static bool migrate_uri_parse(const char *uri,
> > > >       return true;
> > > >   }
> > > > -static void qemu_start_incoming_migration(const char *uri, Error **errp)
> > > > +static void qemu_start_incoming_migration(const char *uri, bool has_channels,
> > > > +                                          MigrationChannelList *channels,
> > > > +                                          Error **errp)
> > > >   {
> > > >       g_autoptr(MigrationAddress) channel = g_new0(MigrationAddress, 1);
> > > > +    /*
> > > > +     * Having preliminary checks for uri and channel
> > > > +     */
> > > > +    if (uri && has_channels) {
> > > > +        error_setg(errp, "'uri' and 'channels' arguments are mutually "
> > > > +                   "exclusive; exactly one of the two should be present in "
> > > > +                   "'migrate-incoming' qmp command ");
> > > > +        return;
> > > > +    }
> > > This checks is both are present.
> > > 
> > > Also needs a check if neither are present as that's invalid.
> > Also it should (temporarily) raise an error if "has_channels" is
> > set, as while we've added the parameter in QAPI, we've not
> > implemented it yet. IOW, raise an error now, and remove the
> > error in a later patch.
> Ack. So in total there should be 3 checks right. 1) if 'has_channels' is
> set, 2) if 'uri' and 'channels' both are present, 3) if 'uri' and 'channels'
> both are absent. Basically right now only uri should allowed and should
> atleast be present.

Correct.

> I think overall only 1) would be enough and should be checked before
> 'migration_channels_and_uri_compatible()' and if 'has_channels' is set, just
> return for now. With this 2) would not be necessary or not come into play in
> this patch. 3) will be taken care by
> 'migration_channels_and_uri_compatible()' itself IMO.

I think all the checks should be in this method, as it is the entrypoint
for execution of the QMP command and thus where parameter validation
should live. Spreading it across methods will make it very easy to open
bugs by refactoring code and not realizing the new codepaths don't do
the right checks.

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



  reply	other threads:[~2023-07-26  8:36 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-21 14:49 [PATCH v9 00/10] migration: Modify 'migrate' and 'migrate-incoming' QAPI commands for migration Het Gala
2023-07-21 14:49 ` [PATCH v9 01/10] migration: New QAPI type 'MigrateAddress' Het Gala
2023-07-21 14:49 ` [PATCH v9 02/10] migration: convert migration 'uri' into 'MigrateAddress' Het Gala
2023-07-21 14:49 ` [PATCH v9 03/10] migration: convert socket backend to accept MigrateAddress Het Gala
2023-07-21 14:49 ` [PATCH v9 04/10] migration: convert rdma " Het Gala
2023-07-21 14:49 ` [PATCH v9 05/10] migration: convert exec " Het Gala
2023-07-21 14:49 ` [PATCH v9 06/10] migration: New migrate and migrate-incoming argument 'channels' Het Gala
2023-07-25 18:34   ` Daniel P. Berrangé
2023-07-25 18:37     ` Daniel P. Berrangé
2023-07-25 19:32       ` Het Gala
2023-07-25 19:54       ` Het Gala
2023-07-26  8:35         ` Daniel P. Berrangé [this message]
2023-07-26 10:02           ` Het Gala
2023-07-21 14:49 ` [PATCH v9 07/10] migration: modify migration_channels_and_uri_compatible() for new QAPI syntax Het Gala
2023-07-21 14:49 ` [PATCH v9 08/10] migration: Implement MigrateChannelList to qmp migration flow Het Gala
2023-07-25 18:38   ` Daniel P. Berrangé
2023-07-25 19:49     ` Het Gala
2023-07-21 14:49 ` [PATCH v9 09/10] migration: Implement MigrateChannelList to hmp " Het Gala
2023-07-25 19:15   ` Daniel P. Berrangé
2023-07-25 19:51     ` Het Gala
2023-07-21 14:49 ` [PATCH v9 10/10] migration: modify test_multifd_tcp_none() to use new QAPI syntax Het Gala
2023-07-25 19:15   ` Daniel P. Berrangé

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=ZMDa6WNFeylS00QK@redhat.com \
    --to=berrange@redhat.com \
    --cc=aravind.retnakaran@nutanix.com \
    --cc=armbru@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=eblake@redhat.com \
    --cc=het.gala@nutanix.com \
    --cc=manish.mishra@nutanix.com \
    --cc=pbonzini@redhat.com \
    --cc=prerna.saxena@nutanix.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.