qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Amit Shah <amit.shah@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: qemu list <qemu-devel@nongnu.org>, Markus Armbruster <armbru@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 2/2] virtio-balloon: Check if balloon registration failed
Date: Wed, 27 Jul 2011 15:04:14 +0530	[thread overview]
Message-ID: <20110727093414.GA27716@amit-x200.redhat.com> (raw)
In-Reply-To: <20110727090632.GA31946@redhat.com>

On (Wed) 27 Jul 2011 [12:06:32], Michael S. Tsirkin wrote:
> On Wed, Jul 27, 2011 at 12:31:08PM +0530, Amit Shah wrote:
> > Multiple balloon registrations are not allowed; check if the
> > registration with the qemu balloon api succeeded.  If not, fail the
> > device init.
> > 
> > Signed-off-by: Amit Shah <amit.shah@redhat.com>
> > ---
> >  hw/virtio-balloon.c |   10 +++++++++-
> >  hw/virtio-pci.c     |    3 +++
> >  2 files changed, 12 insertions(+), 1 deletions(-)
> > 
> > diff --git a/hw/virtio-balloon.c b/hw/virtio-balloon.c
> > index 2ba7e95..304a31a 100644
> > --- a/hw/virtio-balloon.c
> > +++ b/hw/virtio-balloon.c
> > @@ -269,6 +269,7 @@ static int virtio_balloon_load(QEMUFile *f, void *opaque, int version_id)
> >  VirtIODevice *virtio_balloon_init(DeviceState *dev)
> >  {
> >      VirtIOBalloon *s;
> > +    int ret;
> >  
> >      s = (VirtIOBalloon *)virtio_common_init("virtio-balloon",
> >                                              VIRTIO_ID_BALLOON,
> > @@ -278,12 +279,19 @@ VirtIODevice *virtio_balloon_init(DeviceState *dev)
> >      s->vdev.set_config = virtio_balloon_set_config;
> >      s->vdev.get_features = virtio_balloon_get_features;
> >  
> > +    ret = qemu_add_balloon_handler(virtio_balloon_to_target,
> > +                                   virtio_balloon_stat, s);
> > +    if (ret < 0) {
> > +        error_report("Another balloon device already registered");
> 
> We don't know why it failed at this point. I think
> error report should be triggered by qemu_add_balloon_handler,
> and this function would just cleanup and exit.

OK, makes sense.

		Amit

      reply	other threads:[~2011-07-27  9:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-27  7:01 [Qemu-devel] [PATCH 1/2] balloon: Don't allow multiple balloon handler registrations Amit Shah
2011-07-27  7:01 ` [Qemu-devel] [PATCH 2/2] virtio-balloon: Check if balloon registration failed Amit Shah
2011-07-27  9:06   ` Michael S. Tsirkin
2011-07-27  9:34     ` Amit Shah [this message]

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=20110727093414.GA27716@amit-x200.redhat.com \
    --to=amit.shah@redhat.com \
    --cc=armbru@redhat.com \
    --cc=mst@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).