qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 2/2] virtio-balloon: Check if balloon registrati


From: Amit Shah
Subject: Re: [Qemu-devel] [PATCH 2/2] virtio-balloon: Check if balloon registration failed
Date: Wed, 27 Jul 2011 15:04:14 +0530
User-agent: Mutt/1.5.21 (2010-09-15)

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 <address@hidden>
> > ---
> >  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 via email to

[Prev in Thread] Current Thread [Next in Thread]