qemu_monitor: Add API for checking CPU migratable property

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
This commit is contained in:
Jiri Denemark 2020-07-15 22:33:07 +02:00
parent d32cde0ea2
commit c7afaa69cd
4 changed files with 53 additions and 0 deletions

View File

@ -4526,6 +4526,24 @@ qemuMonitorGetJobInfo(qemuMonitorPtr mon,
}
/* qemuMonitorGetCPUMigratable:
*
* Get the migratable property of the CPU object.
*
* Returns -1 on error,
* 1 when the property is not supported,
* 0 on success (@migratable is set accordingly).
*/
int
qemuMonitorGetCPUMigratable(qemuMonitorPtr mon,
bool *migratable)
{
QEMU_CHECK_MONITOR(mon);
return qemuMonitorJSONGetCPUMigratable(mon, migratable);
}
int
qemuMonitorTransactionBitmapAdd(virJSONValuePtr actions,
const char *node,

View File

@ -1377,6 +1377,10 @@ int qemuMonitorGetJobInfo(qemuMonitorPtr mon,
qemuMonitorJobInfoPtr **jobs,
size_t *njobs);
int
qemuMonitorGetCPUMigratable(qemuMonitorPtr mon,
bool *migratable);
int
qemuMonitorTransactionBitmapAdd(virJSONValuePtr actions,
const char *node,

View File

@ -9388,3 +9388,30 @@ qemuMonitorJSONGetJobInfo(qemuMonitorPtr mon,
return 0;
}
int
qemuMonitorJSONGetCPUMigratable(qemuMonitorPtr mon,
bool *migratable)
{
g_autoptr(virJSONValue) cmd = NULL;
g_autoptr(virJSONValue) reply = NULL;
if (!(cmd = qemuMonitorJSONMakeCommand("qom-get",
"s:path", QOM_CPU_PATH,
"s:property", "migratable",
NULL)))
return -1;
if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
return -1;
if (qemuMonitorJSONHasError(reply, "GenericError"))
return 1;
if (qemuMonitorJSONCheckReply(cmd, reply, VIR_JSON_TYPE_BOOLEAN) < 0)
return -1;
return virJSONValueGetBoolean(virJSONValueObjectGet(reply, "return"),
migratable);
}

View File

@ -690,3 +690,7 @@ int qemuMonitorJSONSetDBusVMStateIdList(qemuMonitorPtr mon,
const char *vmstatepath,
const char **list)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
int
qemuMonitorJSONGetCPUMigratable(qemuMonitorPtr mon,
bool *migratable);