qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Amit Shah <amit.shah@redhat.com>
To: qemu list <qemu-devel@nongnu.org>
Cc: Amit Shah <amit.shah@redhat.com>,
	Markus Armbruster <armbru@redhat.com>,
	Luiz Capitulino <lcapitulino@redhat.com>
Subject: [Qemu-devel] [PATCH 3/3] virtio-balloon: report error if balloon driver in guest not available
Date: Fri,  9 Dec 2011 17:19:38 +0530	[thread overview]
Message-ID: <b0ec9bbd66e4e3a41292042f44ddb0b3b72e254c.1323431084.git.amit.shah@redhat.com> (raw)
In-Reply-To: <cover.1323431083.git.amit.shah@redhat.com>
In-Reply-To: <cover.1323431083.git.amit.shah@redhat.com>

The guest may not have the balloon driver initialised or may have it
disabled.  Report an error to the user in such a case when a request for
ballooning arrives.

This also solves another issue where a previous request for ballooning
failed (e.g., for the reason mentioned above), but the config was still
updated, resulting in the ballooning value being applied to the guest
after the guest loads the balloon module.  This may not be the desirable
thing to do at this later stage.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
---
 hw/virtio-balloon.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/hw/virtio-balloon.c b/hw/virtio-balloon.c
index a8ecb51..d692813 100644
--- a/hw/virtio-balloon.c
+++ b/hw/virtio-balloon.c
@@ -184,6 +184,9 @@ static int virtio_balloon_to_target(void *opaque, ram_addr_t target)
 {
     VirtIOBalloon *dev = opaque;
 
+    if (!(dev->vdev.status & VIRTIO_CONFIG_S_DRIVER_OK)) {
+        return -ENODEV;
+    }
     if (target > ram_size) {
         target = ram_size;
     }
-- 
1.7.7.3

  parent reply	other threads:[~2011-12-09 11:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-09 11:49 [Qemu-devel] [PATCH 0/3] balloon: error if guest driver is not initialised Amit Shah
2011-12-09 11:49 ` [Qemu-devel] [PATCH 1/3] balloon: Make functions return 0 on OK, -1 on error Amit Shah
2011-12-09 11:49 ` [Qemu-devel] [PATCH 2/3] balloon: report error if ballooning operation fails Amit Shah
2011-12-09 11:49 ` Amit Shah [this message]
2011-12-09 11:55 ` [Qemu-devel] [PATCH 0/3] balloon: error if guest driver is not initialised Daniel P. Berrange
2011-12-09 12:02   ` Amit Shah

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=b0ec9bbd66e4e3a41292042f44ddb0b3b72e254c.1323431084.git.amit.shah@redhat.com \
    --to=amit.shah@redhat.com \
    --cc=armbru@redhat.com \
    --cc=lcapitulino@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).