On Thu, 2009-09-24 at 16:00 +0100, Daniel P. Berrange wrote:
* src/qemu/qemu_monitor.h, src/qemu/qemu_monitor.c: Add a new
qemuMonitorGetCPUInfo() command
* src/qemu/qemu_driver.c: Refactor qemudDetectVcpuPIDs to
use qemuMonitorGetCPUInfo()
---
src/qemu/qemu_driver.c | 114 ++++++++++--------------------------------
src/qemu/qemu_monitor_text.c | 85 +++++++++++++++++++++++++++++++
src/qemu/qemu_monitor_text.h | 4 +-
3 files changed, 115 insertions(+), 88 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 9f17aae..30d1468 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
...
diff --git a/src/qemu/qemu_monitor_text.c
b/src/qemu/qemu_monitor_text.c
index 76842a5..d93e475 100644
--- a/src/qemu/qemu_monitor_text.c
+++ b/src/qemu/qemu_monitor_text.c
@@ -31,6 +31,7 @@
#include "qemu_monitor_text.h"
#include "qemu_conf.h"
+#include "c-ctype.h"
#include "memory.h"
#include "logging.h"
#include "driver.h"
@@ -435,3 +436,87 @@ qemudMonitorSendCont(virConnectPtr conn,
VIR_FREE(reply);
return 0;
}
+
+
+int qemuMonitorGetCPUInfo(const virDomainObjPtr vm,
+ int **pids)
+{
+ char *qemucpus = NULL;
+ char *line;
+ int lastVcpu = -1;
+ pid_t *cpupids = NULL;
+ size_t ncpupids = 0;
+
+ if (qemudMonitorCommand(vm, "info cpus", &qemucpus) < 0) {
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ "%s", _("cannot run monitor command to fetch CPU
thread info"));
+ return -1;
+ }
Not passing conn to ReportError in most monitor functions now; is that a
problem?
ACK
Cheers,
Mark.