Add API for the 'system_powerdown' monitor command

* src/qemu/qemu_driver.c: Remove use of 'system_powerdown'
* src/qemu/qemu_monitor.h, src/qemu/qemu_monitor.c: Add a new
  qemuMonitorSystemPowerdown() api call
This commit is contained in:
Daniel P. Berrange 2009-09-23 12:21:00 +01:00
parent 1e64d8c731
commit 19d70c7d96
3 changed files with 18 additions and 6 deletions

View File

@ -2841,7 +2841,6 @@ cleanup:
static int qemudDomainShutdown(virDomainPtr dom) {
struct qemud_driver *driver = dom->conn->privateData;
virDomainObjPtr vm;
char* info;
int ret = -1;
qemuDriverLock(driver);
@ -2862,12 +2861,9 @@ static int qemudDomainShutdown(virDomainPtr dom) {
goto cleanup;
}
if (qemudMonitorCommand(vm, "system_powerdown", &info) < 0) {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
"%s", _("shutdown operation failed"));
if (qemuMonitorSystemPowerdown(vm) < 0)
goto cleanup;
}
VIR_FREE(info);
ret = 0;
cleanup:

View File

@ -451,6 +451,20 @@ qemuMonitorStopCPUs(const virDomainObjPtr vm) {
return 0;
}
int qemuMonitorSystemPowerdown(const virDomainObjPtr vm) {
char *info;
if (qemudMonitorCommand(vm, "system_powerdown", &info) < 0) {
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
"%s", _("system shutdown operation failed"));
return -1;
}
VIR_FREE(info);
return 0;
}
int qemuMonitorGetCPUInfo(const virDomainObjPtr vm,
int **pids)
{

View File

@ -69,6 +69,8 @@ int qemuMonitorStartCPUs(virConnectPtr conn,
const virDomainObjPtr vm);
int qemuMonitorStopCPUs(const virDomainObjPtr vm);
int qemuMonitorSystemPowerdown(const virDomainObjPtr vm);
int qemuMonitorGetCPUInfo(const virDomainObjPtr vm,
int **pids);