So that it's obvious that they are supposed to be used with HMP commands.
---
Version 3:
- new patch
src/qemu/qemu_monitor.c | 8 ++--
src/qemu/qemu_monitor.h | 12 +++---
src/qemu/qemu_monitor_text.c | 86 +++++++++++++++++++++---------------------
3 files changed, 53 insertions(+), 53 deletions(-)
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 2d5124e..37401df 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -742,10 +742,10 @@ cleanup:
}
-int qemuMonitorCommandWithFd(qemuMonitorPtr mon,
- const char *cmd,
- int scm_fd,
- char **reply)
+int qemuMonitorHMPCommandWithFd(qemuMonitorPtr mon,
+ const char *cmd,
+ int scm_fd,
+ char **reply)
{
if (mon->json)
return qemuMonitorJSONHumanCommandWithFd(mon, cmd, scm_fd, reply);
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 7200db8..ece15a8 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -136,12 +136,12 @@ int qemuMonitorUnref(qemuMonitorPtr mon);
/* These APIs are for use by the internal Text/JSON monitor impl code only */
int qemuMonitorSend(qemuMonitorPtr mon,
qemuMonitorMessagePtr msg);
-int qemuMonitorCommandWithFd(qemuMonitorPtr mon,
- const char *cmd,
- int scm_fd,
- char **reply);
-# define qemuMonitorCommand(mon, cmd, reply) \
- qemuMonitorCommandWithFd(mon, cmd, -1, reply)
+int qemuMonitorHMPCommandWithFd(qemuMonitorPtr mon,
+ const char *cmd,
+ int scm_fd,
+ char **reply);
+# define qemuMonitorHMPCommand(mon, cmd, reply) \
+ qemuMonitorHMPCommandWithFd(mon, cmd, -1, reply)
/* XXX same comment about virConnectPtr as above */
int qemuMonitorGetDiskSecret(qemuMonitorPtr mon,
diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c
index 6949384..51f1226 100644
--- a/src/qemu/qemu_monitor_text.c
+++ b/src/qemu/qemu_monitor_text.c
@@ -360,7 +360,7 @@ int
qemuMonitorTextStopCPUs(qemuMonitorPtr mon) {
char *info;
- if (qemuMonitorCommand(mon, "stop", &info) < 0) {
+ if (qemuMonitorHMPCommand(mon, "stop", &info) < 0) {
qemuReportError(VIR_ERR_OPERATION_FAILED,
"%s", _("cannot stop CPU execution"));
return -1;
@@ -373,7 +373,7 @@ qemuMonitorTextStopCPUs(qemuMonitorPtr mon) {
int qemuMonitorTextSystemPowerdown(qemuMonitorPtr mon) {
char *info;
- if (qemuMonitorCommand(mon, "system_powerdown", &info) < 0) {
+ if (qemuMonitorHMPCommand(mon, "system_powerdown", &info) < 0) {
qemuReportError(VIR_ERR_OPERATION_FAILED,
"%s", _("system shutdown operation
failed"));
return -1;
@@ -392,7 +392,7 @@ int qemuMonitorTextGetCPUInfo(qemuMonitorPtr mon,
pid_t *cpupids = NULL;
size_t ncpupids = 0;
- if (qemuMonitorCommand(mon, "info cpus", &qemucpus) < 0) {
+ if (qemuMonitorHMPCommand(mon, "info cpus", &qemucpus) < 0) {
qemuReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("cannot run monitor command to fetch CPU
thread info"));
return -1;
@@ -544,7 +544,7 @@ int qemuMonitorTextGetBalloonInfo(qemuMonitorPtr mon,
int ret = -1;
char *offset;
- if (qemuMonitorCommand(mon, "info balloon", &reply) < 0) {
+ if (qemuMonitorHMPCommand(mon, "info balloon", &reply) < 0) {
qemuReportError(VIR_ERR_OPERATION_FAILED,
"%s", _("could not query memory balloon
allocation"));
return -1;
@@ -581,7 +581,7 @@ int qemuMonitorTextGetMemoryStats(qemuMonitorPtr mon,
int ret = 0;
char *offset;
- if (qemuMonitorCommand(mon, "info balloon", &reply) < 0) {
+ if (qemuMonitorHMPCommand(mon, "info balloon", &reply) < 0) {
qemuReportError(VIR_ERR_OPERATION_FAILED,
"%s", _("could not query memory balloon
statistics"));
return -1;
@@ -613,7 +613,7 @@ int qemuMonitorTextGetBlockStatsInfo(qemuMonitorPtr mon,
const char *p, *eol;
int devnamelen = strlen(devname);
- if (qemuMonitorCommand (mon, "info blockstats", &info) < 0) {
+ if (qemuMonitorHMPCommand (mon, "info blockstats", &info) < 0) {
qemuReportError(VIR_ERR_OPERATION_FAILED,
"%s", _("'info blockstats' command
failed"));
goto cleanup;
@@ -778,7 +778,7 @@ int qemuMonitorTextSetPassword(qemuMonitorPtr mon,
goto cleanup;
}
- if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
+ if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) {
qemuReportError(VIR_ERR_OPERATION_FAILED,
"%s", _("setting password failed"));
goto cleanup;
@@ -812,7 +812,7 @@ int qemuMonitorTextExpirePassword(qemuMonitorPtr mon,
goto cleanup;
}
- if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
+ if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) {
qemuReportError(VIR_ERR_OPERATION_FAILED,
"%s", _("expiring password failed"));
goto cleanup;
@@ -851,7 +851,7 @@ int qemuMonitorTextSetBalloon(qemuMonitorPtr mon,
return -1;
}
- if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
+ if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) {
qemuReportError(VIR_ERR_OPERATION_FAILED,
"%s", _("could not balloon memory
allocation"));
VIR_FREE(cmd);
@@ -888,7 +888,7 @@ int qemuMonitorTextSetCPU(qemuMonitorPtr mon, int cpu, int online)
return -1;
}
- if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
+ if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) {
qemuReportError(VIR_ERR_OPERATION_FAILED,
"%s", _("could not change CPU online
status"));
VIR_FREE(cmd);
@@ -923,7 +923,7 @@ int qemuMonitorTextEjectMedia(qemuMonitorPtr mon,
goto cleanup;
}
- if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
+ if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) {
qemuReportError(VIR_ERR_OPERATION_FAILED,
_("could not eject media on %s"), devname);
goto cleanup;
@@ -967,7 +967,7 @@ int qemuMonitorTextChangeMedia(qemuMonitorPtr mon,
goto cleanup;
}
- if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
+ if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) {
qemuReportError(VIR_ERR_OPERATION_FAILED,
_("could not change media on %s"), devname);
goto cleanup;
@@ -1019,7 +1019,7 @@ static int qemuMonitorTextSaveMemory(qemuMonitorPtr mon,
goto cleanup;
}
- if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
+ if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) {
qemuReportError(VIR_ERR_OPERATION_FAILED,
_("could not save memory region to '%s'"),
path);
goto cleanup;
@@ -1066,7 +1066,7 @@ int qemuMonitorTextSetMigrationSpeed(qemuMonitorPtr mon,
goto cleanup;
}
- if (qemuMonitorCommand(mon, cmd, &info) < 0) {
+ if (qemuMonitorHMPCommand(mon, cmd, &info) < 0) {
qemuReportError(VIR_ERR_OPERATION_FAILED,
"%s", _("could not restrict migration
speed"));
goto cleanup;
@@ -1093,7 +1093,7 @@ int qemuMonitorTextSetMigrationDowntime(qemuMonitorPtr mon,
goto cleanup;
}
- if (qemuMonitorCommand(mon, cmd, &info) < 0) {
+ if (qemuMonitorHMPCommand(mon, cmd, &info) < 0) {
qemuReportError(VIR_ERR_OPERATION_FAILED,
"%s", _("could not set maximum migration
downtime"));
goto cleanup;
@@ -1128,7 +1128,7 @@ int qemuMonitorTextGetMigrationStatus(qemuMonitorPtr mon,
*remaining = 0;
*total = 0;
- if (qemuMonitorCommand(mon, "info migrate", &reply) < 0) {
+ if (qemuMonitorHMPCommand(mon, "info migrate", &reply) < 0) {
qemuReportError(VIR_ERR_OPERATION_FAILED,
"%s", _("cannot query migration status"));
return -1;
@@ -1234,7 +1234,7 @@ static int qemuMonitorTextMigrate(qemuMonitorPtr mon,
goto cleanup;
}
- if (qemuMonitorCommand(mon, cmd, &info) < 0) {
+ if (qemuMonitorHMPCommand(mon, cmd, &info) < 0) {
qemuReportError(VIR_ERR_INTERNAL_ERROR,
_("unable to start migration to %s"), dest);
goto cleanup;
@@ -1384,7 +1384,7 @@ int qemuMonitorTextMigrateCancel(qemuMonitorPtr mon)
{
char *info = NULL;
- if (qemuMonitorCommand(mon, "migrate_cancel", &info) < 0) {
+ if (qemuMonitorHMPCommand(mon, "migrate_cancel", &info) < 0) {
qemuReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("cannot run monitor command to cancel
migration"));
return -1;
@@ -1413,7 +1413,7 @@ int qemuMonitorTextAddUSBDisk(qemuMonitorPtr mon,
goto cleanup;
}
- if (qemuMonitorCommand(mon, cmd, &info) < 0) {
+ if (qemuMonitorHMPCommand(mon, cmd, &info) < 0) {
qemuReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("cannot run monitor command to add usb
disk"));
goto cleanup;
@@ -1449,7 +1449,7 @@ static int qemuMonitorTextAddUSBDevice(qemuMonitorPtr mon,
return -1;
}
- if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
+ if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) {
qemuReportError(VIR_ERR_OPERATION_FAILED,
"%s", _("cannot attach usb device"));
goto cleanup;
@@ -1590,7 +1590,7 @@ int qemuMonitorTextAddPCIHostDevice(qemuMonitorPtr mon,
goto cleanup;
}
- if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
+ if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) {
qemuReportError(VIR_ERR_OPERATION_FAILED,
"%s", _("cannot attach host pci device"));
goto cleanup;
@@ -1641,7 +1641,7 @@ try_command:
goto cleanup;
}
- if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
+ if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) {
qemuReportError(VIR_ERR_OPERATION_FAILED,
_("cannot attach %s disk %s"), bus, path);
goto cleanup;
@@ -1683,7 +1683,7 @@ int qemuMonitorTextAddPCINetwork(qemuMonitorPtr mon,
return -1;
}
- if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
+ if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) {
qemuReportError(VIR_ERR_OPERATION_FAILED,
_("failed to add NIC with '%s'"), cmd);
goto cleanup;
@@ -1727,7 +1727,7 @@ try_command:
}
}
- if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
+ if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) {
qemuReportError(VIR_ERR_OPERATION_FAILED,
"%s", _("failed to remove PCI device"));
goto cleanup;
@@ -1775,7 +1775,7 @@ int qemuMonitorTextSendFileHandle(qemuMonitorPtr mon,
return -1;
}
- if (qemuMonitorCommandWithFd(mon, cmd, fd, &reply) < 0) {
+ if (qemuMonitorHMPCommandWithFd(mon, cmd, fd, &reply) < 0) {
qemuReportError(VIR_ERR_OPERATION_FAILED,
_("failed to pass fd to qemu with '%s'"),
cmd);
goto cleanup;
@@ -1818,7 +1818,7 @@ int qemuMonitorTextCloseFileHandle(qemuMonitorPtr mon,
return -1;
}
- if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
+ if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) {
qemuReportError(VIR_ERR_OPERATION_FAILED,
_("failed to close fd in qemu with '%s'"),
cmd);
goto cleanup;
@@ -1854,7 +1854,7 @@ int qemuMonitorTextAddHostNetwork(qemuMonitorPtr mon,
return -1;
}
- if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
+ if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) {
qemuReportError(VIR_ERR_OPERATION_FAILED,
_("failed to add host net with '%s'"), cmd);
goto cleanup;
@@ -1889,7 +1889,7 @@ int qemuMonitorTextRemoveHostNetwork(qemuMonitorPtr mon,
return -1;
}
- if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
+ if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) {
qemuReportError(VIR_ERR_OPERATION_FAILED,
_("failed to remove host network in qemu with
'%s'"), cmd);
goto cleanup;
@@ -1918,7 +1918,7 @@ int qemuMonitorTextAddNetdev(qemuMonitorPtr mon,
return -1;
}
- if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
+ if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) {
qemuReportError(VIR_ERR_OPERATION_FAILED,
_("failed to add netdev with '%s'"), cmd);
goto cleanup;
@@ -1947,7 +1947,7 @@ int qemuMonitorTextRemoveNetdev(qemuMonitorPtr mon,
return -1;
}
- if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
+ if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) {
qemuReportError(VIR_ERR_OPERATION_FAILED,
_("failed to remove netdev in qemu with '%s'"),
cmd);
goto cleanup;
@@ -1982,7 +1982,7 @@ int qemuMonitorTextGetPtyPaths(qemuMonitorPtr mon,
char *reply = NULL;
int ret = -1;
- if (qemuMonitorCommand(mon, "info chardev", &reply) < 0) {
+ if (qemuMonitorHMPCommand(mon, "info chardev", &reply) < 0) {
qemuReportError(VIR_ERR_OPERATION_FAILED, "%s",
_("failed to retrieve chardev info in qemu with 'info
chardev'"));
goto cleanup;
@@ -2067,7 +2067,7 @@ try_command:
goto cleanup;
}
- if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
+ if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) {
qemuReportError(VIR_ERR_OPERATION_FAILED,
_("cannot attach %s disk controller"), bus);
goto cleanup;
@@ -2166,7 +2166,7 @@ try_command:
goto cleanup;
}
- if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
+ if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) {
qemuReportError(VIR_ERR_OPERATION_FAILED,
_("failed to close fd in qemu with '%s'"),
cmd);
goto cleanup;
@@ -2257,7 +2257,7 @@ int qemuMonitorTextGetAllPCIAddresses(qemuMonitorPtr mon,
*retaddrs = NULL;
- if (qemuMonitorCommand(mon, "info pci", &reply) < 0) {
+ if (qemuMonitorHMPCommand(mon, "info pci", &reply) < 0) {
qemuReportError(VIR_ERR_OPERATION_FAILED,
"%s", _("cannot query PCI addresses"));
return -1;
@@ -2350,7 +2350,7 @@ int qemuMonitorTextDelDevice(qemuMonitorPtr mon,
}
VIR_DEBUG("TextDelDevice devalias=%s", devalias);
- if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
+ if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) {
qemuReportError(VIR_ERR_OPERATION_FAILED,
_("cannot detach %s device"), devalias);
goto cleanup;
@@ -2390,7 +2390,7 @@ int qemuMonitorTextAddDevice(qemuMonitorPtr mon,
goto cleanup;
}
- if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
+ if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) {
qemuReportError(VIR_ERR_OPERATION_FAILED,
_("cannot attach %s device"), devicestr);
goto cleanup;
@@ -2435,7 +2435,7 @@ int qemuMonitorTextAddDrive(qemuMonitorPtr mon,
goto cleanup;
}
- if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
+ if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) {
qemuReportError(VIR_ERR_OPERATION_FAILED,
_("failed to close fd in qemu with '%s'"),
cmd);
goto cleanup;
@@ -2483,7 +2483,7 @@ int qemuMonitorTextDriveDel(qemuMonitorPtr mon,
goto cleanup;
}
- if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
+ if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) {
qemuReportError(VIR_ERR_OPERATION_FAILED,
_("cannot delete %s drive"), drivestr);
goto cleanup;
@@ -2537,7 +2537,7 @@ int qemuMonitorTextSetDrivePassphrase(qemuMonitorPtr mon,
goto cleanup;
}
- if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
+ if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) {
qemuReportError(VIR_ERR_OPERATION_FAILED,
_("failed to close fd in qemu with '%s'"),
cmd);
goto cleanup;
@@ -2573,7 +2573,7 @@ int qemuMonitorTextCreateSnapshot(qemuMonitorPtr mon, const char
*name)
return -1;
}
- if (qemuMonitorCommand(mon, cmd, &reply)) {
+ if (qemuMonitorHMPCommand(mon, cmd, &reply)) {
qemuReportError(VIR_ERR_OPERATION_FAILED,
_("failed to take snapshot using command
'%s'"), cmd);
goto cleanup;
@@ -2618,7 +2618,7 @@ int qemuMonitorTextLoadSnapshot(qemuMonitorPtr mon, const char
*name)
return -1;
}
- if (qemuMonitorCommand(mon, cmd, &reply)) {
+ if (qemuMonitorHMPCommand(mon, cmd, &reply)) {
qemuReportError(VIR_ERR_OPERATION_FAILED,
_("failed to restore snapshot using command
'%s'"),
cmd);
@@ -2673,7 +2673,7 @@ int qemuMonitorTextDeleteSnapshot(qemuMonitorPtr mon, const char
*name)
virReportOOMError();
return -1;
}
- if (qemuMonitorCommand(mon, cmd, &reply)) {
+ if (qemuMonitorHMPCommand(mon, cmd, &reply)) {
qemuReportError(VIR_ERR_OPERATION_FAILED,
_("failed to delete snapshot using command
'%s'"),
cmd);
@@ -2714,7 +2714,7 @@ int qemuMonitorTextArbitraryCommand(qemuMonitorPtr mon, const char
*cmd,
return -1;
}
- ret = qemuMonitorCommand(mon, safecmd, reply);
+ ret = qemuMonitorHMPCommand(mon, safecmd, reply);
if (ret != 0)
qemuReportError(VIR_ERR_OPERATION_FAILED,
_("failed to run cmd '%s'"), safecmd);
--
1.7.4.1