qemu: Report more accurate error on failure to attach device.

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.

Signed-off-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
Hu Tao 2011-01-27 15:21:42 +08:00 committed by Eric Blake
parent f15cad2916
commit cdbba1c496
2 changed files with 3 additions and 1 deletions

View File

@ -1496,6 +1496,9 @@ 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_CONFIG_UNSUPPORTED,
_("Unknown controller type: %s"),
virDomainControllerTypeToString(def->type));
goto error;
}

View File

@ -260,7 +260,6 @@ int qemuDomainAttachPciControllerDevice(struct qemud_driver *driver,
goto cleanup;
if (!(devstr = qemuBuildControllerDevStr(controller))) {
virReportOOMError();
goto cleanup;
}
}