[libvirt] [PATCH v2 0/3] Introduce virDomainPMWakeup API

This is counterpart for virDomainPMSuspendForDuration API which we have already in. It allows user to wake up guest from S3 state. 1/3 is already ACKed, but I am sending it for the completeness sake. Michal Privoznik (3): Introduce virDomainPMWakeup API virsh: Expose virDomainPMWakeup qemu: Implement virDomainPMWakeup API include/libvirt/libvirt.h.in | 2 + src/driver.h | 4 +++ src/libvirt.c | 50 ++++++++++++++++++++++++++++++++++++++ src/libvirt_public.syms | 1 + src/qemu/qemu_driver.c | 55 ++++++++++++++++++++++++++++++++++++++++++ src/qemu/qemu_monitor.c | 19 ++++++++++++++ src/qemu/qemu_monitor.h | 2 + src/qemu/qemu_monitor_json.c | 21 ++++++++++++++++ src/qemu/qemu_monitor_json.h | 2 + src/remote/remote_driver.c | 1 + src/remote/remote_protocol.x | 8 +++++- src/remote_protocol-structs | 5 ++++ tools/virsh.c | 46 +++++++++++++++++++++++++++++++++++ tools/virsh.pod | 6 ++++ 14 files changed, 221 insertions(+), 1 deletions(-) -- 1.7.3.4

This API allows a domain which previously called virDomainPMSuspendForDuration() to be woken up. --- include/libvirt/libvirt.h.in | 2 + src/driver.h | 4 +++ src/libvirt.c | 50 ++++++++++++++++++++++++++++++++++++++++++ src/libvirt_public.syms | 1 + src/remote/remote_driver.c | 1 + src/remote/remote_protocol.x | 8 ++++++- src/remote_protocol-structs | 5 ++++ 7 files changed, 70 insertions(+), 1 deletions(-) diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in index 798ab07..7ef37c8 100644 --- a/include/libvirt/libvirt.h.in +++ b/include/libvirt/libvirt.h.in @@ -1251,6 +1251,8 @@ int virDomainPMSuspendForDuration (virDomainPtr domain, unsigned int target, unsigned long long duration, unsigned int flags); +int virDomainPMWakeup (virDomainPtr domain, + unsigned int flags); /* * Domain save/restore */ diff --git a/src/driver.h b/src/driver.h index d27fa99..e5b3763 100644 --- a/src/driver.h +++ b/src/driver.h @@ -125,6 +125,9 @@ typedef int unsigned long long duration, unsigned int flags); typedef int + (*virDrvDomainPMWakeup) (virDomainPtr domain, + unsigned int flags); +typedef int (*virDrvDomainShutdown) (virDomainPtr domain); typedef int (*virDrvDomainReboot) (virDomainPtr domain, @@ -868,6 +871,7 @@ struct _virDriver { virDrvDomainLookupByName domainLookupByName; virDrvDomainSuspend domainSuspend; virDrvDomainPMSuspendForDuration domainPMSuspendForDuration; + virDrvDomainPMWakeup domainPMWakeup; virDrvDomainResume domainResume; virDrvDomainShutdown domainShutdown; virDrvDomainShutdownFlags domainShutdownFlags; diff --git a/src/libvirt.c b/src/libvirt.c index a55d823..3c81a06 100644 --- a/src/libvirt.c +++ b/src/libvirt.c @@ -2515,6 +2515,56 @@ error: } /** + * virDomainPMWakeup: + * @dom: a domain object + * @flags: extra flags; not used yet, so callers should always pass 0 + * + * Inject a wakeup into the guest that previously used + * virDomainPMSuspendForDuration, rather than waiting for the + * previously requested duration (if any) to elapse. + * + * Returns: 0 on success, + * -1 on failure. + */ +int +virDomainPMWakeup(virDomainPtr dom, + unsigned int flags) +{ + virConnectPtr conn; + + VIR_DOMAIN_DEBUG(dom, "flags=%x", flags); + + virResetLastError(); + + if (!VIR_IS_CONNECTED_DOMAIN(dom)) { + virLibDomainError(VIR_ERR_INVALID_DOMAIN, __FUNCTION__); + virDispatchError(NULL); + return -1; + } + + conn = dom->conn; + + if (conn->flags & VIR_CONNECT_RO) { + virLibConnError(VIR_ERR_OPERATION_DENIED, __FUNCTION__); + goto error; + } + + if (conn->driver->domainPMWakeup) { + int ret; + ret = conn->driver->domainPMWakeup(dom, flags); + if (ret < 0) + goto error; + return ret; + } + + virLibConnError(VIR_ERR_NO_SUPPORT, __FUNCTION__); + +error: + virDispatchError(conn); + return -1; +} + +/** * virDomainSave: * @domain: a domain object * @to: path for the output file diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms index 7622b79..2059dc8 100644 --- a/src/libvirt_public.syms +++ b/src/libvirt_public.syms @@ -523,6 +523,7 @@ LIBVIRT_0.9.10 { virDomainGetDiskErrors; virDomainGetMetadata; virDomainPMSuspendForDuration; + virDomainPMWakeup; virDomainSetMetadata; virDomainShutdownFlags; virStorageVolResize; diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 2dacb70..6fdf13f 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -4782,6 +4782,7 @@ static virDriver remote_driver = { .domainSuspend = remoteDomainSuspend, /* 0.3.0 */ .domainResume = remoteDomainResume, /* 0.3.0 */ .domainPMSuspendForDuration = remoteDomainPMSuspendForDuration, /* 0.9.10 */ + .domainPMWakeup = remoteDomainPMWakeup, /* 0.9.11 */ .domainShutdown = remoteDomainShutdown, /* 0.3.0 */ .domainShutdownFlags = remoteDomainShutdownFlags, /* 0.9.10 */ .domainReboot = remoteDomainReboot, /* 0.3.0 */ diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x index 59774b2..b950103 100644 --- a/src/remote/remote_protocol.x +++ b/src/remote/remote_protocol.x @@ -759,6 +759,11 @@ struct remote_domain_pm_suspend_for_duration_args { unsigned int flags; }; +struct remote_domain_pm_wakeup_args { + remote_nonnull_domain dom; + unsigned int flags; +}; + struct remote_domain_resume_args { remote_nonnull_domain dom; }; @@ -2759,7 +2764,8 @@ enum remote_procedure { REMOTE_PROC_DOMAIN_GET_DISK_ERRORS = 263, /* skipgen skipgen */ REMOTE_PROC_DOMAIN_SET_METADATA = 264, /* autogen autogen */ REMOTE_PROC_DOMAIN_GET_METADATA = 265, /* autogen autogen */ - REMOTE_PROC_DOMAIN_BLOCK_REBASE = 266 /* autogen autogen */ + REMOTE_PROC_DOMAIN_BLOCK_REBASE = 266, /* autogen autogen */ + REMOTE_PROC_DOMAIN_PM_WAKEUP = 267 /* autogen autogen */ /* * Notice how the entries are grouped in sets of 10 ? diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs index 8492bee..5a6c7dd 100644 --- a/src/remote_protocol-structs +++ b/src/remote_protocol-structs @@ -450,6 +450,10 @@ struct remote_domain_pm_suspend_for_duration_args { uint64_t duration; u_int flags; }; +struct remote_domain_pm_wakeup_args { + remote_nonnull_domain dom; + u_int flags; +}; struct remote_domain_resume_args { remote_nonnull_domain dom; }; @@ -2173,4 +2177,5 @@ enum remote_procedure { REMOTE_PROC_DOMAIN_SET_METADATA = 264, REMOTE_PROC_DOMAIN_GET_METADATA = 265, REMOTE_PROC_DOMAIN_BLOCK_REBASE = 266, + REMOTE_PROC_DOMAIN_PM_WAKEUP = 267, }; -- 1.7.3.4

On 15.02.2012 16:04, Michal Privoznik wrote:
This API allows a domain which previously called virDomainPMSuspendForDuration() to be woken up. --- include/libvirt/libvirt.h.in | 2 + src/driver.h | 4 +++ src/libvirt.c | 50 ++++++++++++++++++++++++++++++++++++++++++ src/libvirt_public.syms | 1 + src/remote/remote_driver.c | 1 + src/remote/remote_protocol.x | 8 ++++++- src/remote_protocol-structs | 5 ++++ 7 files changed, 70 insertions(+), 1 deletions(-)
diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms index 7622b79..2059dc8 100644 --- a/src/libvirt_public.syms +++ b/src/libvirt_public.syms @@ -523,6 +523,7 @@ LIBVIRT_0.9.10 { virDomainGetDiskErrors; virDomainGetMetadata; virDomainPMSuspendForDuration; + virDomainPMWakeup; virDomainSetMetadata; virDomainShutdownFlags; virStorageVolResize;
I knew I've forgotten something during rebase onto current HEAD. LIBVIRT_0.9.11 of course.

On 02/15/2012 08:04 AM, Michal Privoznik wrote:
This API allows a domain which previously called virDomainPMSuspendForDuration() to be woken up. --- include/libvirt/libvirt.h.in | 2 + src/driver.h | 4 +++ src/libvirt.c | 50 ++++++++++++++++++++++++++++++++++++++++++ src/libvirt_public.syms | 1 + src/remote/remote_driver.c | 1 + src/remote/remote_protocol.x | 8 ++++++- src/remote_protocol-structs | 5 ++++ 7 files changed, 70 insertions(+), 1 deletions(-)
@@ -868,6 +871,7 @@ struct _virDriver { virDrvDomainLookupByName domainLookupByName; virDrvDomainSuspend domainSuspend; virDrvDomainPMSuspendForDuration domainPMSuspendForDuration; + virDrvDomainPMWakeup domainPMWakeup; virDrvDomainResume domainResume;
It looks weird to have Suspend/Resume (one logical pair) split in the middle by PMSuspend/PMWakeup (another logical pair). Please swap things to put domainResume before either of the domainPM* members.
+++ b/src/libvirt_public.syms @@ -523,6 +523,7 @@ LIBVIRT_0.9.10 { virDomainGetDiskErrors; virDomainGetMetadata; virDomainPMSuspendForDuration; + virDomainPMWakeup;
You already caught your error here. :)
+++ b/src/remote/remote_driver.c @@ -4782,6 +4782,7 @@ static virDriver remote_driver = { .domainSuspend = remoteDomainSuspend, /* 0.3.0 */ .domainResume = remoteDomainResume, /* 0.3.0 */ .domainPMSuspendForDuration = remoteDomainPMSuspendForDuration, /* 0.9.10 */ + .domainPMWakeup = remoteDomainPMWakeup, /* 0.9.11 */ .domainShutdown = remoteDomainShutdown, /* 0.3.0 */
Another place worth re-shuffling.
+++ b/src/remote/remote_protocol.x @@ -759,6 +759,11 @@ struct remote_domain_pm_suspend_for_duration_args { unsigned int flags; };
+struct remote_domain_pm_wakeup_args { + remote_nonnull_domain dom; + unsigned int flags; +}; + struct remote_domain_resume_args {
And another. But the shuffling should be trivial, so I'm okay without having to see a v3. ACK with nits fixed -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

--- tools/virsh.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ tools/virsh.pod | 6 ++++++ 2 files changed, 52 insertions(+), 0 deletions(-) diff --git a/tools/virsh.c b/tools/virsh.c index 66ba61c..4971e36 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -2436,6 +2436,50 @@ cleanup: } /* + * "dompmwakeup" command + */ + +static const vshCmdInfo info_dom_pm_wakeup[] = { + {"help", N_("wakeup a domain suspended by dompmsuspend command")}, + {"desc", N_("Wakeup a domain previously suspended " + "by dompmsuspend command.")}, + {NULL, NULL} +}; + +static const vshCmdOptDef opts_dom_pm_wakeup[] = { + {"domain", VSH_OT_DATA, VSH_OFLAG_REQ, N_("domain name, id or uuid")}, + {NULL, 0, 0, NULL} +}; +cmdDomPMWakeup(vshControl *ctl, const vshCmd *cmd) +{ + virDomainPtr dom; + const char *name; + bool ret = false; + unsigned int flags = 0; + + if (!vshConnectionUsability(ctl, ctl->conn)) + return false; + + if (!(dom = vshCommandOptDomain(ctl, cmd, &name))) + return false; + + if (virDomainPMWakeup(dom, flags) < 0) { + vshError(ctl, _("Domain %s could not be woken up"), + virDomainGetName(dom)); + goto cleanup; + } + + vshPrint(ctl, _("Domain %s successfully woken up"), + virDomainGetName(dom)); + + ret = true; + +cleanup: + virDomainFree(dom); + return ret; +} + +/* * "create" command */ static const vshCmdInfo info_create[] = { @@ -16458,6 +16502,8 @@ static const vshCmdDef domManagementCmds[] = { {"domname", cmdDomname, opts_domname, info_domname, 0}, {"dompmsuspend", cmdDomPMSuspend, opts_dom_pm_suspend, info_dom_pm_suspend, 0}, + {"dompmwakeup", cmdDomPMWakeup, + opts_dom_pm_wakeup, info_dom_pm_wakeup, 0}, {"domuuid", cmdDomuuid, opts_domuuid, info_domuuid, 0}, {"domxml-from-native", cmdDomXMLFromNative, opts_domxmlfromnative, info_domxmlfromnative, 0}, diff --git a/tools/virsh.pod b/tools/virsh.pod index 6730b8b..75690e5 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -1289,6 +1289,12 @@ values): disk equivallent of S4 ACPI state hybrid RAM is saved to disk but not powered off +=item B<dompmwakeup> I<domain-id> + +Wakeup a domain suspended by dompmsuspend command. Injects a wakeup +into the guest that previously used dompmsuspend, rather than waiting +for the previously requested duration (if any) to elapse. + =item B<ttyconsole> I<domain-id> Output the device used for the TTY console of the domain. If the information -- 1.7.3.4

On 02/15/2012 08:04 AM, Michal Privoznik wrote:
--- tools/virsh.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ tools/virsh.pod | 6 ++++++ 2 files changed, 52 insertions(+), 0 deletions(-)
ACK. I'm wondering, though, if we should make this command smarter (as a followup patch). The API for dompmsuspend made it into 0.9.10, but dompmwakeup depends on 0.9.11. Fortunately, out of the box, 0.9.10 always fails on dompmsuspend (we didn't implement anything in qemu). But for backport situations (such as what I'm guessing RHEL will want to do), where you can backport implementation but not API, then we will have the (unfortunate) case that dompmsuspend might work while dompmwakeup fails for anyone that bases a release on the 0.9.10 API. Is it worth adding a virsh flag, so that 'dompmwakeup dom --qemu' tries virDomainPMWakeup, and if it fails, it then falls back to trying virDomainQemuMonitorCommand to issue a raw "system_wakeup" monitor command rather than completely giving up? -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

using 'system-wakeup' monitor command. It is supported only in JSON, as we are enabling it if possible. Moreover, this command is available in qemu-1.1+ which definitely has JSON. --- src/qemu/qemu_driver.c | 55 ++++++++++++++++++++++++++++++++++++++++++ src/qemu/qemu_monitor.c | 19 ++++++++++++++ src/qemu/qemu_monitor.h | 2 + src/qemu/qemu_monitor_json.c | 21 ++++++++++++++++ src/qemu/qemu_monitor_json.h | 2 + 5 files changed, 99 insertions(+), 0 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index fddf8c6..c5b23af 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -12164,6 +12164,60 @@ cleanup: return ret; } +static int qemuDomainPMWakeup(virDomainPtr dom, + unsigned int flags) +{ + struct qemud_driver *driver = dom->conn->privateData; + virDomainObjPtr vm; + int ret = -1; + qemuDomainObjPrivatePtr priv; + + virCheckFlags(0, -1); + + qemuDriverLock(driver); + vm = virDomainFindByUUID(&driver->domains, dom->uuid); + qemuDriverUnlock(driver); + + if (!vm) { + char uuidstr[VIR_UUID_STRING_BUFLEN]; + virUUIDFormat(dom->uuid, uuidstr); + qemuReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); + goto cleanup; + } + + if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) + goto cleanup; + + if (!virDomainObjIsActive(vm)) { + qemuReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is not running")); + goto endjob; + } + + priv = vm->privateData; + + if (!qemuCapsGet(priv->qemuCaps, QEMU_CAPS_WAKEUP)) { + qemuReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("Unable to wake up domain due to " + "missing system_wakeup monitor command")); + goto endjob; + } + + qemuDomainObjEnterMonitor(driver, vm); + ret = qemuMonitorSystemWakeup(priv->mon); + qemuDomainObjExitMonitor(driver, vm); + +endjob: + if (qemuDomainObjEndJob(driver, vm) == 0) + vm = NULL; + +cleanup: + if (vm) + virDomainObjUnlock(vm); + return ret; +} + static virDriver qemuDriver = { .no = VIR_DRV_QEMU, .name = "QEMU", @@ -12322,6 +12376,7 @@ static virDriver qemuDriver = { .domainSetMetadata = qemuDomainSetMetadata, /* 0.9.10 */ .domainGetMetadata = qemuDomainGetMetadata, /* 0.9.10 */ .domainPMSuspendForDuration = qemuDomainPMSuspendForDuration, /* 0.9.11 */ + .domainPMWakeup = qemuDomainPMWakeup, /* 0.9.11 */ }; diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 93f3505..1e97046 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -2784,3 +2784,22 @@ int qemuMonitorOpenGraphics(qemuMonitorPtr mon, return ret; } + +int qemuMonitorSystemWakeup(qemuMonitorPtr mon) +{ + VIR_DEBUG("mon=%p", mon); + + if (!mon) { + qemuReportError(VIR_ERR_INVALID_ARG, "%s", + _("monitor must not be NULL")); + return -1; + } + + if (!mon->json) { + qemuReportError(VIR_ERR_NO_SUPPORT, "%s", + _("JSON monitor is required")); + return -1; + } + + return qemuMonitorJSONSystemWakeup(mon); +} diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 7c6c52b..cadd853 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -536,6 +536,8 @@ int qemuMonitorGetBlockIoThrottle(qemuMonitorPtr mon, const char *device, virDomainBlockIoTuneInfoPtr reply); +int qemuMonitorSystemWakeup(qemuMonitorPtr mon); + /** * When running two dd process and using <> redirection, we need a * shell that will not truncate files. These two strings serve that diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 513788a..e6e9a85 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -3492,3 +3492,24 @@ int qemuMonitorJSONGetBlockIoThrottle(qemuMonitorPtr mon, virJSONValueFree(result); return ret; } + +int qemuMonitorJSONSystemWakeup(qemuMonitorPtr mon) +{ + int ret = -1; + virJSONValuePtr cmd = NULL; + virJSONValuePtr reply = NULL; + + cmd = qemuMonitorJSONMakeCommand("system_wakeup", NULL); + if (!cmd) { + return -1; + } + + ret = qemuMonitorJSONCommand(mon, cmd, &reply); + + if (ret == 0) + ret = qemuMonitorJSONCheckError(cmd, reply); + + virJSONValueFree(cmd); + virJSONValueFree(reply); + return ret; +} diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index d0b3000..9c423a0 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -267,4 +267,6 @@ int qemuMonitorJSONGetBlockIoThrottle(qemuMonitorPtr mon, const char *device, virDomainBlockIoTuneInfoPtr reply); +int qemuMonitorJSONSystemWakeup(qemuMonitorPtr mon); + #endif /* QEMU_MONITOR_JSON_H */ -- 1.7.3.4

On 15.02.2012 16:04, Michal Privoznik wrote:
using 'system-wakeup' monitor command. It is supported only in JSON, as we are enabling it if possible. Moreover, this command is available in qemu-1.1+ which definitely has JSON. --- src/qemu/qemu_driver.c | 55 ++++++++++++++++++++++++++++++++++++++++++ src/qemu/qemu_monitor.c | 19 ++++++++++++++ src/qemu/qemu_monitor.h | 2 + src/qemu/qemu_monitor_json.c | 21 ++++++++++++++++ src/qemu/qemu_monitor_json.h | 2 + 5 files changed, 99 insertions(+), 0 deletions(-)
Ping? Eric, it seems to me like you've forgotten this last patch. Michal

On 02/23/2012 01:44 AM, Michal Privoznik wrote:
On 15.02.2012 16:04, Michal Privoznik wrote:
using 'system-wakeup' monitor command. It is supported only in JSON, as we are enabling it if possible. Moreover, this command is available in qemu-1.1+ which definitely has JSON. --- src/qemu/qemu_driver.c | 55 ++++++++++++++++++++++++++++++++++++++++++ src/qemu/qemu_monitor.c | 19 ++++++++++++++ src/qemu/qemu_monitor.h | 2 + src/qemu/qemu_monitor_json.c | 21 ++++++++++++++++ src/qemu/qemu_monitor_json.h | 2 + 5 files changed, 99 insertions(+), 0 deletions(-)
Ping? Eric, it seems to me like you've forgotten this last patch.
Indeed, it fell off my stack of most-recently-pinged patches. Reviewing now, and thanks for the ping...
using 'system-wakeup' monitor command. It is supported only in JSON, as we are enabling it if possible. Moreover, this command is available in qemu-1.1+ which definitely has JSON. --- src/qemu/qemu_driver.c | 55 ++++++++++++++++++++++++++++++++++++++++++ src/qemu/qemu_monitor.c | 19 ++++++++++++++ src/qemu/qemu_monitor.h | 2 + src/qemu/qemu_monitor_json.c | 21 ++++++++++++++++ src/qemu/qemu_monitor_json.h | 2 + 5 files changed, 99 insertions(+), 0 deletions(-)
+static int qemuDomainPMWakeup(virDomainPtr dom, + unsigned int flags)
Style nit - we aren't very consistent on whether function names begin on line 1, but qemu_driver tends to use: static int qemuDomainPMWakeup(virDomainPtr dom, unsigned int flags)
+++ b/src/qemu/qemu_monitor_json.c @@ -3492,3 +3492,24 @@ int qemuMonitorJSONGetBlockIoThrottle(qemuMonitorPtr mon, virJSONValueFree(result); return ret; } + +int qemuMonitorJSONSystemWakeup(qemuMonitorPtr mon) +{ + int ret = -1; + virJSONValuePtr cmd = NULL; + virJSONValuePtr reply = NULL; + + cmd = qemuMonitorJSONMakeCommand("system_wakeup", NULL);
Seems so simple :) ACK. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On 25.02.2012 01:31, Eric Blake wrote:
On 02/23/2012 01:44 AM, Michal Privoznik wrote:
On 15.02.2012 16:04, Michal Privoznik wrote:
using 'system-wakeup' monitor command. It is supported only in JSON, as we are enabling it if possible. Moreover, this command is available in qemu-1.1+ which definitely has JSON. --- src/qemu/qemu_driver.c | 55 ++++++++++++++++++++++++++++++++++++++++++ src/qemu/qemu_monitor.c | 19 ++++++++++++++ src/qemu/qemu_monitor.h | 2 + src/qemu/qemu_monitor_json.c | 21 ++++++++++++++++ src/qemu/qemu_monitor_json.h | 2 + 5 files changed, 99 insertions(+), 0 deletions(-)
Ping? Eric, it seems to me like you've forgotten this last patch.
Indeed, it fell off my stack of most-recently-pinged patches. Reviewing now, and thanks for the ping...
using 'system-wakeup' monitor command. It is supported only in JSON, as we are enabling it if possible. Moreover, this command is available in qemu-1.1+ which definitely has JSON. --- src/qemu/qemu_driver.c | 55 ++++++++++++++++++++++++++++++++++++++++++ src/qemu/qemu_monitor.c | 19 ++++++++++++++ src/qemu/qemu_monitor.h | 2 + src/qemu/qemu_monitor_json.c | 21 ++++++++++++++++ src/qemu/qemu_monitor_json.h | 2 + 5 files changed, 99 insertions(+), 0 deletions(-)
+static int qemuDomainPMWakeup(virDomainPtr dom, + unsigned int flags)
Style nit - we aren't very consistent on whether function names begin on line 1, but qemu_driver tends to use:
static int qemuDomainPMWakeup(virDomainPtr dom, unsigned int flags)
+++ b/src/qemu/qemu_monitor_json.c @@ -3492,3 +3492,24 @@ int qemuMonitorJSONGetBlockIoThrottle(qemuMonitorPtr mon, virJSONValueFree(result); return ret; } + +int qemuMonitorJSONSystemWakeup(qemuMonitorPtr mon) +{ + int ret = -1; + virJSONValuePtr cmd = NULL; + virJSONValuePtr reply = NULL; + + cmd = qemuMonitorJSONMakeCommand("system_wakeup", NULL);
Seems so simple :)
ACK.
Thanks for review. Fixed all nits and pushed; Michal
participants (2)
-
Eric Blake
-
Michal Privoznik