int state,
unsigned int flags);
+int virDomainSetVcpu(virDomainPtr domain,
+ const char *vcpumap,
+ int state,
+ unsigned int flags);
+
#endif /* __VIR_LIBVIRT_DOMAIN_H__ */
int state,
unsigned int flags);
+typedef int
+(*virDrvDomainSetVcpu)(virDomainPtr domain,
+ const char *cpumap,
+ int state,
+ unsigned int flags);
+
typedef struct _virHypervisorDriver virHypervisorDriver;
typedef virHypervisorDriver *virHypervisorDriverPtr;
virDrvDomainMigrateStartPostCopy domainMigrateStartPostCopy;
virDrvDomainGetGuestVcpus domainGetGuestVcpus;
virDrvDomainSetGuestVcpus domainSetGuestVcpus;
+ virDrvDomainSetVcpu domainSetVcpu;
};
virDispatchError(domain->conn);
return -1;
}
+
+
+/**
+ * virDomainSetVcpu:
+ * @domain: pointer to domain object
+ * @vcpumap: text representation of a bitmap of vcpus to set
+ * @state: 0 to disable/1 to enable cpus described by @vcpumap
+ * @flags: bitwise-OR of virDomainModificationImpact
+ *
+ * Enables/disables individual vcpus described by @vcpumap in the hypervisor.
+ *
+ * Various hypervisor implementations may limit to operate on just 1
+ * hotpluggable entity (which may contain multiple vCPUs on certain platforms).
+ *
+ * Note that OSes and hypervisors may require vCPU 0 to stay online.
+ *
+ * Returns 0 on success, -1 on error.
+ */
+int
+virDomainSetVcpu(virDomainPtr domain,
+ const char *vcpumap,
+ int state,
+ unsigned int flags)
+{
+ VIR_DOMAIN_DEBUG(domain, "vcpumap='%s' state=%i flags=%x",
+ NULLSTR(vcpumap), state, flags);
+
+ virResetLastError();
+
+ virCheckDomainReturn(domain, -1);
+ virCheckReadOnlyGoto(domain->conn->flags, error);
+
+ virCheckNonNullArgGoto(vcpumap, error);
+
+ if (domain->conn->driver->domainSetVcpu) {
+ int ret;
+ ret = domain->conn->driver->domainSetVcpu(domain, vcpumap, state, flags);
+ if (ret < 0)
+ goto error;
+ return ret;
+ }
+
+ virReportUnsupportedError();
+
+ error:
+ virDispatchError(domain->conn);
+ return -1;
+}
virConnectSecretEventDeregisterAny;
} LIBVIRT_2.2.0;
+LIBVIRT_3.1.0 {
+ global:
+ virDomainSetVcpu;
+} LIBVIRT_3.0.0;
+
# .... define new API here using predicted next version number ....
.domainMigrateStartPostCopy = remoteDomainMigrateStartPostCopy, /* 1.3.3 */
.domainGetGuestVcpus = remoteDomainGetGuestVcpus, /* 2.0.0 */
.domainSetGuestVcpus = remoteDomainSetGuestVcpus, /* 2.0.0 */
+ .domainSetVcpu = remoteDomainSetVcpu, /* 3.1.0 */
};
static virNetworkDriver network_driver = {
unsigned int flags;
};
+struct remote_domain_set_vcpu_args {
+ remote_nonnull_domain dom;
+ remote_nonnull_string cpumap;
+ int state;
+ unsigned int flags;
+};
+
struct remote_domain_event_callback_metadata_change_msg {
int callbackID;
* @generate: both
* @acl: none
*/
- REMOTE_PROC_SECRET_EVENT_VALUE_CHANGED = 383
+ REMOTE_PROC_SECRET_EVENT_VALUE_CHANGED = 383,
+ /**
+ * @generate: both
+ * @acl: domain:write
+ * @acl: domain:save:!VIR_DOMAIN_AFFECT_CONFIG|VIR_DOMAIN_AFFECT_LIVE
+ * @acl: domain:save:VIR_DOMAIN_AFFECT_CONFIG
+ */
+ REMOTE_PROC_DOMAIN_SET_VCPU = 384
};
int state;
u_int flags;
};
+struct remote_domain_set_vcpu_args {
+ remote_nonnull_domain dom;
+ remote_nonnull_string cpumap;
+ int state;
+ u_int flags;
+};
struct remote_domain_event_callback_metadata_change_msg {
int callbackID;
remote_nonnull_domain dom;
REMOTE_PROC_CONNECT_SECRET_EVENT_DEREGISTER_ANY = 381,
REMOTE_PROC_SECRET_EVENT_LIFECYCLE = 382,
REMOTE_PROC_SECRET_EVENT_VALUE_CHANGED = 383,
+ REMOTE_PROC_DOMAIN_SET_VCPU = 384,
};