Skip to contentSkip to conversation

balloon: improve error msg when adding second device

PATCH Applied Luiz Capitulino 3 participants 4 messages Mar 31, 2015 – Apr 25, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 balloon: improve error msg when adding second device

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"
    }
}

---

I think this can go through in via -trivial. I also think this is so simple and useful that it could be merged during freeze.

 balloon.c                  | 1 -
 hw/virtio/virtio-balloon.c | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)
balloon.c +0 -1
index 70c00f5..c7033e3 100644
@@ -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;
hw/virtio/virtio-balloon.c +1 -1
index 95b0643..484c3c3 100644
@@ -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;
     }
Signature · 1 line
1.9.3
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Luiz Capitulino

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

After this fix

[nice comparison snipped]

Quoted 11 lines

---

I think this can go through in via -trivial. I also think this is so simple and useful that it could be merged during freeze.

 balloon.c                  | 1 -
 hw/virtio/virtio-balloon.c | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)
Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
#2 lore raw
In reply to Luiz Capitulino
Quoted 3 lines · Luiz Capitulino

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.

...
Heh. Such a huge commit message ;)

Applied to -trivial now. In the large commit text I missed your comment about the patch is okay to go during the freeze, so doing it after :)

Thanks,

/mjt

#3 lore raw
Quoted 10 lines · On Sat, 25 Apr 2015 09:12:58 +0300 Michael Tokarev <[email protected]> wrote:
Quoted 3 lines · Luiz Capitulino

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.

...
Heh. Such a huge commit message ;)

Applied to -trivial now. In the large commit text I missed your comment about the patch is okay to go during the freeze, so doing it after :)

I've applied it to my own tree and posted a pull request already.