qemu: Add new parameter to qemuMonitorDumpToFd

Add a @detach parameter to the API in order allow running the QEMU
code as a thread.

Reviewed-by: Jiri Denemark <jdenemar redhat com>
This commit is contained in:
John Ferlan 2017-11-20 15:05:23 -05:00
parent 501e3c3c96
commit 9a1755b7fe
6 changed files with 15 additions and 7 deletions

View File

@ -3798,7 +3798,7 @@ qemuDumpToFd(virQEMUDriverPtr driver,
} }
} }
ret = qemuMonitorDumpToFd(priv->mon, fd, dumpformat); ret = qemuMonitorDumpToFd(priv->mon, fd, dumpformat, false);
cleanup: cleanup:
ignore_value(qemuDomainObjExitMonitor(driver, vm)); ignore_value(qemuDomainObjExitMonitor(driver, vm));

View File

@ -2805,7 +2805,10 @@ qemuMonitorGetDumpGuestMemoryCapability(qemuMonitorPtr mon,
int int
qemuMonitorDumpToFd(qemuMonitorPtr mon, int fd, const char *dumpformat) qemuMonitorDumpToFd(qemuMonitorPtr mon,
int fd,
const char *dumpformat,
bool detach)
{ {
int ret; int ret;
VIR_DEBUG("fd=%d dumpformat=%s", fd, dumpformat); VIR_DEBUG("fd=%d dumpformat=%s", fd, dumpformat);
@ -2815,7 +2818,7 @@ qemuMonitorDumpToFd(qemuMonitorPtr mon, int fd, const char *dumpformat)
if (qemuMonitorSendFileHandle(mon, "dump", fd) < 0) if (qemuMonitorSendFileHandle(mon, "dump", fd) < 0)
return -1; return -1;
ret = qemuMonitorJSONDump(mon, "fd:dump", dumpformat); ret = qemuMonitorJSONDump(mon, "fd:dump", dumpformat, detach);
if (ret < 0) { if (ret < 0) {
if (qemuMonitorCloseFileHandle(mon, "dump") < 0) if (qemuMonitorCloseFileHandle(mon, "dump") < 0)

View File

@ -795,7 +795,8 @@ int qemuMonitorQueryDump(qemuMonitorPtr mon,
int qemuMonitorDumpToFd(qemuMonitorPtr mon, int qemuMonitorDumpToFd(qemuMonitorPtr mon,
int fd, int fd,
const char *dumpformat); const char *dumpformat,
bool detach);
int qemuMonitorGraphicsRelocate(qemuMonitorPtr mon, int qemuMonitorGraphicsRelocate(qemuMonitorPtr mon,
int type, int type,

View File

@ -3263,7 +3263,8 @@ qemuMonitorJSONGetDumpGuestMemoryCapability(qemuMonitorPtr mon,
int int
qemuMonitorJSONDump(qemuMonitorPtr mon, qemuMonitorJSONDump(qemuMonitorPtr mon,
const char *protocol, const char *protocol,
const char *dumpformat) const char *dumpformat,
bool detach)
{ {
int ret = -1; int ret = -1;
virJSONValuePtr cmd = NULL; virJSONValuePtr cmd = NULL;
@ -3273,6 +3274,7 @@ qemuMonitorJSONDump(qemuMonitorPtr mon,
"b:paging", false, "b:paging", false,
"s:protocol", protocol, "s:protocol", protocol,
"S:format", dumpformat, "S:format", dumpformat,
"B:detach", detach,
NULL); NULL);
if (!cmd) if (!cmd)
return -1; return -1;

View File

@ -170,7 +170,8 @@ int qemuMonitorJSONGetDumpGuestMemoryCapability(qemuMonitorPtr mon,
int qemuMonitorJSONDump(qemuMonitorPtr mon, int qemuMonitorJSONDump(qemuMonitorPtr mon,
const char *protocol, const char *protocol,
const char *dumpformat); const char *dumpformat,
bool detach);
int qemuMonitorJSONGraphicsRelocate(qemuMonitorPtr mon, int qemuMonitorJSONGraphicsRelocate(qemuMonitorPtr mon,
int type, int type,

View File

@ -1330,7 +1330,8 @@ GEN_TEST_FUNC(qemuMonitorJSONSetMigrationDowntime, 1)
GEN_TEST_FUNC(qemuMonitorJSONMigrate, QEMU_MONITOR_MIGRATE_BACKGROUND | GEN_TEST_FUNC(qemuMonitorJSONMigrate, QEMU_MONITOR_MIGRATE_BACKGROUND |
QEMU_MONITOR_MIGRATE_NON_SHARED_DISK | QEMU_MONITOR_MIGRATE_NON_SHARED_DISK |
QEMU_MONITOR_MIGRATE_NON_SHARED_INC, "tcp:localhost:12345") QEMU_MONITOR_MIGRATE_NON_SHARED_INC, "tcp:localhost:12345")
GEN_TEST_FUNC(qemuMonitorJSONDump, "dummy_protocol", "dummy_memory_dump_format") GEN_TEST_FUNC(qemuMonitorJSONDump, "dummy_protocol", "dummy_memory_dump_format",
true)
GEN_TEST_FUNC(qemuMonitorJSONGraphicsRelocate, VIR_DOMAIN_GRAPHICS_TYPE_SPICE, GEN_TEST_FUNC(qemuMonitorJSONGraphicsRelocate, VIR_DOMAIN_GRAPHICS_TYPE_SPICE,
"localhost", 12345, 12346, NULL) "localhost", 12345, 12346, NULL)
GEN_TEST_FUNC(qemuMonitorJSONAddNetdev, "some_dummy_netdevstr") GEN_TEST_FUNC(qemuMonitorJSONAddNetdev, "some_dummy_netdevstr")