qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 3/3] virtio-balloon: report error if balloon driver


From: Amit Shah
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

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 <address@hidden>
---
 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




reply via email to

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