On Tue, Jun 07, 2011 at 03:01:59PM +0200, Jiri Denemark wrote:
---
src/qemu/qemu_domain.c | 4 +++
src/qemu/qemu_domain.h | 2 +
src/qemu/qemu_driver.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++
src/qemu/qemu_process.c | 3 ++
4 files changed, 70 insertions(+), 0 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 5f18ad3..06d2a5e 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -609,6 +609,7 @@ void qemuDomainObjEnterMonitor(virDomainObjPtr obj)
qemuMonitorLock(priv->mon);
qemuMonitorRef(priv->mon);
+ virTimeMs(&priv->monStart);
virDomainObjUnlock(obj);
}
@@ -629,6 +630,7 @@ void qemuDomainObjExitMonitor(virDomainObjPtr obj)
virDomainObjLock(obj);
+ priv->monStart = 0;
if (refs == 0) {
priv->mon = NULL;
}
@@ -650,6 +652,7 @@ void qemuDomainObjEnterMonitorWithDriver(struct qemud_driver
*driver,
qemuMonitorLock(priv->mon);
qemuMonitorRef(priv->mon);
+ virTimeMs(&priv->monStart);
virDomainObjUnlock(obj);
qemuDriverUnlock(driver);
}
@@ -674,6 +677,7 @@ void qemuDomainObjExitMonitorWithDriver(struct qemud_driver *driver,
qemuDriverLock(driver);
virDomainObjLock(obj);
+ priv->monStart = 0;
if (refs == 0) {
priv->mon = NULL;
}
Hum ... can we double-check that we can only enter and exit the
monitor from those 4 entry points, for example in case of error. Having
a small error leading to a miscategorization of the monitor being
unresponsive would be a serious regression.
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index bacf5b5..3d041fc 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -79,6 +79,8 @@ struct _qemuDomainObjPrivate {
qemuMonitorPtr mon;
virDomainChrSourceDefPtr monConfig;
int monJSON;
+ bool monError;
+ unsigned long long monStart;
bool gotShutdown;
next step would probably to measure how long monitor commands take
but that's beyond GetControlInfo reach :-)
[...]
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -166,6 +166,7 @@ qemuProcessHandleMonitorError(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
qemuDriverLock(driver);
virDomainObjLock(vm);
+ ((qemuDomainObjPrivatePtr) vm->privateData)->monError = true;
event = virDomainEventControlErrorNewFromObj(vm);
if (event)
qemuDomainEventQueue(driver, event);
@@ -2255,6 +2256,8 @@ int qemuProcessStart(virConnectPtr conn,
#endif
priv->monJSON = 0;
+ priv->monError = false;
+ priv->monStart = 0;
priv->gotShutdown = false;
if ((ret = virFileDeletePid(driver->stateDir, vm->def->name)) != 0) {
Okay, looks fine,
ACK,
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit
http://xmlsoft.org/
daniel(a)veillard.com | Rpmfind RPM search engine
http://rpmfind.net/
http://veillard.com/ | virtualization library
http://libvirt.org/