mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-07-30 21:47:18 +00:00
setvcpus: extend virDomainSetVcpusFlags API to support current flag
This patch extends virDomainSetVcpusFlags API to support VIR_DOMAIN_AFFECT_CURRENT flag. Now because most APIs accept VIR_DOMAIN_AFFECT_CURRENT flags, virDomainSetVcpusFlags API should also do. Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
This commit is contained in:
parent
cf81318cb7
commit
ceb0ed5d97
@ -1234,8 +1234,8 @@ typedef virVcpuInfo *virVcpuInfoPtr;
|
|||||||
|
|
||||||
/* Flags for controlling virtual CPU hot-plugging. */
|
/* Flags for controlling virtual CPU hot-plugging. */
|
||||||
typedef enum {
|
typedef enum {
|
||||||
/* Must choose at least one of these two bits; SetVcpus can choose both;
|
/* See virDomainModificationImpact for these flags. */
|
||||||
see virDomainModificationImpact for details. */
|
VIR_DOMAIN_VCPU_CURRENT = VIR_DOMAIN_AFFECT_CURRENT,
|
||||||
VIR_DOMAIN_VCPU_LIVE = VIR_DOMAIN_AFFECT_LIVE,
|
VIR_DOMAIN_VCPU_LIVE = VIR_DOMAIN_AFFECT_LIVE,
|
||||||
VIR_DOMAIN_VCPU_CONFIG = VIR_DOMAIN_AFFECT_CONFIG,
|
VIR_DOMAIN_VCPU_CONFIG = VIR_DOMAIN_AFFECT_CONFIG,
|
||||||
|
|
||||||
|
@ -6863,10 +6863,14 @@ error:
|
|||||||
* does not support it or if growing the number is arbitrary limited.
|
* does not support it or if growing the number is arbitrary limited.
|
||||||
* This function requires privileged access to the hypervisor.
|
* This function requires privileged access to the hypervisor.
|
||||||
*
|
*
|
||||||
* @flags must include VIR_DOMAIN_AFFECT_LIVE to affect a running
|
* @flags may include VIR_DOMAIN_AFFECT_LIVE to affect a running
|
||||||
* domain (which may fail if domain is not active), or
|
* domain (which may fail if domain is not active), or
|
||||||
* VIR_DOMAIN_AFFECT_CONFIG to affect the next boot via the XML
|
* VIR_DOMAIN_AFFECT_CONFIG to affect the next boot via the XML
|
||||||
* description of the domain. Both flags may be set.
|
* description of the domain. Both flags may be set.
|
||||||
|
* If neither flag is specified (that is, @flags is VIR_DOMAIN_AFFECT_CURRENT),
|
||||||
|
* then an inactive domain modifies persistent setup, while an active domain
|
||||||
|
* is hypervisor-dependent on whether just live or both live and persistent
|
||||||
|
* state is changed.
|
||||||
*
|
*
|
||||||
* If @flags includes VIR_DOMAIN_VCPU_MAXIMUM, then
|
* If @flags includes VIR_DOMAIN_VCPU_MAXIMUM, then
|
||||||
* VIR_DOMAIN_AFFECT_LIVE must be clear, and only the maximum virtual
|
* VIR_DOMAIN_AFFECT_LIVE must be clear, and only the maximum virtual
|
||||||
@ -6874,6 +6878,7 @@ error:
|
|||||||
* equal to virConnectGetMaxVcpus(). Otherwise, this call affects the
|
* equal to virConnectGetMaxVcpus(). Otherwise, this call affects the
|
||||||
* current virtual CPU limit, which must be less than or equal to the
|
* current virtual CPU limit, which must be less than or equal to the
|
||||||
* maximum limit.
|
* maximum limit.
|
||||||
|
* Not all hypervisors can support all flag combinations.
|
||||||
*
|
*
|
||||||
* Returns 0 in case of success, -1 in case of failure.
|
* Returns 0 in case of success, -1 in case of failure.
|
||||||
*/
|
*/
|
||||||
@ -6899,8 +6904,7 @@ virDomainSetVcpusFlags(virDomainPtr domain, unsigned int nvcpus,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Perform some argument validation common to all implementations. */
|
/* Perform some argument validation common to all implementations. */
|
||||||
if (nvcpus < 1 || (unsigned short) nvcpus != nvcpus ||
|
if (nvcpus < 1 || (unsigned short) nvcpus != nvcpus) {
|
||||||
(flags & (VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG)) == 0) {
|
|
||||||
virLibDomainError(VIR_ERR_INVALID_ARG, __FUNCTION__);
|
virLibDomainError(VIR_ERR_INVALID_ARG, __FUNCTION__);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user