From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56958) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yliqs-0006HN-7Y for qemu-devel@nongnu.org; Fri, 24 Apr 2015 15:01:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yliqr-00025r-3f for qemu-devel@nongnu.org; Fri, 24 Apr 2015 15:01:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39248) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yliqq-00025c-SU for qemu-devel@nongnu.org; Fri, 24 Apr 2015 15:01:25 -0400 From: Luiz Capitulino Date: Fri, 24 Apr 2015 15:01:15 -0400 Message-Id: <1429902078-21770-2-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1429902078-21770-1-git-send-email-lcapitulino@redhat.com> References: <1429902078-21770-1-git-send-email-lcapitulino@redhat.com> Subject: [Qemu-devel] [PULL 1/4] balloon: improve error msg when adding second device List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: peter.maydell@linaro.org Cc: qemu-devel@nongnu.org A VM supports only one balloon device, but due to several changes in infrastructure the error message got messed up when trying to add a second device. Fix it. Before this fix Command-line: qemu-qmp: -device virtio-balloon-pci,id=balloon0: Another balloon device already registered qemu-qmp: -device virtio-balloon-pci,id=balloon0: Adding balloon handler failed qemu-qmp: -device virtio-balloon-pci,id=balloon0: Device 'virtio-balloon-pci' could not be initialized HMP: Another balloon device already registered Adding balloon handler failed Device 'virtio-balloon-pci' could not be initialized QMP: { "execute": "device_add", "arguments": { "driver": "virtio-balloon-pci", "id": "balloon0" } } { "error": { "class": "GenericError", "desc": "Adding balloon handler failed" } } After this fix Command-line: qemu-qmp: -device virtio-balloon-pci,id=balloon0: Only one balloon device is supported qemu-qmp: -device virtio-balloon-pci,id=balloon0: Device 'virtio-balloon-pci' could not be initialized HMP: (qemu) device_add virtio-balloon-pci,id=balloon0 Only one balloon device is supported Device 'virtio-balloon-pci' could not be initialized (qemu) QMP: { "execute": "device_add", "arguments": { "driver": "virtio-balloon-pci", "id": "balloon0" } } { "error": { "class": "GenericError", "desc": "Only one balloon device is supported" } } Signed-off-by: Luiz Capitulino Reviewed-by: Eric Blake --- balloon.c | 1 - hw/virtio/virtio-balloon.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/balloon.c b/balloon.c index 70c00f5..c7033e3 100644 --- a/balloon.c +++ b/balloon.c @@ -58,7 +58,6 @@ int qemu_add_balloon_handler(QEMUBalloonEvent *event_func, /* We're already registered one balloon handler. How many can * a guest really have? */ - error_report("Another balloon device already registered"); return -1; } balloon_event_fn = event_func; diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c index 95b0643..484c3c3 100644 --- a/hw/virtio/virtio-balloon.c +++ b/hw/virtio/virtio-balloon.c @@ -383,7 +383,7 @@ static void virtio_balloon_device_realize(DeviceState *dev, Error **errp) virtio_balloon_stat, s); if (ret < 0) { - error_setg(errp, "Adding balloon handler failed"); + error_setg(errp, "Only one balloon device is supported"); virtio_cleanup(vdev); return; } -- 1.9.3