mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 21:34:54 +03:00
Deprecate several CURRENT/LIVE/CONFIG enums
This patch deprecates following enums: VIR_DOMAIN_MEM_CURRENT VIR_DOMAIN_MEM_LIVE VIR_DOMAIN_MEM_CONFIG VIR_DOMAIN_VCPU_LIVE VIR_DOMAIN_VCPU_CONFIG VIR_DOMAIN_DEVICE_MODIFY_CURRENT VIR_DOMAIN_DEVICE_MODIFY_LIVE VIR_DOMAIN_DEVICE_MODIFY_CONFIG And modify internal codes to use virDomainModificationImpact.
This commit is contained in:
parent
f5358fdc72
commit
fbd7820b2c
@ -865,9 +865,12 @@ int virDomainGetMemoryParameters(virDomainPtr domain,
|
||||
|
||||
/* Memory size modification flags. */
|
||||
typedef enum {
|
||||
VIR_DOMAIN_MEM_CURRENT = 0, /* affect current domain state */
|
||||
VIR_DOMAIN_MEM_LIVE = (1 << 0), /* affect active domain */
|
||||
VIR_DOMAIN_MEM_CONFIG = (1 << 1), /* affect next boot */
|
||||
/* See virDomainModificationImpact for these flags. */
|
||||
VIR_DOMAIN_MEM_CURRENT = VIR_DOMAIN_AFFECT_CURRENT,
|
||||
VIR_DOMAIN_MEM_LIVE = VIR_DOMAIN_AFFECT_LIVE,
|
||||
VIR_DOMAIN_MEM_CONFIG = VIR_DOMAIN_AFFECT_CONFIG,
|
||||
|
||||
/* Additionally, these flags may be bitwise-OR'd in. */
|
||||
VIR_DOMAIN_MEM_MAXIMUM = (1 << 2), /* affect Max rather than current */
|
||||
} virDomainMemoryModFlags;
|
||||
|
||||
@ -1029,11 +1032,12 @@ typedef virVcpuInfo *virVcpuInfoPtr;
|
||||
|
||||
/* Flags for controlling virtual CPU hot-plugging. */
|
||||
typedef enum {
|
||||
/* Must choose at least one of these two bits; SetVcpus can choose both */
|
||||
VIR_DOMAIN_VCPU_LIVE = (1 << 0), /* Affect active domain */
|
||||
VIR_DOMAIN_VCPU_CONFIG = (1 << 1), /* Affect next boot */
|
||||
/* Must choose at least one of these two bits; SetVcpus can choose both;
|
||||
see virDomainModificationImpact for details. */
|
||||
VIR_DOMAIN_VCPU_LIVE = VIR_DOMAIN_AFFECT_LIVE,
|
||||
VIR_DOMAIN_VCPU_CONFIG = VIR_DOMAIN_AFFECT_CONFIG,
|
||||
|
||||
/* Additional flags to be bit-wise OR'd in */
|
||||
/* Additionally, these flags may be bitwise-OR'd in. */
|
||||
VIR_DOMAIN_VCPU_MAXIMUM = (1 << 2), /* Max rather than current count */
|
||||
} virDomainVcpuFlags;
|
||||
|
||||
@ -1142,12 +1146,14 @@ int virDomainGetVcpus (virDomainPtr domain,
|
||||
|
||||
|
||||
typedef enum {
|
||||
/* See virDomainModificationImpact for these flags. */
|
||||
VIR_DOMAIN_DEVICE_MODIFY_CURRENT = VIR_DOMAIN_AFFECT_CURRENT,
|
||||
VIR_DOMAIN_DEVICE_MODIFY_LIVE = VIR_DOMAIN_AFFECT_LIVE,
|
||||
VIR_DOMAIN_DEVICE_MODIFY_CONFIG = VIR_DOMAIN_AFFECT_CONFIG,
|
||||
|
||||
VIR_DOMAIN_DEVICE_MODIFY_CURRENT = 0, /* Modify device allocation based on current domain state */
|
||||
VIR_DOMAIN_DEVICE_MODIFY_LIVE = (1 << 0), /* Modify live device allocation */
|
||||
VIR_DOMAIN_DEVICE_MODIFY_CONFIG = (1 << 1), /* Modify persisted device allocation */
|
||||
VIR_DOMAIN_DEVICE_MODIFY_FORCE = (1 << 2), /* Forcibly modify device
|
||||
(ex. force eject a cdrom) */
|
||||
/* Additionally, these flags may be bitwise-OR'd in. */
|
||||
VIR_DOMAIN_DEVICE_MODIFY_FORCE = (1 << 2), /* Forcibly modify device
|
||||
(ex. force eject a cdrom) */
|
||||
} virDomainDeviceModifyFlags;
|
||||
|
||||
int virDomainAttachDevice(virDomainPtr domain, const char *xml);
|
||||
|
@ -166,6 +166,12 @@ def enum(type, name, value):
|
||||
value = 5
|
||||
elif value == 'VIR_TYPED_PARAM_BOOLEAN':
|
||||
value = 6
|
||||
elif value == 'VIR_DOMAIN_AFFECT_CURRENT':
|
||||
value = 0
|
||||
elif value == 'VIR_DOMAIN_AFFECT_LIVE':
|
||||
value = 1
|
||||
elif value == 'VIR_DOMAIN_AFFECT_CONFIG':
|
||||
value = 2
|
||||
enums[type][name] = value
|
||||
|
||||
#######################################################################
|
||||
|
@ -2535,7 +2535,7 @@ esxDomainSetVcpusFlags(virDomainPtr domain, unsigned int nvcpus,
|
||||
esxVI_TaskInfoState taskInfoState;
|
||||
char *taskInfoErrorMessage = NULL;
|
||||
|
||||
if (flags != VIR_DOMAIN_VCPU_LIVE) {
|
||||
if (flags != VIR_DOMAIN_AFFECT_LIVE) {
|
||||
ESX_ERROR(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
|
||||
return -1;
|
||||
}
|
||||
@ -2606,7 +2606,7 @@ esxDomainSetVcpusFlags(virDomainPtr domain, unsigned int nvcpus,
|
||||
static int
|
||||
esxDomainSetVcpus(virDomainPtr domain, unsigned int nvcpus)
|
||||
{
|
||||
return esxDomainSetVcpusFlags(domain, nvcpus, VIR_DOMAIN_VCPU_LIVE);
|
||||
return esxDomainSetVcpusFlags(domain, nvcpus, VIR_DOMAIN_AFFECT_LIVE);
|
||||
}
|
||||
|
||||
|
||||
@ -2619,7 +2619,7 @@ esxDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
|
||||
esxVI_ObjectContent *hostSystem = NULL;
|
||||
esxVI_DynamicProperty *dynamicProperty = NULL;
|
||||
|
||||
if (flags != (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
|
||||
if (flags != (VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
|
||||
ESX_ERROR(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
|
||||
return -1;
|
||||
}
|
||||
@ -2674,7 +2674,7 @@ esxDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
|
||||
static int
|
||||
esxDomainGetMaxVcpus(virDomainPtr domain)
|
||||
{
|
||||
return esxDomainGetVcpusFlags(domain, (VIR_DOMAIN_VCPU_LIVE |
|
||||
return esxDomainGetVcpusFlags(domain, (VIR_DOMAIN_AFFECT_LIVE |
|
||||
VIR_DOMAIN_VCPU_MAXIMUM));
|
||||
}
|
||||
|
||||
|
@ -2878,12 +2878,12 @@ error:
|
||||
* to Domain0 i.e. the domain where the application runs.
|
||||
* This function may requires privileged access to the hypervisor.
|
||||
*
|
||||
* @flags may include VIR_DOMAIN_MEM_LIVE or VIR_DOMAIN_MEM_CONFIG.
|
||||
* Both flags may be set. If VIR_DOMAIN_MEM_LIVE is set, the change affects
|
||||
* @flags may include VIR_DOMAIN_AFFECT_LIVE or VIR_DOMAIN_AFFECT_CONFIG.
|
||||
* Both flags may be set. If VIR_DOMAIN_AFFECT_LIVE is set, the change affects
|
||||
* a running domain and will fail if domain is not active.
|
||||
* If VIR_DOMAIN_MEM_CONFIG is set, the change affects persistent state,
|
||||
* If VIR_DOMAIN_AFFECT_CONFIG is set, the change affects persistent state,
|
||||
* and will fail for transient domains. If neither flag is specified
|
||||
* (that is, @flags is VIR_DOMAIN_MEM_CURRENT), then an inactive domain
|
||||
* (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 VIR_DOMAIN_MEM_MAXIMUM is set, the change affects domain's maximum memory
|
||||
@ -6527,13 +6527,13 @@ error:
|
||||
* does not support it or if growing the number is arbitrary limited.
|
||||
* This function requires privileged access to the hypervisor.
|
||||
*
|
||||
* @flags must include VIR_DOMAIN_VCPU_LIVE to affect a running
|
||||
* @flags must include VIR_DOMAIN_AFFECT_LIVE to affect a running
|
||||
* domain (which may fail if domain is not active), or
|
||||
* VIR_DOMAIN_VCPU_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.
|
||||
*
|
||||
* If @flags includes VIR_DOMAIN_VCPU_MAXIMUM, then
|
||||
* VIR_DOMAIN_VCPU_LIVE must be clear, and only the maximum virtual
|
||||
* VIR_DOMAIN_AFFECT_LIVE must be clear, and only the maximum virtual
|
||||
* CPU limit is altered; generally, this value must be less than or
|
||||
* equal to virConnectGetMaxVcpus(). Otherwise, this call affects the
|
||||
* current virtual CPU limit, which must be less than or equal to the
|
||||
@ -6564,7 +6564,7 @@ virDomainSetVcpusFlags(virDomainPtr domain, unsigned int nvcpus,
|
||||
|
||||
/* Perform some argument validation common to all implementations. */
|
||||
if (nvcpus < 1 || (unsigned short) nvcpus != nvcpus ||
|
||||
(flags & (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_CONFIG)) == 0) {
|
||||
(flags & (VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG)) == 0) {
|
||||
virLibDomainError(VIR_ERR_INVALID_ARG, __FUNCTION__);
|
||||
goto error;
|
||||
}
|
||||
@ -6623,7 +6623,7 @@ virDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
|
||||
}
|
||||
|
||||
/* Exactly one of these two flags should be set. */
|
||||
if (!(flags & VIR_DOMAIN_VCPU_LIVE) == !(flags & VIR_DOMAIN_VCPU_CONFIG)) {
|
||||
if (!(flags & VIR_DOMAIN_AFFECT_LIVE) == !(flags & VIR_DOMAIN_AFFECT_CONFIG)) {
|
||||
virLibDomainError(VIR_ERR_INVALID_ARG, __FUNCTION__);
|
||||
goto error;
|
||||
}
|
||||
@ -7047,11 +7047,11 @@ error:
|
||||
* @flags: an OR'ed set of virDomainDeviceModifyFlags
|
||||
*
|
||||
* Attach a virtual device to a domain, using the flags parameter
|
||||
* to control how the device is attached. VIR_DOMAIN_DEVICE_MODIFY_CURRENT
|
||||
* to control how the device is attached. VIR_DOMAIN_AFFECT_CURRENT
|
||||
* specifies that the device allocation is made based on current domain
|
||||
* state. VIR_DOMAIN_DEVICE_MODIFY_LIVE specifies that the device shall be
|
||||
* state. VIR_DOMAIN_AFFECT_LIVE specifies that the device shall be
|
||||
* allocated to the active domain instance only and is not added to the
|
||||
* persisted domain configuration. VIR_DOMAIN_DEVICE_MODIFY_CONFIG
|
||||
* persisted domain configuration. VIR_DOMAIN_AFFECT_CONFIG
|
||||
* specifies that the device shall be allocated to the persisted domain
|
||||
* configuration only. Note that the target hypervisor must return an
|
||||
* error if unable to satisfy flags. E.g. the hypervisor driver will
|
||||
@ -7164,11 +7164,11 @@ error:
|
||||
* @flags: an OR'ed set of virDomainDeviceModifyFlags
|
||||
*
|
||||
* Detach a virtual device from a domain, using the flags parameter
|
||||
* to control how the device is detached. VIR_DOMAIN_DEVICE_MODIFY_CURRENT
|
||||
* to control how the device is detached. VIR_DOMAIN_AFFECT_CURRENT
|
||||
* specifies that the device allocation is removed based on current domain
|
||||
* state. VIR_DOMAIN_DEVICE_MODIFY_LIVE specifies that the device shall be
|
||||
* state. VIR_DOMAIN_AFFECT_LIVE specifies that the device shall be
|
||||
* deallocated from the active domain instance only and is not from the
|
||||
* persisted domain configuration. VIR_DOMAIN_DEVICE_MODIFY_CONFIG
|
||||
* persisted domain configuration. VIR_DOMAIN_AFFECT_CONFIG
|
||||
* specifies that the device shall be deallocated from the persisted domain
|
||||
* configuration only. Note that the target hypervisor must return an
|
||||
* error if unable to satisfy flags. E.g. the hypervisor driver will
|
||||
@ -7226,11 +7226,11 @@ error:
|
||||
* @flags: an OR'ed set of virDomainDeviceModifyFlags
|
||||
*
|
||||
* Change a virtual device on a domain, using the flags parameter
|
||||
* to control how the device is changed. VIR_DOMAIN_DEVICE_MODIFY_CURRENT
|
||||
* to control how the device is changed. VIR_DOMAIN_AFFECT_CURRENT
|
||||
* specifies that the device change is made based on current domain
|
||||
* state. VIR_DOMAIN_DEVICE_MODIFY_LIVE specifies that the device shall be
|
||||
* state. VIR_DOMAIN_AFFECT_LIVE specifies that the device shall be
|
||||
* changed on the active domain instance only and is not added to the
|
||||
* persisted domain configuration. VIR_DOMAIN_DEVICE_MODIFY_CONFIG
|
||||
* persisted domain configuration. VIR_DOMAIN_AFFECT_CONFIG
|
||||
* specifies that the device shall be changed on the persisted domain
|
||||
* configuration only. Note that the target hypervisor must return an
|
||||
* error if unable to satisfy flags. E.g. the hypervisor driver will
|
||||
|
@ -1200,7 +1200,7 @@ static int
|
||||
openvzDomainGetVcpusFlags(virDomainPtr dom ATTRIBUTE_UNUSED,
|
||||
unsigned int flags)
|
||||
{
|
||||
if (flags != (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
|
||||
if (flags != (VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
|
||||
openvzError(VIR_ERR_INVALID_ARG, _("unsupported flags (0x%x)"), flags);
|
||||
return -1;
|
||||
}
|
||||
@ -1210,7 +1210,7 @@ openvzDomainGetVcpusFlags(virDomainPtr dom ATTRIBUTE_UNUSED,
|
||||
|
||||
static int openvzDomainGetMaxVcpus(virDomainPtr dom)
|
||||
{
|
||||
return openvzDomainGetVcpusFlags(dom, (VIR_DOMAIN_VCPU_LIVE |
|
||||
return openvzDomainGetVcpusFlags(dom, (VIR_DOMAIN_AFFECT_LIVE |
|
||||
VIR_DOMAIN_VCPU_MAXIMUM));
|
||||
}
|
||||
|
||||
@ -1244,7 +1244,7 @@ static int openvzDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
|
||||
struct openvz_driver *driver = dom->conn->privateData;
|
||||
int ret = -1;
|
||||
|
||||
if (flags != VIR_DOMAIN_VCPU_LIVE) {
|
||||
if (flags != VIR_DOMAIN_AFFECT_LIVE) {
|
||||
openvzError(VIR_ERR_INVALID_ARG, _("unsupported flags (0x%x)"), flags);
|
||||
return -1;
|
||||
}
|
||||
@ -1277,7 +1277,7 @@ cleanup:
|
||||
static int
|
||||
openvzDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus)
|
||||
{
|
||||
return openvzDomainSetVcpusFlags(dom, nvcpus, VIR_DOMAIN_VCPU_LIVE);
|
||||
return openvzDomainSetVcpusFlags(dom, nvcpus, VIR_DOMAIN_AFFECT_LIVE);
|
||||
}
|
||||
|
||||
static virDrvOpenStatus openvzOpen(virConnectPtr conn,
|
||||
|
@ -1593,8 +1593,8 @@ static int qemudDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem,
|
||||
int ret = -1, r;
|
||||
bool isActive;
|
||||
|
||||
virCheckFlags(VIR_DOMAIN_MEM_LIVE |
|
||||
VIR_DOMAIN_MEM_CONFIG |
|
||||
virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
|
||||
VIR_DOMAIN_AFFECT_CONFIG |
|
||||
VIR_DOMAIN_MEM_MAXIMUM, -1);
|
||||
|
||||
qemuDriverLock(driver);
|
||||
@ -1613,26 +1613,26 @@ static int qemudDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem,
|
||||
|
||||
isActive = virDomainObjIsActive(vm);
|
||||
|
||||
if (flags == VIR_DOMAIN_MEM_CURRENT) {
|
||||
if (flags == VIR_DOMAIN_AFFECT_CURRENT) {
|
||||
if (isActive)
|
||||
flags = VIR_DOMAIN_MEM_LIVE;
|
||||
flags = VIR_DOMAIN_AFFECT_LIVE;
|
||||
else
|
||||
flags = VIR_DOMAIN_MEM_CONFIG;
|
||||
flags = VIR_DOMAIN_AFFECT_CONFIG;
|
||||
}
|
||||
if (flags == VIR_DOMAIN_MEM_MAXIMUM) {
|
||||
if (isActive)
|
||||
flags = VIR_DOMAIN_MEM_LIVE | VIR_DOMAIN_MEM_MAXIMUM;
|
||||
flags = VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_MEM_MAXIMUM;
|
||||
else
|
||||
flags = VIR_DOMAIN_MEM_CONFIG | VIR_DOMAIN_MEM_MAXIMUM;
|
||||
flags = VIR_DOMAIN_AFFECT_CONFIG | VIR_DOMAIN_MEM_MAXIMUM;
|
||||
}
|
||||
|
||||
if (!isActive && (flags & VIR_DOMAIN_MEM_LIVE)) {
|
||||
if (!isActive && (flags & VIR_DOMAIN_AFFECT_LIVE)) {
|
||||
qemuReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("domain is not running"));
|
||||
goto endjob;
|
||||
}
|
||||
|
||||
if (flags & VIR_DOMAIN_MEM_CONFIG) {
|
||||
if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
|
||||
if (!vm->persistent) {
|
||||
qemuReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||
_("cannot change persistent config of a transient domain"));
|
||||
@ -1645,14 +1645,14 @@ static int qemudDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem,
|
||||
if (flags & VIR_DOMAIN_MEM_MAXIMUM) {
|
||||
/* resize the maximum memory */
|
||||
|
||||
if (flags & VIR_DOMAIN_MEM_LIVE) {
|
||||
if (flags & VIR_DOMAIN_AFFECT_LIVE) {
|
||||
qemuReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||
_("cannot resize the maximum memory on an "
|
||||
"active domain"));
|
||||
goto endjob;
|
||||
}
|
||||
|
||||
if (flags & VIR_DOMAIN_MEM_CONFIG) {
|
||||
if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
|
||||
/* Help clang 2.8 decipher the logic flow. */
|
||||
sa_assert(persistentDef);
|
||||
persistentDef->mem.max_balloon = newmem;
|
||||
@ -1671,7 +1671,7 @@ static int qemudDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem,
|
||||
goto endjob;
|
||||
}
|
||||
|
||||
if (flags & VIR_DOMAIN_MEM_LIVE) {
|
||||
if (flags & VIR_DOMAIN_AFFECT_LIVE) {
|
||||
priv = vm->privateData;
|
||||
qemuDomainObjEnterMonitor(vm);
|
||||
r = qemuMonitorSetBalloon(priv->mon, newmem);
|
||||
@ -1689,7 +1689,7 @@ static int qemudDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem,
|
||||
}
|
||||
}
|
||||
|
||||
if (flags & VIR_DOMAIN_MEM_CONFIG) {
|
||||
if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
|
||||
sa_assert(persistentDef);
|
||||
persistentDef->mem.cur_balloon = newmem;
|
||||
ret = virDomainSaveConfig(driver->configDir, persistentDef);
|
||||
@ -1710,7 +1710,7 @@ cleanup:
|
||||
|
||||
static int qemudDomainSetMemory(virDomainPtr dom, unsigned long newmem)
|
||||
{
|
||||
return qemudDomainSetMemoryFlags(dom, newmem, VIR_DOMAIN_MEM_LIVE);
|
||||
return qemudDomainSetMemoryFlags(dom, newmem, VIR_DOMAIN_AFFECT_LIVE);
|
||||
}
|
||||
|
||||
static int qemudDomainSetMaxMemory(virDomainPtr dom, unsigned long memory)
|
||||
@ -2758,15 +2758,15 @@ qemudDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
|
||||
int max;
|
||||
int ret = -1;
|
||||
|
||||
virCheckFlags(VIR_DOMAIN_VCPU_LIVE |
|
||||
VIR_DOMAIN_VCPU_CONFIG |
|
||||
virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
|
||||
VIR_DOMAIN_AFFECT_CONFIG |
|
||||
VIR_DOMAIN_VCPU_MAXIMUM, -1);
|
||||
|
||||
/* At least one of LIVE or CONFIG must be set. MAXIMUM cannot be
|
||||
* mixed with LIVE. */
|
||||
if ((flags & (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_CONFIG)) == 0 ||
|
||||
(flags & (VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_VCPU_LIVE)) ==
|
||||
(VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_VCPU_LIVE)) {
|
||||
if ((flags & (VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG)) == 0 ||
|
||||
(flags & (VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_AFFECT_LIVE)) ==
|
||||
(VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_AFFECT_LIVE)) {
|
||||
qemuReportError(VIR_ERR_INVALID_ARG,
|
||||
_("invalid flag combination: (0x%x)"), flags);
|
||||
return -1;
|
||||
@ -2792,13 +2792,13 @@ qemudDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
|
||||
if (qemuDomainObjBeginJob(vm) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (!virDomainObjIsActive(vm) && (flags & VIR_DOMAIN_VCPU_LIVE)) {
|
||||
if (!virDomainObjIsActive(vm) && (flags & VIR_DOMAIN_AFFECT_LIVE)) {
|
||||
qemuReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("domain is not running"));
|
||||
goto endjob;
|
||||
}
|
||||
|
||||
if (!vm->persistent && (flags & VIR_DOMAIN_VCPU_CONFIG)) {
|
||||
if (!vm->persistent && (flags & VIR_DOMAIN_AFFECT_CONFIG)) {
|
||||
qemuReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||
_("cannot change persistent config of a transient domain"));
|
||||
goto endjob;
|
||||
@ -2832,23 +2832,23 @@ qemudDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
|
||||
goto endjob;
|
||||
|
||||
switch (flags) {
|
||||
case VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_VCPU_CONFIG:
|
||||
case VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_AFFECT_CONFIG:
|
||||
persistentDef->maxvcpus = nvcpus;
|
||||
if (nvcpus < persistentDef->vcpus)
|
||||
persistentDef->vcpus = nvcpus;
|
||||
ret = 0;
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_VCPU_CONFIG:
|
||||
case VIR_DOMAIN_AFFECT_CONFIG:
|
||||
persistentDef->vcpus = nvcpus;
|
||||
ret = 0;
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_VCPU_LIVE:
|
||||
case VIR_DOMAIN_AFFECT_LIVE:
|
||||
ret = qemudDomainHotplugVcpus(vm, nvcpus);
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_CONFIG:
|
||||
case VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG:
|
||||
ret = qemudDomainHotplugVcpus(vm, nvcpus);
|
||||
if (ret == 0) {
|
||||
persistentDef->vcpus = nvcpus;
|
||||
@ -2857,7 +2857,7 @@ qemudDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
|
||||
}
|
||||
|
||||
/* Save the persistent config to disk */
|
||||
if (flags & VIR_DOMAIN_VCPU_CONFIG)
|
||||
if (flags & VIR_DOMAIN_AFFECT_CONFIG)
|
||||
ret = virDomainSaveConfig(driver->configDir, persistentDef);
|
||||
|
||||
endjob:
|
||||
@ -2873,7 +2873,7 @@ cleanup:
|
||||
static int
|
||||
qemudDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus)
|
||||
{
|
||||
return qemudDomainSetVcpusFlags(dom, nvcpus, VIR_DOMAIN_VCPU_LIVE);
|
||||
return qemudDomainSetVcpusFlags(dom, nvcpus, VIR_DOMAIN_AFFECT_LIVE);
|
||||
}
|
||||
|
||||
|
||||
@ -3099,12 +3099,12 @@ qemudDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags)
|
||||
virDomainDefPtr def;
|
||||
int ret = -1;
|
||||
|
||||
virCheckFlags(VIR_DOMAIN_VCPU_LIVE |
|
||||
VIR_DOMAIN_VCPU_CONFIG |
|
||||
virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
|
||||
VIR_DOMAIN_AFFECT_CONFIG |
|
||||
VIR_DOMAIN_VCPU_MAXIMUM, -1);
|
||||
|
||||
/* Exactly one of LIVE or CONFIG must be set. */
|
||||
if (!(flags & VIR_DOMAIN_VCPU_LIVE) == !(flags & VIR_DOMAIN_VCPU_CONFIG)) {
|
||||
if (!(flags & VIR_DOMAIN_AFFECT_LIVE) == !(flags & VIR_DOMAIN_AFFECT_CONFIG)) {
|
||||
qemuReportError(VIR_ERR_INVALID_ARG,
|
||||
_("invalid flag combination: (0x%x)"), flags);
|
||||
return -1;
|
||||
@ -3122,7 +3122,7 @@ qemudDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (flags & VIR_DOMAIN_VCPU_LIVE) {
|
||||
if (flags & VIR_DOMAIN_AFFECT_LIVE) {
|
||||
if (!virDomainObjIsActive(vm)) {
|
||||
qemuReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||
_("domain not active"));
|
||||
@ -3144,7 +3144,7 @@ cleanup:
|
||||
static int
|
||||
qemudDomainGetMaxVcpus(virDomainPtr dom)
|
||||
{
|
||||
return qemudDomainGetVcpusFlags(dom, (VIR_DOMAIN_VCPU_LIVE |
|
||||
return qemudDomainGetVcpusFlags(dom, (VIR_DOMAIN_AFFECT_LIVE |
|
||||
VIR_DOMAIN_VCPU_MAXIMUM));
|
||||
}
|
||||
|
||||
@ -4508,8 +4508,8 @@ qemuDomainModifyDeviceFlags(virDomainPtr dom, const char *xml,
|
||||
bool force = (flags & VIR_DOMAIN_DEVICE_MODIFY_FORCE) != 0;
|
||||
int ret = -1;
|
||||
|
||||
virCheckFlags(VIR_DOMAIN_DEVICE_MODIFY_LIVE |
|
||||
VIR_DOMAIN_DEVICE_MODIFY_CONFIG |
|
||||
virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
|
||||
VIR_DOMAIN_AFFECT_CONFIG |
|
||||
(action == QEMU_DEVICE_UPDATE ?
|
||||
VIR_DOMAIN_DEVICE_MODIFY_FORCE : 0), -1);
|
||||
|
||||
@ -4527,13 +4527,13 @@ qemuDomainModifyDeviceFlags(virDomainPtr dom, const char *xml,
|
||||
goto cleanup;
|
||||
|
||||
if (virDomainObjIsActive(vm)) {
|
||||
if (flags == VIR_DOMAIN_DEVICE_MODIFY_CURRENT)
|
||||
flags |= VIR_DOMAIN_DEVICE_MODIFY_LIVE;
|
||||
if (flags == VIR_DOMAIN_AFFECT_CURRENT)
|
||||
flags |= VIR_DOMAIN_AFFECT_LIVE;
|
||||
} else {
|
||||
if (flags == VIR_DOMAIN_DEVICE_MODIFY_CURRENT)
|
||||
flags |= VIR_DOMAIN_DEVICE_MODIFY_CONFIG;
|
||||
if (flags == VIR_DOMAIN_AFFECT_CURRENT)
|
||||
flags |= VIR_DOMAIN_AFFECT_CONFIG;
|
||||
/* check consistency between flags and the vm state */
|
||||
if (flags & VIR_DOMAIN_DEVICE_MODIFY_LIVE) {
|
||||
if (flags & VIR_DOMAIN_AFFECT_LIVE) {
|
||||
qemuReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s",
|
||||
_("cannot do live update a device on "
|
||||
@ -4542,13 +4542,13 @@ qemuDomainModifyDeviceFlags(virDomainPtr dom, const char *xml,
|
||||
}
|
||||
}
|
||||
|
||||
if ((flags & VIR_DOMAIN_DEVICE_MODIFY_CONFIG) && !vm->persistent) {
|
||||
if ((flags & VIR_DOMAIN_AFFECT_CONFIG) && !vm->persistent) {
|
||||
qemuReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("cannot modify device on transient domain"));
|
||||
goto endjob;
|
||||
}
|
||||
|
||||
if (flags & VIR_DOMAIN_DEVICE_MODIFY_CONFIG) {
|
||||
if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
|
||||
dev = virDomainDeviceDefParse(driver->caps, vm->def, xml,
|
||||
VIR_DOMAIN_XML_INACTIVE);
|
||||
if (dev == NULL)
|
||||
@ -4576,7 +4576,7 @@ qemuDomainModifyDeviceFlags(virDomainPtr dom, const char *xml,
|
||||
} else
|
||||
ret = 0;
|
||||
|
||||
if (!ret && (flags & VIR_DOMAIN_DEVICE_MODIFY_LIVE)) {
|
||||
if (!ret && (flags & VIR_DOMAIN_AFFECT_LIVE)) {
|
||||
/* If dev exists it was created to modify the domain config. Free it. */
|
||||
virDomainDeviceDefFree(dev);
|
||||
dev = virDomainDeviceDefParse(driver->caps, vm->def, xml,
|
||||
@ -4608,7 +4608,7 @@ qemuDomainModifyDeviceFlags(virDomainPtr dom, const char *xml,
|
||||
ret = -1;
|
||||
}
|
||||
/* Finally, if no error until here, we can save config. */
|
||||
if (!ret && (flags & VIR_DOMAIN_DEVICE_MODIFY_CONFIG)) {
|
||||
if (!ret && (flags & VIR_DOMAIN_AFFECT_CONFIG)) {
|
||||
ret = virDomainSaveConfig(driver->configDir, vmdef);
|
||||
if (!ret) {
|
||||
virDomainObjAssignDef(vm, vmdef, false);
|
||||
@ -4638,7 +4638,7 @@ static int qemuDomainAttachDeviceFlags(virDomainPtr dom, const char *xml,
|
||||
static int qemuDomainAttachDevice(virDomainPtr dom, const char *xml)
|
||||
{
|
||||
return qemuDomainAttachDeviceFlags(dom, xml,
|
||||
VIR_DOMAIN_DEVICE_MODIFY_LIVE);
|
||||
VIR_DOMAIN_AFFECT_LIVE);
|
||||
}
|
||||
|
||||
|
||||
@ -4658,7 +4658,7 @@ static int qemuDomainDetachDeviceFlags(virDomainPtr dom, const char *xml,
|
||||
static int qemuDomainDetachDevice(virDomainPtr dom, const char *xml)
|
||||
{
|
||||
return qemuDomainDetachDeviceFlags(dom, xml,
|
||||
VIR_DOMAIN_DEVICE_MODIFY_LIVE);
|
||||
VIR_DOMAIN_AFFECT_LIVE);
|
||||
}
|
||||
|
||||
static int qemudDomainGetAutostart(virDomainPtr dom,
|
||||
|
@ -2059,12 +2059,12 @@ testDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
|
||||
virDomainDefPtr def;
|
||||
int ret = -1;
|
||||
|
||||
virCheckFlags(VIR_DOMAIN_VCPU_LIVE |
|
||||
VIR_DOMAIN_VCPU_CONFIG |
|
||||
virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
|
||||
VIR_DOMAIN_AFFECT_CONFIG |
|
||||
VIR_DOMAIN_VCPU_MAXIMUM, -1);
|
||||
|
||||
/* Exactly one of LIVE or CONFIG must be set. */
|
||||
if (!(flags & VIR_DOMAIN_VCPU_LIVE) == !(flags & VIR_DOMAIN_VCPU_CONFIG)) {
|
||||
if (!(flags & VIR_DOMAIN_AFFECT_LIVE) == !(flags & VIR_DOMAIN_AFFECT_CONFIG)) {
|
||||
testError(VIR_ERR_INVALID_ARG,
|
||||
_("invalid flag combination: (0x%x)"), flags);
|
||||
return -1;
|
||||
@ -2082,7 +2082,7 @@ testDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (flags & VIR_DOMAIN_VCPU_LIVE) {
|
||||
if (flags & VIR_DOMAIN_AFFECT_LIVE) {
|
||||
if (!virDomainObjIsActive(vm)) {
|
||||
testError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||
_("domain not active"));
|
||||
@ -2104,7 +2104,7 @@ cleanup:
|
||||
static int
|
||||
testDomainGetMaxVcpus(virDomainPtr domain)
|
||||
{
|
||||
return testDomainGetVcpusFlags(domain, (VIR_DOMAIN_VCPU_LIVE |
|
||||
return testDomainGetVcpusFlags(domain, (VIR_DOMAIN_AFFECT_LIVE |
|
||||
VIR_DOMAIN_VCPU_MAXIMUM));
|
||||
}
|
||||
|
||||
@ -2117,15 +2117,15 @@ testDomainSetVcpusFlags(virDomainPtr domain, unsigned int nrCpus,
|
||||
virDomainDefPtr persistentDef;
|
||||
int ret = -1, maxvcpus;
|
||||
|
||||
virCheckFlags(VIR_DOMAIN_VCPU_LIVE |
|
||||
VIR_DOMAIN_VCPU_CONFIG |
|
||||
virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
|
||||
VIR_DOMAIN_AFFECT_CONFIG |
|
||||
VIR_DOMAIN_VCPU_MAXIMUM, -1);
|
||||
|
||||
/* At least one of LIVE or CONFIG must be set. MAXIMUM cannot be
|
||||
* mixed with LIVE. */
|
||||
if ((flags & (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_CONFIG)) == 0 ||
|
||||
(flags & (VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_VCPU_LIVE)) ==
|
||||
(VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_VCPU_LIVE)) {
|
||||
if ((flags & (VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG)) == 0 ||
|
||||
(flags & (VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_AFFECT_LIVE)) ==
|
||||
(VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_AFFECT_LIVE)) {
|
||||
testError(VIR_ERR_INVALID_ARG,
|
||||
_("invalid flag combination: (0x%x)"), flags);
|
||||
return -1;
|
||||
@ -2145,7 +2145,7 @@ testDomainSetVcpusFlags(virDomainPtr domain, unsigned int nrCpus,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!virDomainObjIsActive(privdom) && (flags & VIR_DOMAIN_VCPU_LIVE)) {
|
||||
if (!virDomainObjIsActive(privdom) && (flags & VIR_DOMAIN_AFFECT_LIVE)) {
|
||||
testError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("cannot hotplug vcpus for an inactive domain"));
|
||||
goto cleanup;
|
||||
@ -2169,23 +2169,23 @@ testDomainSetVcpusFlags(virDomainPtr domain, unsigned int nrCpus,
|
||||
goto cleanup;
|
||||
|
||||
switch (flags) {
|
||||
case VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_VCPU_CONFIG:
|
||||
case VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_AFFECT_CONFIG:
|
||||
persistentDef->maxvcpus = nrCpus;
|
||||
if (nrCpus < persistentDef->vcpus)
|
||||
persistentDef->vcpus = nrCpus;
|
||||
ret = 0;
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_VCPU_CONFIG:
|
||||
case VIR_DOMAIN_AFFECT_CONFIG:
|
||||
persistentDef->vcpus = nrCpus;
|
||||
ret = 0;
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_VCPU_LIVE:
|
||||
case VIR_DOMAIN_AFFECT_LIVE:
|
||||
ret = testDomainUpdateVCPUs(domain->conn, privdom, nrCpus, 0);
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_CONFIG:
|
||||
case VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG:
|
||||
ret = testDomainUpdateVCPUs(domain->conn, privdom, nrCpus, 0);
|
||||
if (ret == 0) {
|
||||
persistentDef->vcpus = nrCpus;
|
||||
@ -2202,7 +2202,7 @@ cleanup:
|
||||
static int
|
||||
testSetVcpus(virDomainPtr domain, unsigned int nrCpus)
|
||||
{
|
||||
return testDomainSetVcpusFlags(domain, nrCpus, VIR_DOMAIN_VCPU_LIVE);
|
||||
return testDomainSetVcpusFlags(domain, nrCpus, VIR_DOMAIN_AFFECT_LIVE);
|
||||
}
|
||||
|
||||
static int testDomainGetVcpus(virDomainPtr domain,
|
||||
|
@ -1831,7 +1831,7 @@ cleanup:
|
||||
static int umlDomainAttachDeviceFlags(virDomainPtr dom,
|
||||
const char *xml,
|
||||
unsigned int flags) {
|
||||
if (flags & VIR_DOMAIN_DEVICE_MODIFY_CONFIG) {
|
||||
if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
|
||||
umlReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("cannot modify the persistent configuration of a domain"));
|
||||
return -1;
|
||||
@ -1939,7 +1939,7 @@ cleanup:
|
||||
static int umlDomainDetachDeviceFlags(virDomainPtr dom,
|
||||
const char *xml,
|
||||
unsigned int flags) {
|
||||
if (flags & VIR_DOMAIN_DEVICE_MODIFY_CONFIG) {
|
||||
if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
|
||||
umlReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("cannot modify the persistent configuration of a domain"));
|
||||
return -1;
|
||||
|
@ -2044,7 +2044,7 @@ vboxDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
|
||||
PRUint32 CPUCount = nvcpus;
|
||||
nsresult rc;
|
||||
|
||||
if (flags != VIR_DOMAIN_VCPU_LIVE) {
|
||||
if (flags != VIR_DOMAIN_AFFECT_LIVE) {
|
||||
vboxError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
|
||||
return -1;
|
||||
}
|
||||
@ -2092,7 +2092,7 @@ vboxDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
|
||||
static int
|
||||
vboxDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus)
|
||||
{
|
||||
return vboxDomainSetVcpusFlags(dom, nvcpus, VIR_DOMAIN_VCPU_LIVE);
|
||||
return vboxDomainSetVcpusFlags(dom, nvcpus, VIR_DOMAIN_AFFECT_LIVE);
|
||||
}
|
||||
|
||||
static int
|
||||
@ -2102,7 +2102,7 @@ vboxDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags)
|
||||
ISystemProperties *systemProperties = NULL;
|
||||
PRUint32 maxCPUCount = 0;
|
||||
|
||||
if (flags != (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
|
||||
if (flags != (VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
|
||||
vboxError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
|
||||
return -1;
|
||||
}
|
||||
@ -2127,7 +2127,7 @@ vboxDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags)
|
||||
static int
|
||||
vboxDomainGetMaxVcpus(virDomainPtr dom)
|
||||
{
|
||||
return vboxDomainGetVcpusFlags(dom, (VIR_DOMAIN_VCPU_LIVE |
|
||||
return vboxDomainGetVcpusFlags(dom, (VIR_DOMAIN_AFFECT_LIVE |
|
||||
VIR_DOMAIN_VCPU_MAXIMUM));
|
||||
}
|
||||
|
||||
@ -5292,7 +5292,7 @@ static int vboxDomainAttachDevice(virDomainPtr dom, const char *xml) {
|
||||
|
||||
static int vboxDomainAttachDeviceFlags(virDomainPtr dom, const char *xml,
|
||||
unsigned int flags) {
|
||||
if (flags & VIR_DOMAIN_DEVICE_MODIFY_CONFIG) {
|
||||
if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
|
||||
vboxError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||
_("cannot modify the persistent configuration of a domain"));
|
||||
return -1;
|
||||
@ -5303,11 +5303,11 @@ static int vboxDomainAttachDeviceFlags(virDomainPtr dom, const char *xml,
|
||||
|
||||
static int vboxDomainUpdateDeviceFlags(virDomainPtr dom, const char *xml,
|
||||
unsigned int flags) {
|
||||
virCheckFlags(VIR_DOMAIN_DEVICE_MODIFY_CURRENT |
|
||||
VIR_DOMAIN_DEVICE_MODIFY_LIVE |
|
||||
VIR_DOMAIN_DEVICE_MODIFY_CONFIG, -1);
|
||||
virCheckFlags(VIR_DOMAIN_AFFECT_CURRENT |
|
||||
VIR_DOMAIN_AFFECT_LIVE |
|
||||
VIR_DOMAIN_AFFECT_CONFIG, -1);
|
||||
|
||||
if (flags & VIR_DOMAIN_DEVICE_MODIFY_CONFIG) {
|
||||
if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
|
||||
vboxError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||
_("cannot modify the persistent configuration of a domain"));
|
||||
return -1;
|
||||
@ -5442,7 +5442,7 @@ cleanup:
|
||||
|
||||
static int vboxDomainDetachDeviceFlags(virDomainPtr dom, const char *xml,
|
||||
unsigned int flags) {
|
||||
if (flags & VIR_DOMAIN_DEVICE_MODIFY_CONFIG) {
|
||||
if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
|
||||
vboxError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||
_("cannot modify the persistent configuration of a domain"));
|
||||
return -1;
|
||||
|
@ -2718,7 +2718,7 @@ cmdVcpucount(vshControl *ctl, const vshCmd *cmd)
|
||||
* up. */
|
||||
if (all || (maximum && config)) {
|
||||
count = virDomainGetVcpusFlags(dom, (VIR_DOMAIN_VCPU_MAXIMUM |
|
||||
VIR_DOMAIN_VCPU_CONFIG));
|
||||
VIR_DOMAIN_AFFECT_CONFIG));
|
||||
if (count < 0 && (last_error->code == VIR_ERR_NO_SUPPORT
|
||||
|| last_error->code == VIR_ERR_INVALID_ARG)) {
|
||||
char *tmp;
|
||||
@ -2748,7 +2748,7 @@ cmdVcpucount(vshControl *ctl, const vshCmd *cmd)
|
||||
|
||||
if (all || (maximum && live)) {
|
||||
count = virDomainGetVcpusFlags(dom, (VIR_DOMAIN_VCPU_MAXIMUM |
|
||||
VIR_DOMAIN_VCPU_LIVE));
|
||||
VIR_DOMAIN_AFFECT_LIVE));
|
||||
if (count < 0 && (last_error->code == VIR_ERR_NO_SUPPORT
|
||||
|| last_error->code == VIR_ERR_INVALID_ARG)) {
|
||||
count = virDomainGetMaxVcpus(dom);
|
||||
@ -2768,7 +2768,7 @@ cmdVcpucount(vshControl *ctl, const vshCmd *cmd)
|
||||
}
|
||||
|
||||
if (all || (current && config)) {
|
||||
count = virDomainGetVcpusFlags(dom, VIR_DOMAIN_VCPU_CONFIG);
|
||||
count = virDomainGetVcpusFlags(dom, VIR_DOMAIN_AFFECT_CONFIG);
|
||||
if (count < 0 && (last_error->code == VIR_ERR_NO_SUPPORT
|
||||
|| last_error->code == VIR_ERR_INVALID_ARG)) {
|
||||
char *tmp, *end;
|
||||
@ -2805,7 +2805,7 @@ cmdVcpucount(vshControl *ctl, const vshCmd *cmd)
|
||||
}
|
||||
|
||||
if (all || (current && live)) {
|
||||
count = virDomainGetVcpusFlags(dom, VIR_DOMAIN_VCPU_LIVE);
|
||||
count = virDomainGetVcpusFlags(dom, VIR_DOMAIN_AFFECT_LIVE);
|
||||
if (count < 0 && (last_error->code == VIR_ERR_NO_SUPPORT
|
||||
|| last_error->code == VIR_ERR_INVALID_ARG)) {
|
||||
virDomainInfo info;
|
||||
@ -3107,8 +3107,8 @@ cmdSetvcpus(vshControl *ctl, const vshCmd *cmd)
|
||||
int config = vshCommandOptBool(cmd, "config");
|
||||
int live = vshCommandOptBool(cmd, "live");
|
||||
int flags = ((maximum ? VIR_DOMAIN_VCPU_MAXIMUM : 0) |
|
||||
(config ? VIR_DOMAIN_VCPU_CONFIG : 0) |
|
||||
(live ? VIR_DOMAIN_VCPU_LIVE : 0));
|
||||
(config ? VIR_DOMAIN_AFFECT_CONFIG : 0) |
|
||||
(live ? VIR_DOMAIN_AFFECT_LIVE : 0));
|
||||
|
||||
if (!vshConnectionUsability(ctl, ctl->conn))
|
||||
return false;
|
||||
@ -3224,12 +3224,12 @@ cmdSetmem(vshControl *ctl, const vshCmd *cmd)
|
||||
vshError(ctl, "%s", _("--current must be specified exclusively"));
|
||||
return false;
|
||||
}
|
||||
flags = VIR_DOMAIN_MEM_CURRENT;
|
||||
flags = VIR_DOMAIN_AFFECT_CURRENT;
|
||||
} else {
|
||||
if (config)
|
||||
flags |= VIR_DOMAIN_MEM_CONFIG;
|
||||
flags |= VIR_DOMAIN_AFFECT_CONFIG;
|
||||
if (live)
|
||||
flags |= VIR_DOMAIN_MEM_LIVE;
|
||||
flags |= VIR_DOMAIN_AFFECT_LIVE;
|
||||
/* neither option is specified */
|
||||
if (!live && !config)
|
||||
flags = -1;
|
||||
@ -3315,9 +3315,9 @@ cmdSetmaxmem(vshControl *ctl, const vshCmd *cmd)
|
||||
}
|
||||
} else {
|
||||
if (config)
|
||||
flags |= VIR_DOMAIN_MEM_CONFIG;
|
||||
flags |= VIR_DOMAIN_AFFECT_CONFIG;
|
||||
if (live)
|
||||
flags |= VIR_DOMAIN_MEM_LIVE;
|
||||
flags |= VIR_DOMAIN_AFFECT_LIVE;
|
||||
/* neither option is specified */
|
||||
if (!live && !config)
|
||||
flags = -1;
|
||||
@ -9357,9 +9357,9 @@ cmdAttachDevice(vshControl *ctl, const vshCmd *cmd)
|
||||
}
|
||||
|
||||
if (vshCommandOptBool(cmd, "persistent")) {
|
||||
flags = VIR_DOMAIN_DEVICE_MODIFY_CONFIG;
|
||||
flags = VIR_DOMAIN_AFFECT_CONFIG;
|
||||
if (virDomainIsActive(dom) == 1)
|
||||
flags |= VIR_DOMAIN_DEVICE_MODIFY_LIVE;
|
||||
flags |= VIR_DOMAIN_AFFECT_LIVE;
|
||||
ret = virDomainAttachDeviceFlags(dom, buffer, flags);
|
||||
} else {
|
||||
ret = virDomainAttachDevice(dom, buffer);
|
||||
@ -9422,9 +9422,9 @@ cmdDetachDevice(vshControl *ctl, const vshCmd *cmd)
|
||||
}
|
||||
|
||||
if (vshCommandOptBool(cmd, "persistent")) {
|
||||
flags = VIR_DOMAIN_DEVICE_MODIFY_CONFIG;
|
||||
flags = VIR_DOMAIN_AFFECT_CONFIG;
|
||||
if (virDomainIsActive(dom) == 1)
|
||||
flags |= VIR_DOMAIN_DEVICE_MODIFY_LIVE;
|
||||
flags |= VIR_DOMAIN_AFFECT_LIVE;
|
||||
ret = virDomainDetachDeviceFlags(dom, buffer, flags);
|
||||
} else {
|
||||
ret = virDomainDetachDevice(dom, buffer);
|
||||
@ -9488,11 +9488,11 @@ cmdUpdateDevice(vshControl *ctl, const vshCmd *cmd)
|
||||
}
|
||||
|
||||
if (vshCommandOptBool(cmd, "persistent")) {
|
||||
flags = VIR_DOMAIN_DEVICE_MODIFY_CONFIG;
|
||||
flags = VIR_DOMAIN_AFFECT_CONFIG;
|
||||
if (virDomainIsActive(dom) == 1)
|
||||
flags |= VIR_DOMAIN_DEVICE_MODIFY_LIVE;
|
||||
flags |= VIR_DOMAIN_AFFECT_LIVE;
|
||||
} else {
|
||||
flags = VIR_DOMAIN_DEVICE_MODIFY_LIVE;
|
||||
flags = VIR_DOMAIN_AFFECT_LIVE;
|
||||
}
|
||||
|
||||
if (vshCommandOptBool(cmd, "force"))
|
||||
@ -9604,9 +9604,9 @@ cmdAttachInterface(vshControl *ctl, const vshCmd *cmd)
|
||||
xml = virBufferContentAndReset(&buf);
|
||||
|
||||
if (vshCommandOptBool(cmd, "persistent")) {
|
||||
flags = VIR_DOMAIN_DEVICE_MODIFY_CONFIG;
|
||||
flags = VIR_DOMAIN_AFFECT_CONFIG;
|
||||
if (virDomainIsActive(dom) == 1)
|
||||
flags |= VIR_DOMAIN_DEVICE_MODIFY_LIVE;
|
||||
flags |= VIR_DOMAIN_AFFECT_LIVE;
|
||||
ret = virDomainAttachDeviceFlags(dom, xml, flags);
|
||||
} else {
|
||||
ret = virDomainAttachDevice(dom, xml);
|
||||
@ -9743,9 +9743,9 @@ cmdDetachInterface(vshControl *ctl, const vshCmd *cmd)
|
||||
}
|
||||
|
||||
if (vshCommandOptBool(cmd, "persistent")) {
|
||||
flags = VIR_DOMAIN_DEVICE_MODIFY_CONFIG;
|
||||
flags = VIR_DOMAIN_AFFECT_CONFIG;
|
||||
if (virDomainIsActive(dom) == 1)
|
||||
flags |= VIR_DOMAIN_DEVICE_MODIFY_LIVE;
|
||||
flags |= VIR_DOMAIN_AFFECT_LIVE;
|
||||
ret = virDomainDetachDeviceFlags(dom,
|
||||
(char *)xmlBufferContent(xml_buf),
|
||||
flags);
|
||||
@ -9881,9 +9881,9 @@ cmdAttachDisk(vshControl *ctl, const vshCmd *cmd)
|
||||
xml = virBufferContentAndReset(&buf);
|
||||
|
||||
if (vshCommandOptBool(cmd, "persistent")) {
|
||||
flags = VIR_DOMAIN_DEVICE_MODIFY_CONFIG;
|
||||
flags = VIR_DOMAIN_AFFECT_CONFIG;
|
||||
if (virDomainIsActive(dom) == 1)
|
||||
flags |= VIR_DOMAIN_DEVICE_MODIFY_LIVE;
|
||||
flags |= VIR_DOMAIN_AFFECT_LIVE;
|
||||
ret = virDomainAttachDeviceFlags(dom, xml, flags);
|
||||
} else {
|
||||
ret = virDomainAttachDevice(dom, xml);
|
||||
@ -10003,9 +10003,9 @@ cmdDetachDisk(vshControl *ctl, const vshCmd *cmd)
|
||||
}
|
||||
|
||||
if (vshCommandOptBool(cmd, "persistent")) {
|
||||
flags = VIR_DOMAIN_DEVICE_MODIFY_CONFIG;
|
||||
flags = VIR_DOMAIN_AFFECT_CONFIG;
|
||||
if (virDomainIsActive(dom) == 1)
|
||||
flags |= VIR_DOMAIN_DEVICE_MODIFY_LIVE;
|
||||
flags |= VIR_DOMAIN_AFFECT_LIVE;
|
||||
ret = virDomainDetachDeviceFlags(dom,
|
||||
(char *)xmlBufferContent(xml_buf),
|
||||
flags);
|
||||
|
Loading…
Reference in New Issue
Block a user