unsigned int *nparams,
unsigned int flags);
+int virDomainSetGuestVcpus(virDomainPtr domain,
+ const char *cpumap,
+ int state,
+ unsigned int flags);
+
#endif /* __VIR_LIBVIRT_DOMAIN_H__ */
unsigned int *nparams,
unsigned int flags);
+typedef int
+(*virDrvDomainSetGuestVcpus)(virDomainPtr domain,
+ const char *cpumap,
+ int state,
+ unsigned int flags);
+
typedef struct _virHypervisorDriver virHypervisorDriver;
typedef virHypervisorDriver *virHypervisorDriverPtr;
virDrvConnectUnregisterCloseCallback connectUnregisterCloseCallback;
virDrvDomainMigrateStartPostCopy domainMigrateStartPostCopy;
virDrvDomainGetGuestVcpus domainGetGuestVcpus;
+ virDrvDomainSetGuestVcpus domainSetGuestVcpus;
};
virDispatchError(domain->conn);
return -1;
}
+
+
+/**
+ * virDomainSetGuestVcpus:
+ * @domain: pointer to domain object
+ * @cpumap: text representation of a bitmap of vcpus to set
+ * @state: 0 to disable/1 to enable cpus described by @cpumap
+ * @flags: currently unused, callers shall pass 0
+ *
+ * Sets state of individual vcpus described by @cpumap via guest agent. Other
+ * vcpus are not modified.
+ *
+ * This API requires the VM to run. Various hypervisors or guest agent
+ * implementation may limit to operate on just 1 vCPU per call.
+ *
+ * @cpumap is a list of vCPU numbers. Its syntax is a comma separated list and
+ * a special markup using '-' and '^' (ex. '0-4', '0-3,^2'). The '-' denotes
+ * the range and the '^' denotes exclusive. The expression is sequentially
+ * evaluated, so "0-15,^8" is identical to "9-14,0-7,15" but not identical to
+ * "^8,0-15".
+ *
+ * Note that OSes (notably Linux) may require vCPU 0 to stay online to support
+ * low-level features a S3 sleep.
+ *
+ * Returns 0 on success, -1 on error.
+ */
+int
+virDomainSetGuestVcpus(virDomainPtr domain,
+ const char *cpumap,
+ int state,
+ unsigned int flags)
+{
+ VIR_DOMAIN_DEBUG(domain, "cpumap='%s' state=%x flags=%x",
+ NULLSTR(cpumap), state, flags);
+
+ virResetLastError();
+
+ virCheckDomainReturn(domain, -1);
+ virCheckNonNullArgGoto(cpumap, error);
+
+ if (domain->conn->driver->domainSetGuestVcpus) {
+ int ret;
+ ret = domain->conn->driver->domainSetGuestVcpus(domain, cpumap, state,
+ flags);
+ if (ret < 0)
+ goto error;
+ return ret;
+ }
+
+ virReportUnsupportedError();
+
+ error:
+ virDispatchError(domain->conn);
+ return -1;
+}
virConnectStoragePoolEventRegisterAny;
virConnectStoragePoolEventDeregisterAny;
virDomainGetGuestVcpus;
+ virDomainSetGuestVcpus;
} LIBVIRT_1.3.3;
# .... define new API here using predicted next version number ....
.connectUnregisterCloseCallback = remoteConnectUnregisterCloseCallback, /* 1.3.2 */
.domainMigrateStartPostCopy = remoteDomainMigrateStartPostCopy, /* 1.3.3 */
.domainGetGuestVcpus = remoteDomainGetGuestVcpus, /* 2.0.0 */
+ .domainSetGuestVcpus = remoteDomainSetGuestVcpus, /* 2.0.0 */
};
static virNetworkDriver network_driver = {
remote_typed_param params<REMOTE_DOMAIN_GUEST_VCPU_PARAMS_MAX>; /* alloc@1@unsigned int@2 */
};
+struct remote_domain_set_guest_vcpus_args {
+ remote_nonnull_domain dom;
+ remote_nonnull_string cpumap;
+ int state;
+ unsigned int flags;
+};
+
/*----- Protocol. -----*/
* @generate: both
* @acl: domain:write
*/
- REMOTE_PROC_DOMAIN_GET_GUEST_VCPUS = 371
+ REMOTE_PROC_DOMAIN_GET_GUEST_VCPUS = 371,
+
+ /**
+ * @generate: both
+ * @acl: domain:write
+ */
+ REMOTE_PROC_DOMAIN_SET_GUEST_VCPUS = 372
};
remote_typed_param * params_val;
} params;
};
+struct remote_domain_set_guest_vcpus_args {
+ remote_nonnull_domain dom;
+ remote_nonnull_string cpumap;
+ int state;
+ u_int flags;
+};
enum remote_procedure {
REMOTE_PROC_CONNECT_OPEN = 1,
REMOTE_PROC_CONNECT_CLOSE = 2,
REMOTE_PROC_CONNECT_STORAGE_POOL_EVENT_DEREGISTER_ANY = 369,
REMOTE_PROC_STORAGE_POOL_EVENT_LIFECYCLE = 370,
REMOTE_PROC_DOMAIN_GET_GUEST_VCPUS = 371,
+ REMOTE_PROC_DOMAIN_SET_GUEST_VCPUS = 372,
};