mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-12 13:17:58 +03:00
Introduce virDomainPMWakeup API
This API allows a domain which previously called virDomainPMSuspendForDuration() to be woken up.
This commit is contained in:
parent
9f748277bb
commit
e2822f19fd
@ -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
|
||||
*/
|
||||
|
@ -124,6 +124,9 @@ typedef int
|
||||
unsigned int target,
|
||||
unsigned long long duration,
|
||||
unsigned int flags);
|
||||
typedef int
|
||||
(*virDrvDomainPMWakeup) (virDomainPtr domain,
|
||||
unsigned int flags);
|
||||
typedef int
|
||||
(*virDrvDomainShutdown) (virDomainPtr domain);
|
||||
typedef int
|
||||
@ -867,8 +870,9 @@ struct _virDriver {
|
||||
virDrvDomainLookupByUUID domainLookupByUUID;
|
||||
virDrvDomainLookupByName domainLookupByName;
|
||||
virDrvDomainSuspend domainSuspend;
|
||||
virDrvDomainPMSuspendForDuration domainPMSuspendForDuration;
|
||||
virDrvDomainResume domainResume;
|
||||
virDrvDomainPMSuspendForDuration domainPMSuspendForDuration;
|
||||
virDrvDomainPMWakeup domainPMWakeup;
|
||||
virDrvDomainShutdown domainShutdown;
|
||||
virDrvDomainShutdownFlags domainShutdownFlags;
|
||||
virDrvDomainReboot domainReboot;
|
||||
|
@ -2514,6 +2514,56 @@ error:
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
@ -529,4 +529,9 @@ LIBVIRT_0.9.10 {
|
||||
virStorageVolWipePattern;
|
||||
} LIBVIRT_0.9.9;
|
||||
|
||||
LIBVIRT_0.9.11 {
|
||||
global:
|
||||
virDomainPMWakeup;
|
||||
} LIBVIRT_0.9.10;
|
||||
|
||||
# .... define new API here using predicted next version number ....
|
||||
|
@ -4781,6 +4781,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 */
|
||||
|
@ -752,6 +752,10 @@ struct remote_domain_suspend_args {
|
||||
remote_nonnull_domain dom;
|
||||
};
|
||||
|
||||
struct remote_domain_resume_args {
|
||||
remote_nonnull_domain dom;
|
||||
};
|
||||
|
||||
struct remote_domain_pm_suspend_for_duration_args {
|
||||
remote_nonnull_domain dom;
|
||||
unsigned int target;
|
||||
@ -759,8 +763,9 @@ struct remote_domain_pm_suspend_for_duration_args {
|
||||
unsigned int flags;
|
||||
};
|
||||
|
||||
struct remote_domain_resume_args {
|
||||
struct remote_domain_pm_wakeup_args {
|
||||
remote_nonnull_domain dom;
|
||||
unsigned int flags;
|
||||
};
|
||||
|
||||
struct remote_domain_shutdown_args {
|
||||
@ -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 ?
|
||||
|
@ -444,14 +444,18 @@ struct remote_domain_lookup_by_name_ret {
|
||||
struct remote_domain_suspend_args {
|
||||
remote_nonnull_domain dom;
|
||||
};
|
||||
struct remote_domain_resume_args {
|
||||
remote_nonnull_domain dom;
|
||||
};
|
||||
struct remote_domain_pm_suspend_for_duration_args {
|
||||
remote_nonnull_domain dom;
|
||||
u_int target;
|
||||
uint64_t duration;
|
||||
u_int flags;
|
||||
};
|
||||
struct remote_domain_resume_args {
|
||||
struct remote_domain_pm_wakeup_args {
|
||||
remote_nonnull_domain dom;
|
||||
u_int flags;
|
||||
};
|
||||
struct remote_domain_shutdown_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,
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user