}
try_command:
- ret = virAsprintf(&cmd, "drive_add %s%.2x:%.2x:%.2x %s",
- (tryOldSyntax ? "" : "pci_addr="),
- controllerAddr->domain, controllerAddr->bus,
- controllerAddr->slot, safe_str);
- if (ret == -1) {
+ if (virAsprintf(&cmd, "drive_add %s%.2x:%.2x:%.2x %s",
+ (tryOldSyntax ? "" : "pci_addr="),
+ controllerAddr->domain, controllerAddr->bus,
+ controllerAddr->slot, safe_str) < 0) {
virReportOOMError();
goto cleanup;
}
goto cleanup;
}
+ if (strstr(reply, "unknown command:")) {
+ qemuReportError(VIR_ERR_OPERATION_FAILED, "%s",
+ _("drive hotplug is not supported"));
+ goto cleanup;
+ }
+
if (qemudParseDriveAddReply(reply, driveAddr) < 0) {
if (!tryOldSyntax && strstr(reply, "invalid char in expression")) {
VIR_FREE(reply);
/* 'dummy' here is just a placeholder since there is no PCI
* address required when attaching drives to a controller */
- ret = virAsprintf(&cmd, "drive_add dummy %s", safe_str);
- if (ret == -1) {
+ if (virAsprintf(&cmd, "drive_add dummy %s", safe_str) < 0) {
virReportOOMError();
goto cleanup;
}
goto cleanup;
}
+ if (strstr(reply, "unknown command:")) {
+ qemuReportError(VIR_ERR_OPERATION_FAILED, "%s",
+ _("drive hotplug is not supported"));
+ goto cleanup;
+ }
+
ret = 0;
cleanup:
return -1;
}
- ret = virAsprintf(&cmd, "block_passwd %s%s \"%s\"", QEMU_DRIVE_HOST_PREFIX, alias, safe_str);
- if (ret == -1) {
+ if (virAsprintf(&cmd, "block_passwd %s%s \"%s\"",
+ QEMU_DRIVE_HOST_PREFIX, alias, safe_str) < 0) {
virReportOOMError();
goto cleanup;
}