From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:58372) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RYyxj-00059o-QL for qemu-devel@nongnu.org; Fri, 09 Dec 2011 06:50:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RYyxi-0008VV-22 for qemu-devel@nongnu.org; Fri, 09 Dec 2011 06:49:59 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48590) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RYyxh-0008VQ-RU for qemu-devel@nongnu.org; Fri, 09 Dec 2011 06:49:58 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id pB9BnvNE006236 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 9 Dec 2011 06:49:57 -0500 From: Amit Shah Date: Fri, 9 Dec 2011 17:19:38 +0530 Message-Id: In-Reply-To: References: In-Reply-To: References: Subject: [Qemu-devel] [PATCH 3/3] virtio-balloon: report error if balloon driver in guest not available List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu list Cc: Amit Shah , Markus Armbruster , Luiz Capitulino 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 --- 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