On Thu, 2009-09-24 at 16:00 +0100, Daniel P. Berrange wrote:
* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Add new
qemuMonitorAddUSBDisk() API
* src/qemu/qemu_driver.c: Switch USB disk hotplug to the new
src/qemu/qemu_driver.c API.
---
src/qemu/qemu_driver.c | 41 ++++++---------------------------------
src/qemu/qemu_monitor_text.c | 43 ++++++++++++++++++++++++++++++++++++++++++
src/qemu/qemu_monitor_text.h | 4 +++
3 files changed, 54 insertions(+), 34 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index da08af9..635fb84 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4698,59 +4698,32 @@ static int qemudDomainAttachUsbMassstorageDevice(virConnectPtr
conn,
virDomainObjPtr vm,
virDomainDeviceDefPtr dev)
{
- int ret, i;
- char *safe_path;
- char *cmd, *reply;
+ int i;
for (i = 0 ; i < vm->def->ndisks ; i++) {
if (STREQ(vm->def->disks[i]->dst, dev->data.disk->dst)) {
- qemudReportError(conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
+ qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
_("target %s already exists"),
dev->data.disk->dst);
return -1;
}
}
- if (VIR_REALLOC_N(vm->def->disks, vm->def->ndisks+1) < 0) {
- virReportOOMError(conn);
- return -1;
- }
-
- safe_path = qemudEscapeMonitorArg(dev->data.disk->src);
- if (!safe_path) {
- virReportOOMError(conn);
+ if (!dev->data.disk->src) {
+ qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ "%s", _("disk source path is missing"));
That check is new, but okay
ACK
Cheers,
Mark.