[libvirt] [PATCH] Report error more accurate if failes on attaching device.

Hu Tao hutao at cn.fujitsu.com
Thu Jan 27 07:21:42 UTC 2011


When attaching device from a xml file and the device is mis-configured,
virsh gives mis-leading message "out of memory". This patch fixes this.
---
 src/qemu/qemu_command.c |    2 ++
 src/qemu/qemu_hotplug.c |    1 -
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 6dc586f..303063a 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -1496,6 +1496,8 @@ qemuBuildControllerDevStr(virDomainControllerDefPtr def)
     /* We always get an IDE controller, whether we want it or not. */
     case VIR_DOMAIN_CONTROLLER_TYPE_IDE:
     default:
+        qemuReportError(VIR_ERR_INTERNAL_ERROR, "Unknown controller type: %s\n",
+                        virDomainControllerTypeToString(def->type));
         goto error;
     }
 
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 8be993b..ca81a3d 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -260,7 +260,6 @@ int qemuDomainAttachPciControllerDevice(struct qemud_driver *driver,
             goto cleanup;
 
         if (!(devstr = qemuBuildControllerDevStr(controller))) {
-            virReportOOMError();
             goto cleanup;
         }
     }
-- 
1.7.3.1




More information about the libvir-list mailing list