};
static int
-qemuConnectMonitor(virDomainObjPtr vm)
+qemuConnectMonitor(struct qemud_driver *driver, virDomainObjPtr vm)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
+ int ret;
/* Hold an extra reference because we can't allow 'vm' to be
* deleted while the monitor is active */
return -1;
}
- return 0;
+ qemuDomainObjEnterMonitorWithDriver(driver, vm);
+ ret = qemuMonitorSetCapabilities(priv->mon);
+ qemuDomainObjExitMonitorWithDriver(driver, vm);
+
+ if (ret < 0) {
+ qemuMonitorClose(priv->mon);
+ priv->mon = NULL;
+ }
+
+ return ret;
}
/*
priv = obj->privateData;
/* XXX check PID liveliness & EXE path */
- if (qemuConnectMonitor(obj) < 0)
+ if (qemuConnectMonitor(driver, obj) < 0)
goto error;
if (qemuUpdateActivePciHostdevs(driver, obj->def) < 0) {
return -1;
VIR_DEBUG("Connect monitor to %p '%s'", vm, vm->def->name);
- if (qemuConnectMonitor(vm) < 0)
+ if (qemuConnectMonitor(driver, vm) < 0)
return -1;
/* Try to get the pty path mappings again via the monitor. This is much more
}
+int qemuMonitorSetCapabilities(qemuMonitorPtr mon)
+{
+ int ret;
+ DEBUG("mon=%p, fd=%d", mon, mon->fd);
+
+ if (mon->json)
+ ret = qemuMonitorJSONSetCapabilities(mon);
+ else
+ ret = 0;
+ return ret;
+}
+
+
int
qemuMonitorStartCPUs(qemuMonitorPtr mon,
virConnectPtr conn)
int qemuMonitorClose(qemuMonitorPtr mon);
+int qemuMonitorSetCapabilities(qemuMonitorPtr mon);
+
void qemuMonitorLock(qemuMonitorPtr mon);
void qemuMonitorUnlock(qemuMonitorPtr mon);
}
+int
+qemuMonitorJSONSetCapabilities(qemuMonitorPtr mon)
+{
+ int ret;
+ virJSONValuePtr cmd = qemuMonitorJSONMakeCommand("qmp_capabilities", NULL);
+ virJSONValuePtr reply = NULL;
+ if (!cmd)
+ return -1;
+
+ ret = qemuMonitorJSONCommand(mon, cmd, &reply);
+
+ if (ret == 0)
+ ret = qemuMonitorJSONCheckError(cmd, reply);
+
+ virJSONValueFree(cmd);
+ virJSONValueFree(reply);
+ return ret;
+}
+
+
int
qemuMonitorJSONStartCPUs(qemuMonitorPtr mon,
virConnectPtr conn ATTRIBUTE_UNUSED)
size_t len,
qemuMonitorMessagePtr msg);
+int qemuMonitorJSONSetCapabilities(qemuMonitorPtr mon);
+
int qemuMonitorJSONStartCPUs(qemuMonitorPtr mon,
virConnectPtr conn);
int qemuMonitorJSONStopCPUs(qemuMonitorPtr mon);