From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: jasowang@redhat.com, qemu-devel@nongnu.org, laine@redhat.com,
armbru@redhat.com
Subject: Re: [Qemu-devel] [PATCH v3 3/4] net/announce: Add optional ID
Date: Wed, 12 Jun 2019 16:32:40 +0100 [thread overview]
Message-ID: <20190612153239.GE2691@work-vm> (raw)
In-Reply-To: <e602e259-f5db-c73a-7a4e-f63a2d48e85c@redhat.com>
* Eric Blake (eblake@redhat.com) wrote:
> On 6/10/19 1:44 PM, Dr. David Alan Gilbert (git) wrote:
> > From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> >
> > Previously there was a single instance of the timer used by
> > monitor triggered announces, that's OK, but when combined with the
> > previous change that lets you have announces for subsets of interfaces
> > it's a bit restrictive if you want to do different things to different
> > interfaces.
> >
> > Add an 'id' field to the announce, and maintain a list of the
> > timers based on id.
> >
> > This allows you to for example:
> > a) Start an announce going on interface eth0 for a long time
> > b) Start an announce going on interface eth1 for a long time
> > c) Kill the announce on eth0 while leaving eth1 going.
> >
> > Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> > ---
>
> > +++ b/include/net/announce.h
> > @@ -23,8 +23,12 @@ struct AnnounceTimer {
> > /* Returns: update the timer to the next time point */
> > int64_t qemu_announce_timer_step(AnnounceTimer *timer);
> >
> > -/* Delete the underlying timer and other data */
> > -void qemu_announce_timer_del(AnnounceTimer *timer);
> > +/*
> > + * Delete the underlying timer and other datas
>
> 'data' is already plural, 'datas' is not a word.
oops yes, fixed.
> > + * If 'free_named' true and the timer is a named timer, then remove
> > + * it from the list of named timers and free the AnnounceTimer itself.
> > + */
> > +void qemu_announce_timer_del(AnnounceTimer *timer, bool free_named);
> >
>
> > +++ b/qapi/net.json
> > @@ -702,6 +702,10 @@
> > # @interfaces: An optional list of interface names, which restrict the
> > # announcment to the listed interfaces. (Since 4.1)
> > #
> > +# @id: A name to be used to identify an instance of announce-timers
> > +# and to allow it to modified later. Not for use as
> > +# part of the migration paramters. (Since 4.1)
>
> parameters
Fixed.
> > +#
> > # Since: 4.0
> > ##
> >
> > @@ -710,7 +714,8 @@
> > 'max': 'int',
> > 'rounds': 'int',
> > 'step': 'int',
> > - '*interfaces': ['str'] } }
> > + '*interfaces': ['str'],
> > + '*id' : 'str' } }
> >
> > ##
> > # @announce-self:
> > @@ -725,7 +730,7 @@
> > # -> { "execute": "announce-self",
> > # "arguments": {
> > # "initial": 50, "max": 550, "rounds": 10, "step": 50,
> > -# "interfaces": ["vn2","vn3"] } }
> > +# "interfaces": ["vn2","vn3"], "id": "bob" } }
> > # <- { "return": {} }
> > #
>
> Worth an example of deleting a timer by id?
>
The syntax is actually the same - the only thing you need to do
to cancel is set 'rounds' to 0 for the named id.
> > # Since: 4.0
> > diff --git a/tests/virtio-net-test.c b/tests/virtio-net-test.c
> > index 163126cf07..7184e2bff4 100644
> > --- a/tests/virtio-net-test.c
> > +++ b/tests/virtio-net-test.c
> > @@ -186,7 +186,7 @@ static void announce_self(void *obj, void *data, QGuestAllocator *t_alloc)
> > rsp = qmp("{ 'execute' : 'announce-self', "
> > " 'arguments': {"
> > " 'initial': 50, 'max': 550,"
> > - " 'rounds': 10, 'step': 50 } }");
> > + " 'rounds': 10, 'step': 50, 'id': 'bob' } }");
>
> And here, is it worth testing that you can delete by id, rather than
> just create with an id?
OK, I'll have a look at how painful that is.
Dave
> > assert(!qdict_haskey(rsp, "error"));
> > qobject_unref(rsp);
> >
> >
>
> --
> Eric Blake, Principal Software Engineer
> Red Hat, Inc. +1-919-301-3226
> Virtualization: qemu.org | libvirt.org
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
next prev parent reply other threads:[~2019-06-12 15:37 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-10 18:43 [Qemu-devel] [PATCH v3 0/4] network announce; interface selection & IDs Dr. David Alan Gilbert (git)
2019-06-10 18:43 ` [Qemu-devel] [PATCH v3 1/4] net/announce: Allow optional list of interfaces Dr. David Alan Gilbert (git)
2019-06-10 19:47 ` Eric Blake
2019-06-11 10:36 ` Dr. David Alan Gilbert
2019-06-10 18:44 ` [Qemu-devel] [PATCH v3 2/4] net/announce: Add HMP optional interface list Dr. David Alan Gilbert (git)
2019-06-10 18:44 ` [Qemu-devel] [PATCH v3 3/4] net/announce: Add optional ID Dr. David Alan Gilbert (git)
2019-06-10 19:53 ` Eric Blake
2019-06-12 15:32 ` Dr. David Alan Gilbert [this message]
2019-06-10 18:44 ` [Qemu-devel] [PATCH v3 4/4] net/announce: Add HMP " Dr. David Alan Gilbert (git)
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=20190612153239.GE2691@work-vm \
--to=dgilbert@redhat.com \
--cc=armbru@redhat.com \
--cc=eblake@redhat.com \
--cc=jasowang@redhat.com \
--cc=laine@redhat.com \
--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).