int
qemuMonitorTextStopCPUs(qemuMonitorPtr mon) {
char *info;
+ int ret;
- if (qemuMonitorHMPCommand(mon, "stop", &info) < 0) {
- virReportError(VIR_ERR_OPERATION_FAILED,
- "%s", _("cannot stop CPU execution"));
- return -1;
- }
+ ret = qemuMonitorHMPCommand(mon, "stop", &info);
VIR_FREE(info);
- return 0;
+ return ret;
}
if (reason)
*reason = VIR_DOMAIN_PAUSED_UNKNOWN;
- if (qemuMonitorHMPCommand(mon, "info status", &reply) < 0) {
- virReportError(VIR_ERR_OPERATION_FAILED,
- "%s", _("cannot get status info"));
+ if (qemuMonitorHMPCommand(mon, "info status", &reply) < 0)
return -1;
- }
if (strstr(reply, "running")) {
*running = true;
int qemuMonitorTextSystemPowerdown(qemuMonitorPtr mon) {
char *info;
+ int ret;
+
+ ret = qemuMonitorHMPCommand(mon, "system_powerdown", &info);
- if (qemuMonitorHMPCommand(mon, "system_powerdown", &info) < 0) {
- virReportError(VIR_ERR_OPERATION_FAILED,
- "%s", _("system shutdown operation failed"));
- return -1;
- }
VIR_FREE(info);
- return 0;
+ return ret;
}
int qemuMonitorTextSetLink(qemuMonitorPtr mon, const char *name, enum virDomainNetInterfaceLinkState state) {
virReportOOMError();
goto error;
}
- if (qemuMonitorHMPCommand(mon, cmd, &info) < 0) {
- virReportError(VIR_ERR_OPERATION_FAILED,
- "%s", _("set_link operation failed"));
+ if (qemuMonitorHMPCommand(mon, cmd, &info) < 0)
goto error;
- }
/* check if set_link command is supported */
if (strstr(info, "\nunknown ")) {
int qemuMonitorTextSystemReset(qemuMonitorPtr mon) {
char *info;
+ int ret;
+
+ ret = qemuMonitorHMPCommand(mon, "system_reset", &info);
- if (qemuMonitorHMPCommand(mon, "system_reset", &info) < 0) {
- virReportError(VIR_ERR_OPERATION_FAILED,
- "%s", _("system reset operation failed"));
- return -1;
- }
VIR_FREE(info);
- return 0;
+ return ret;
}
pid_t *cpupids = NULL;
size_t ncpupids = 0;
- if (qemuMonitorHMPCommand(mon, "info cpus", &qemucpus) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("cannot run monitor command to fetch CPU thread info"));
+ if (qemuMonitorHMPCommand(mon, "info cpus", &qemucpus) < 0)
return -1;
- }
/*
* This is the gross format we're about to parse :-{
*virtType = VIR_DOMAIN_VIRT_QEMU;
- if (qemuMonitorHMPCommand(mon, "info kvm", &reply) < 0) {
- virReportError(VIR_ERR_OPERATION_FAILED,
- "%s", _("could not query kvm status"));
+ if (qemuMonitorHMPCommand(mon, "info kvm", &reply) < 0)
return -1;
- }
if (strstr(reply, "enabled"))
*virtType = VIR_DOMAIN_VIRT_KVM;
int ret = -1;
char *offset;
- if (qemuMonitorHMPCommand(mon, "info balloon", &reply) < 0) {
- virReportError(VIR_ERR_OPERATION_FAILED,
- "%s", _("could not query memory balloon allocation"));
+ if (qemuMonitorHMPCommand(mon, "info balloon", &reply) < 0)
return -1;
- }
if ((offset = strstr(reply, BALLOON_PREFIX)) != NULL) {
offset += strlen(BALLOON_PREFIX);
int ret = 0;
char *offset;
- if (qemuMonitorHMPCommand(mon, "info balloon", &reply) < 0) {
- virReportError(VIR_ERR_OPERATION_FAILED,
- "%s", _("could not query memory balloon statistics"));
+ if (qemuMonitorHMPCommand(mon, "info balloon", &reply) < 0)
return -1;
- }
if ((offset = strstr(reply, BALLOON_PREFIX)) != NULL) {
offset += strlen(BALLOON_PREFIX);
char *dev;
int tmp;
- if (qemuMonitorHMPCommand(mon, "info block", &reply) < 0) {
- virReportError(VIR_ERR_OPERATION_FAILED,
- "%s", _("info block command failed"));
+ if (qemuMonitorHMPCommand(mon, "info block", &reply) < 0)
goto cleanup;
- }
if (strstr(reply, "\ninfo ")) {
virReportError(VIR_ERR_OPERATION_INVALID,
const char *p, *eol;
int devnamelen = strlen(dev_name);
- if (qemuMonitorHMPCommand (mon, "info blockstats", &info) < 0) {
- virReportError(VIR_ERR_OPERATION_FAILED,
- "%s", _("'info blockstats' command failed"));
+ if (qemuMonitorHMPCommand (mon, "info blockstats", &info) < 0)
goto cleanup;
- }
/* If the command isn't supported then qemu prints the supported
* info commands, so the output starts "info ". Since this is
int num = 0;
const char *p, *eol;
- if (qemuMonitorHMPCommand (mon, "info blockstats", &info) < 0) {
- virReportError(VIR_ERR_OPERATION_FAILED,
- "%s", _("'info blockstats' command failed"));
+ if (qemuMonitorHMPCommand (mon, "info blockstats", &info) < 0)
goto cleanup;
- }
/* If the command isn't supported then qemu prints the supported
* info commands, so the output starts "info ". Since this is
goto cleanup;
}
- if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) {
- virReportError(VIR_ERR_OPERATION_FAILED,
- "%s", _("failed to resize block"));
+ if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
goto cleanup;
- }
if (strstr(reply, "unknown command:")) {
ret = -2;
goto cleanup;
}
- if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) {
- virReportError(VIR_ERR_OPERATION_FAILED,
- "%s", _("setting password failed"));
+ if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
goto cleanup;
- }
if (strstr(reply, "unknown command:")) {
ret = -2;
goto cleanup;
}
- if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) {
- virReportError(VIR_ERR_OPERATION_FAILED,
- "%s", _("expiring password failed"));
+ if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
goto cleanup;
- }
if (strstr(reply, "unknown command:")) {
ret = -2;
}
if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) {
- virReportError(VIR_ERR_OPERATION_FAILED,
- "%s", _("could not balloon memory allocation"));
VIR_FREE(cmd);
return -1;
}
}
if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) {
- virReportError(VIR_ERR_OPERATION_FAILED,
- "%s", _("could not change CPU online status"));
VIR_FREE(cmd);
return -1;
}
goto cleanup;
}
- if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) {
- virReportError(VIR_ERR_OPERATION_FAILED,
- _("could not eject media on %s"), dev_name);
+ if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
goto cleanup;
- }
/* If the command failed qemu prints:
* device not found, device is locked ...
goto cleanup;
}
- if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) {
- virReportError(VIR_ERR_OPERATION_FAILED,
- _("could not change media on %s"), dev_name);
+ if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
goto cleanup;
- }
/* If the command failed qemu prints:
* device not found, device is locked ...
goto cleanup;
}
- if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) {
- virReportError(VIR_ERR_OPERATION_FAILED,
- _("could not save memory region to '%s'"), path);
+ if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
goto cleanup;
- }
/* XXX what is printed on failure ? */
goto cleanup;
}
- if (qemuMonitorHMPCommand(mon, cmd, &info) < 0) {
- virReportError(VIR_ERR_OPERATION_FAILED,
- "%s", _("could not restrict migration speed"));
+ if (qemuMonitorHMPCommand(mon, cmd, &info) < 0)
goto cleanup;
- }
ret = 0;
goto cleanup;
}
- if (qemuMonitorHMPCommand(mon, cmd, &info) < 0) {
- virReportError(VIR_ERR_OPERATION_FAILED,
- "%s", _("could not set maximum migration downtime"));
+ if (qemuMonitorHMPCommand(mon, cmd, &info) < 0)
goto cleanup;
- }
ret = 0;
*remaining = 0;
*total = 0;
- if (qemuMonitorHMPCommand(mon, "info migrate", &reply) < 0) {
- virReportError(VIR_ERR_OPERATION_FAILED,
- "%s", _("cannot query migration status"));
+ if (qemuMonitorHMPCommand(mon, "info migrate", &reply) < 0)
return -1;
- }
if ((tmp = strstr(reply, MIGRATION_PREFIX)) != NULL) {
tmp += strlen(MIGRATION_PREFIX);
goto cleanup;
}
- if (qemuMonitorHMPCommand(mon, cmd, &info) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("unable to start migration to %s"), dest);
+ if (qemuMonitorHMPCommand(mon, cmd, &info) < 0)
goto cleanup;
- }
/* Now check for "fail" in the output string */
if (strstr(info, "fail") != NULL) {
int qemuMonitorTextMigrateCancel(qemuMonitorPtr mon)
{
char *info = NULL;
+ int ret;
- if (qemuMonitorHMPCommand(mon, "migrate_cancel", &info) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("cannot run monitor command to cancel migration"));
- return -1;
- }
- VIR_FREE(info);
+ ret = qemuMonitorHMPCommand(mon, "migrate_cancel", &info);
- return 0;
+ VIR_FREE(info);
+ return ret;
}
if (qemuMonitorHMPCommand(mon, cmd, &info) < 0) {
VIR_FREE(cmd);
- virReportError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("cannot run monitor command to relocate graphics client"));
return -1;
}
VIR_FREE(cmd);
goto cleanup;
}
- if (qemuMonitorHMPCommand(mon, cmd, &info) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("cannot run monitor command to add usb disk"));
+ if (qemuMonitorHMPCommand(mon, cmd, &info) < 0)
goto cleanup;
- }
/* If the command failed qemu prints:
* Could not add ... */
return -1;
}
- if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) {
- virReportError(VIR_ERR_OPERATION_FAILED,
- "%s", _("cannot attach usb device"));
+ if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
goto cleanup;
- }
/* If the command failed qemu prints:
* Could not add ... */
goto cleanup;
}
- if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) {
- virReportError(VIR_ERR_OPERATION_FAILED,
- "%s", _("cannot attach host pci device"));
+ if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
goto cleanup;
- }
if (strstr(reply, "invalid type: host")) {
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
goto cleanup;
}
- if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) {
- virReportError(VIR_ERR_OPERATION_FAILED,
- _("cannot attach %s disk %s"), bus, path);
+ if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
goto cleanup;
- }
if (qemuMonitorTextParsePciAddReply(mon, reply, guestAddr) < 0) {
if (!tryOldSyntax && strstr(reply, "invalid char in expression")) {
return -1;
}
- if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) {
- virReportError(VIR_ERR_OPERATION_FAILED,
- _("failed to add NIC with '%s'"), cmd);
+ if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
goto cleanup;
- }
if (qemuMonitorTextParsePciAddReply(mon, reply, guestAddr) < 0) {
virReportError(VIR_ERR_OPERATION_FAILED,
}
}
- if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) {
- virReportError(VIR_ERR_OPERATION_FAILED,
- "%s", _("failed to remove PCI device"));
+ if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
goto cleanup;
- }
/* Syntax changed when KVM merged PCI hotplug upstream to QEMU,
* so check for an error message from old KVM indicating the
return -1;
}
- if (qemuMonitorHMPCommandWithFd(mon, cmd, fd, &reply) < 0) {
- virReportError(VIR_ERR_OPERATION_FAILED,
- _("failed to pass fd to qemu with '%s'"), cmd);
+ if (qemuMonitorHMPCommandWithFd(mon, cmd, fd, &reply) < 0)
goto cleanup;
- }
/* If the command isn't supported then qemu prints:
* unknown command: getfd" */
return -1;
}
- if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) {
- virReportError(VIR_ERR_OPERATION_FAILED,
- _("failed to close fd in qemu with '%s'"), cmd);
+ if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
goto cleanup;
- }
/* If the command isn't supported then qemu prints:
* unknown command: getfd" */
return -1;
}
- if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) {
- virReportError(VIR_ERR_OPERATION_FAILED,
- _("failed to add host net with '%s'"), cmd);
+ if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
goto cleanup;
- }
if (STRNEQ(reply, "")) {
virReportError(VIR_ERR_INTERNAL_ERROR,
return -1;
}
- if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) {
- virReportError(VIR_ERR_OPERATION_FAILED,
- _("failed to remove host network in qemu with '%s'"), cmd);
+ if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
goto cleanup;
- }
/* XXX error messages here ? */
return -1;
}
- if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) {
- virReportError(VIR_ERR_OPERATION_FAILED,
- _("failed to add netdev with '%s'"), cmd);
+ if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
goto cleanup;
- }
/* XXX error messages here ? */
return -1;
}
- if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) {
- virReportError(VIR_ERR_OPERATION_FAILED,
- _("failed to remove netdev in qemu with '%s'"), cmd);
+ if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
goto cleanup;
- }
/* XXX error messages here ? */
char *reply = NULL;
int ret = -1;
- if (qemuMonitorHMPCommand(mon, "info chardev", &reply) < 0) {
- virReportError(VIR_ERR_OPERATION_FAILED, "%s",
- _("failed to retrieve chardev info in qemu with 'info chardev'"));
+ if (qemuMonitorHMPCommand(mon, "info chardev", &reply) < 0)
return -1;
- }
char *pos; /* The current start of searching */
char *next = reply; /* The start of the next line */
goto cleanup;
}
- if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) {
- virReportError(VIR_ERR_OPERATION_FAILED,
- _("cannot attach %s disk controller"), bus);
+ if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
goto cleanup;
- }
if (qemuMonitorTextParsePciAddReply(mon, reply, guestAddr) < 0) {
if (!tryOldSyntax && strstr(reply, "invalid char in expression")) {
goto cleanup;
}
- if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) {
- virReportError(VIR_ERR_OPERATION_FAILED,
- _("failed to attach drive '%s'"), drivestr);
+ if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
goto cleanup;
- }
if (strstr(reply, "unknown command:")) {
virReportError(VIR_ERR_OPERATION_FAILED, "%s",
*retaddrs = NULL;
- if (qemuMonitorHMPCommand(mon, "info pci", &reply) < 0) {
- virReportError(VIR_ERR_OPERATION_FAILED,
- "%s", _("cannot query PCI addresses"));
+ if (qemuMonitorHMPCommand(mon, "info pci", &reply) < 0)
return -1;
- }
p = reply;
}
VIR_DEBUG("TextDelDevice devalias=%s", devalias);
- if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) {
- virReportError(VIR_ERR_OPERATION_FAILED,
- _("cannot detach %s device"), devalias);
+ if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
goto cleanup;
- }
if (STRNEQ(reply, "")) {
virReportError(VIR_ERR_OPERATION_FAILED,
goto cleanup;
}
- if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) {
- virReportError(VIR_ERR_OPERATION_FAILED,
- _("cannot attach %s device"), devicestr);
+ if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
goto cleanup;
- }
/* If the host device is hotpluged first time, qemu will output
* husb: using %s file-system with %s if the command succeeds.
goto cleanup;
}
- if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) {
- virReportError(VIR_ERR_OPERATION_FAILED,
- _("failed to add drive '%s'"), drivestr);
+ if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
goto cleanup;
- }
if (strstr(reply, "unknown command:")) {
virReportError(VIR_ERR_OPERATION_FAILED, "%s",
goto cleanup;
}
- if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) {
- virReportError(VIR_ERR_OPERATION_FAILED,
- _("cannot delete %s drive"), drivestr);
+ if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
goto cleanup;
- }
if (strstr(reply, "unknown command:")) {
VIR_ERROR(_("deleting drive is not supported. "
goto cleanup;
}
- if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) {
- virReportError(VIR_ERR_OPERATION_FAILED, "%s",
- _("failed to set disk password"));
+ if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
goto cleanup;
- }
if (strstr(reply, "unknown command:")) {
virReportError(VIR_ERR_OPERATION_FAILED, "%s",
goto cleanup;
}
- if (qemuMonitorHMPCommand(mon, cmd, &reply)) {
- virReportError(VIR_ERR_OPERATION_FAILED,
- _("failed to take snapshot using command '%s'"), cmd);
+ if (qemuMonitorHMPCommand(mon, cmd, &reply))
goto cleanup;
- }
if (strstr(reply, "Error while creating snapshot") != NULL) {
virReportError(VIR_ERR_OPERATION_FAILED,
goto cleanup;
}
- if (qemuMonitorHMPCommand(mon, cmd, &reply)) {
- virReportError(VIR_ERR_OPERATION_FAILED,
- _("failed to restore snapshot using command '%s'"),
- cmd);
+ if (qemuMonitorHMPCommand(mon, cmd, &reply))
goto cleanup;
- }
if (strstr(reply, "No block device supports snapshots") != NULL) {
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
virReportOOMError();
goto cleanup;
}
- if (qemuMonitorHMPCommand(mon, cmd, &reply)) {
- virReportError(VIR_ERR_OPERATION_FAILED,
- _("failed to delete snapshot using command '%s'"),
- cmd);
+ if (qemuMonitorHMPCommand(mon, cmd, &reply))
goto cleanup;
- }
if (strstr(reply, "No block device supports snapshots") != NULL) {
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
goto cleanup;
}
- if (qemuMonitorHMPCommand(mon, cmd, &reply)) {
- virReportError(VIR_ERR_OPERATION_FAILED,
- _("failed to take snapshot using command '%s'"), cmd);
+ if (qemuMonitorHMPCommand(mon, cmd, &reply))
goto cleanup;
- }
if (strstr(reply, "error while creating qcow2") != NULL ||
strstr(reply, "unknown command:") != NULL) {
}
ret = qemuMonitorHMPCommand(mon, safecmd, reply);
- if (ret != 0)
- virReportError(VIR_ERR_OPERATION_FAILED,
- _("failed to run cmd '%s'"), safecmd);
VIR_FREE(safecmd);
int qemuMonitorTextInjectNMI(qemuMonitorPtr mon)
{
- const char *cmd = "inject-nmi";
char *reply = NULL;
- if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
- goto fail;
+ if (qemuMonitorHMPCommand(mon, "inject-nmi", &reply) < 0)
+ return -1;
if (strstr(reply, "unknown command") != NULL) {
VIR_FREE(reply);
/* fallback to 'nmi' if qemu has not supported "inject-nmi" yet. */
- cmd = "nmi 0";
- reply = NULL;
- if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
- goto fail;
+ if (qemuMonitorHMPCommand(mon, "nmi 0", &reply) < 0)
+ return -1;
}
VIR_FREE(reply);
return 0;
-
-fail:
- virReportError(VIR_ERR_OPERATION_FAILED,
- _("failed to inject NMI using command '%s'"),
- cmd);
- return -1;
}
int qemuMonitorTextSendKey(qemuMonitorPtr mon,
}
cmd = virBufferContentAndReset(&buf);
- if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) {
- virReportError(VIR_ERR_OPERATION_FAILED,
- _("failed to send key using command '%s'"),
- cmd);
+ if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
goto cleanup;
- }
if (STRNEQ(reply, "")) {
virReportError(VIR_ERR_OPERATION_FAILED,
goto cleanup;
}
- if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) {
- virReportError(VIR_ERR_OPERATION_FAILED,
- "%s", _("taking screenshot failed"));
+ if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
goto cleanup;
- }
if (strstr(reply, "unknown command:")) {
ret = -2;
goto cleanup;
}
- if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) {
- virReportError(VIR_ERR_OPERATION_FAILED,
- "%s", _("adding graphics client failed"));
+ if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
goto cleanup;
- }
if (STRNEQ(reply, ""))
goto cleanup;
{
char *cmd = NULL;
char *result = NULL;
- int ret = 0;
+ int ret = -1;
const char *cmd_name = NULL;
/* For the not specified fields, 0 by default */
cmd_name = "block_set_io_throttle";
- ret = virAsprintf(&cmd, "%s %s %llu %llu %llu %llu %llu %llu", cmd_name,
- device, info->total_bytes_sec, info->read_bytes_sec,
- info->write_bytes_sec, info->total_iops_sec,
- info->read_iops_sec, info->write_iops_sec);
-
- if (ret < 0) {
+ if (virAsprintf(&cmd, "%s %s %llu %llu %llu %llu %llu %llu", cmd_name,
+ device, info->total_bytes_sec, info->read_bytes_sec,
+ info->write_bytes_sec, info->total_iops_sec,
+ info->read_iops_sec, info->write_iops_sec) < 0) {
virReportOOMError();
- return -1;
+ goto cleanup;
}
- if (qemuMonitorHMPCommand(mon, cmd, &result) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("cannot run monitor command"));
- ret = -1;
+ if (qemuMonitorHMPCommand(mon, cmd, &result) < 0)
goto cleanup;
- }
if (qemuMonitorTextCommandNotFound(cmd_name, result)) {
virReportError(VIR_ERR_OPERATION_INVALID,
_("Command '%s' is not found"), cmd_name);
- ret = -1;
goto cleanup;
}
+ ret = 0;
cleanup:
VIR_FREE(cmd);
virDomainBlockIoTuneInfoPtr reply)
{
char *result = NULL;
- int ret = 0;
+ int ret = -1;
const char *cmd_name = "info block";
- if (qemuMonitorHMPCommand(mon, cmd_name, &result) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("cannot run monitor command"));
- ret = -1;
+ if (qemuMonitorHMPCommand(mon, cmd_name, &result) < 0)
goto cleanup;
- }
if (qemuMonitorTextCommandNotFound(cmd_name, result)) {
virReportError(VIR_ERR_OPERATION_INVALID,
_("Command '%s' is not found"), cmd_name);
- ret = -1;
goto cleanup;
}