[libvirt] [PATCH v2 0/3] add support for changing blkio parameters for inactive domains

This series enables user to change blkio parameters for inactive domains from virsh command line. CHANGES: v1-v2: - unify PARAM_CONFIG/PARAM_LIVE/PARAM_CURRENT Hu Tao (3): unify PARAM_CURRENT/PARAM_LIVE/PARAM_CONFIG flags update qemuDomainGetBlkioParameters to use flags Update qemuDomainSetBlkioParameters to use flags include/libvirt/libvirt.h.in | 58 ++---- src/esx/esx_driver.c | 10 +- src/libvirt.c | 4 +- src/openvz/openvz_driver.c | 10 +- src/qemu/qemu_driver.c | 442 ++++++++++++++++++++++++++---------------- src/test/test_driver.c | 42 ++-- src/uml/uml_driver.c | 4 +- src/vbox/vbox_tmpl.c | 22 +- tools/virsh.c | 74 ++++---- 9 files changed, 371 insertions(+), 295 deletions(-) -- 1.7.3.1

This patch unify the PARAM_CURRENT/PARAM_LIVE/PARAM_CONFIG flags as Daniel Veillard suggested. --- include/libvirt/libvirt.h.in | 58 ++++--------- src/esx/esx_driver.c | 10 +- src/libvirt.c | 4 +- src/openvz/openvz_driver.c | 10 +- src/qemu/qemu_driver.c | 194 +++++++++++++++++++++--------------------- src/test/test_driver.c | 42 +++++----- src/uml/uml_driver.c | 4 +- src/vbox/vbox_tmpl.c | 22 +++--- tools/virsh.c | 74 ++++++++-------- 9 files changed, 196 insertions(+), 222 deletions(-) diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in index 8058229..8ef07b0 100644 --- a/include/libvirt/libvirt.h.in +++ b/include/libvirt/libvirt.h.in @@ -142,6 +142,22 @@ typedef enum { } virDomainCrashedReason; /** + * virDomainParamFlags: + * + * common flags for commands that support --current, --live, --config + * and --force parameters + */ + +typedef enum { + VIR_DOMAIN_PARAM_CURRENT = 0, /* affect current domain state */ + VIR_DOMAIN_PARAM_LIVE = (1 << 0), /* affect active domain */ + VIR_DOMAIN_PARAM_CONFIG = (1 << 1), /* affect next boot */ + VIR_DOMAIN_PARAM_FORCE = (1 << 2), /* Forcibly modify device + (ex. force eject a cdrom) */ + VIR_DOMAIN_PARAM_MAXIMUM = (1 << 3), /* affect Max rather than current */ +} virDomainParamFlags; + +/** * virDomainInfoPtr: * * a virDomainInfo is a structure filled by virDomainGetInfo() and extracting @@ -338,12 +354,6 @@ typedef virTypedParameter *virTypedParameterPtr; /* Management of scheduler parameters */ -typedef enum { - VIR_DOMAIN_SCHEDPARAM_CURRENT = 0, /* affect current domain state */ - VIR_DOMAIN_SCHEDPARAM_LIVE = (1 << 0), /* Affect active domain */ - VIR_DOMAIN_SCHEDPARAM_CONFIG = (1 << 1), /* Affect next boot */ -} virDomainSchedParameterFlags; - /* * Fetch scheduler parameters, caller allocates 'params' field of size 'nparams' */ @@ -799,13 +809,6 @@ int virDomainGetBlkioParameters(virDomainPtr domain, /* Manage memory parameters. */ -/* flags for setting memory parameters */ -typedef enum { - VIR_DOMAIN_MEMORY_PARAM_CURRENT = 0, /* affect current domain state */ - VIR_DOMAIN_MEMORY_PARAM_LIVE = (1 << 0), /* affect active domain */ - VIR_DOMAIN_MEMORY_PARAM_CONFIG = (1 << 1) /* affect next boot */ -} virMemoryParamFlags; - /** * VIR_DOMAIN_MEMORY_PARAM_UNLIMITED: * @@ -859,15 +862,6 @@ int virDomainGetMemoryParameters(virDomainPtr domain, virTypedParameterPtr params, int *nparams, unsigned int flags); -/* 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 */ - VIR_DOMAIN_MEM_MAXIMUM = (1 << 2), /* affect Max rather than current */ -} virDomainMemoryModFlags; - - /* * Dynamic control of domains */ @@ -1023,16 +1017,6 @@ struct _virVcpuInfo { }; 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 */ - - /* Additional flags to be bit-wise OR'd in */ - VIR_DOMAIN_VCPU_MAXIMUM = (1 << 2), /* Max rather than current count */ -} virDomainVcpuFlags; - int virDomainSetVcpus (virDomainPtr domain, unsigned int nvcpus); int virDomainSetVcpusFlags (virDomainPtr domain, @@ -1131,16 +1115,6 @@ int virDomainGetVcpus (virDomainPtr domain, */ #define VIR_GET_CPUMAP(cpumaps,maplen,vcpu) &(cpumaps[(vcpu)*(maplen)]) - -typedef enum { - - 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) */ -} virDomainDeviceModifyFlags; - int virDomainAttachDevice(virDomainPtr domain, const char *xml); int virDomainDetachDevice(virDomainPtr domain, const char *xml); diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c index 500dc52..ffce508 100644 --- a/src/esx/esx_driver.c +++ b/src/esx/esx_driver.c @@ -2540,7 +2540,7 @@ esxDomainSetVcpusFlags(virDomainPtr domain, unsigned int nvcpus, esxVI_TaskInfoState taskInfoState; char *taskInfoErrorMessage = NULL; - if (flags != VIR_DOMAIN_VCPU_LIVE) { + if (flags != VIR_DOMAIN_PARAM_LIVE) { ESX_ERROR(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags); return -1; } @@ -2611,7 +2611,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_PARAM_LIVE); } @@ -2624,7 +2624,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_PARAM_LIVE | VIR_DOMAIN_PARAM_MAXIMUM)) { ESX_ERROR(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags); return -1; } @@ -2679,8 +2679,8 @@ esxDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags) static int esxDomainGetMaxVcpus(virDomainPtr domain) { - return esxDomainGetVcpusFlags(domain, (VIR_DOMAIN_VCPU_LIVE | - VIR_DOMAIN_VCPU_MAXIMUM)); + return esxDomainGetVcpusFlags(domain, (VIR_DOMAIN_PARAM_LIVE | + VIR_DOMAIN_PARAM_MAXIMUM)); } diff --git a/src/libvirt.c b/src/libvirt.c index ee5c7cd..611e299 100644 --- a/src/libvirt.c +++ b/src/libvirt.c @@ -6616,7 +6616,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_PARAM_LIVE | VIR_DOMAIN_PARAM_CONFIG)) == 0) { virLibDomainError(VIR_ERR_INVALID_ARG, __FUNCTION__); goto error; } @@ -6675,7 +6675,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_PARAM_LIVE) == !(flags & VIR_DOMAIN_PARAM_CONFIG)) { virLibDomainError(VIR_ERR_INVALID_ARG, __FUNCTION__); goto error; } diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c index e24b5d8..0727bfa 100644 --- a/src/openvz/openvz_driver.c +++ b/src/openvz/openvz_driver.c @@ -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_PARAM_LIVE | VIR_DOMAIN_PARAM_MAXIMUM)) { openvzError(VIR_ERR_INVALID_ARG, _("unsupported flags (0x%x)"), flags); return -1; } @@ -1210,8 +1210,8 @@ openvzDomainGetVcpusFlags(virDomainPtr dom ATTRIBUTE_UNUSED, static int openvzDomainGetMaxVcpus(virDomainPtr dom) { - return openvzDomainGetVcpusFlags(dom, (VIR_DOMAIN_VCPU_LIVE | - VIR_DOMAIN_VCPU_MAXIMUM)); + return openvzDomainGetVcpusFlags(dom, (VIR_DOMAIN_PARAM_LIVE | + VIR_DOMAIN_PARAM_MAXIMUM)); } static int openvzDomainSetVcpusInternal(virDomainObjPtr vm, @@ -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_PARAM_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_PARAM_LIVE); } static virDrvOpenStatus openvzOpen(virConnectPtr conn, diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 8509391..43bb0fc 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -1584,9 +1584,9 @@ static int qemudDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem, int ret = -1, r; bool isActive; - virCheckFlags(VIR_DOMAIN_MEM_LIVE | - VIR_DOMAIN_MEM_CONFIG | - VIR_DOMAIN_MEM_MAXIMUM, -1); + virCheckFlags(VIR_DOMAIN_PARAM_LIVE | + VIR_DOMAIN_PARAM_CONFIG | + VIR_DOMAIN_PARAM_MAXIMUM, -1); qemuDriverLock(driver); vm = virDomainFindByUUID(&driver->domains, dom->uuid); @@ -1604,26 +1604,26 @@ static int qemudDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem, isActive = virDomainObjIsActive(vm); - if (flags == VIR_DOMAIN_MEM_CURRENT) { + if (flags == VIR_DOMAIN_PARAM_CURRENT) { if (isActive) - flags = VIR_DOMAIN_MEM_LIVE; + flags = VIR_DOMAIN_PARAM_LIVE; else - flags = VIR_DOMAIN_MEM_CONFIG; + flags = VIR_DOMAIN_PARAM_CONFIG; } - if (flags == VIR_DOMAIN_MEM_MAXIMUM) { + if (flags == VIR_DOMAIN_PARAM_MAXIMUM) { if (isActive) - flags = VIR_DOMAIN_MEM_LIVE | VIR_DOMAIN_MEM_MAXIMUM; + flags = VIR_DOMAIN_PARAM_LIVE | VIR_DOMAIN_PARAM_MAXIMUM; else - flags = VIR_DOMAIN_MEM_CONFIG | VIR_DOMAIN_MEM_MAXIMUM; + flags = VIR_DOMAIN_PARAM_CONFIG | VIR_DOMAIN_PARAM_MAXIMUM; } - if (!isActive && (flags & VIR_DOMAIN_MEM_LIVE)) { + if (!isActive && (flags & VIR_DOMAIN_PARAM_LIVE)) { qemuReportError(VIR_ERR_OPERATION_INVALID, "%s", _("domain is not running")); goto endjob; } - if (flags & VIR_DOMAIN_MEM_CONFIG) { + if (flags & VIR_DOMAIN_PARAM_CONFIG) { if (!vm->persistent) { qemuReportError(VIR_ERR_OPERATION_INVALID, "%s", _("cannot change persistent config of a transient domain")); @@ -1633,17 +1633,17 @@ static int qemudDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem, goto endjob; } - if (flags & VIR_DOMAIN_MEM_MAXIMUM) { + if (flags & VIR_DOMAIN_PARAM_MAXIMUM) { /* resize the maximum memory */ - if (flags & VIR_DOMAIN_MEM_LIVE) { + if (flags & VIR_DOMAIN_PARAM_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_PARAM_CONFIG) { /* Help clang 2.8 decipher the logic flow. */ sa_assert(persistentDef); persistentDef->mem.max_balloon = newmem; @@ -1662,7 +1662,7 @@ static int qemudDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem, goto endjob; } - if (flags & VIR_DOMAIN_MEM_LIVE) { + if (flags & VIR_DOMAIN_PARAM_LIVE) { priv = vm->privateData; qemuDomainObjEnterMonitor(vm); r = qemuMonitorSetBalloon(priv->mon, newmem); @@ -1680,7 +1680,7 @@ static int qemudDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem, } } - if (flags & VIR_DOMAIN_MEM_CONFIG) { + if (flags & VIR_DOMAIN_PARAM_CONFIG) { sa_assert(persistentDef); persistentDef->mem.cur_balloon = newmem; ret = virDomainSaveConfig(driver->configDir, persistentDef); @@ -1701,12 +1701,12 @@ cleanup: static int qemudDomainSetMemory(virDomainPtr dom, unsigned long newmem) { - return qemudDomainSetMemoryFlags(dom, newmem, VIR_DOMAIN_MEM_LIVE); + return qemudDomainSetMemoryFlags(dom, newmem, VIR_DOMAIN_PARAM_LIVE); } static int qemudDomainSetMaxMemory(virDomainPtr dom, unsigned long memory) { - return qemudDomainSetMemoryFlags(dom, memory, VIR_DOMAIN_MEM_MAXIMUM); + return qemudDomainSetMemoryFlags(dom, memory, VIR_DOMAIN_PARAM_MAXIMUM); } static int qemuDomainInjectNMI(virDomainPtr domain, unsigned int flags) @@ -2749,15 +2749,15 @@ qemudDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus, int max; int ret = -1; - virCheckFlags(VIR_DOMAIN_VCPU_LIVE | - VIR_DOMAIN_VCPU_CONFIG | - VIR_DOMAIN_VCPU_MAXIMUM, -1); + virCheckFlags(VIR_DOMAIN_PARAM_LIVE | + VIR_DOMAIN_PARAM_CONFIG | + VIR_DOMAIN_PARAM_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_PARAM_LIVE | VIR_DOMAIN_PARAM_CONFIG)) == 0 || + (flags & (VIR_DOMAIN_PARAM_MAXIMUM | VIR_DOMAIN_PARAM_LIVE)) == + (VIR_DOMAIN_PARAM_MAXIMUM | VIR_DOMAIN_PARAM_LIVE)) { qemuReportError(VIR_ERR_INVALID_ARG, _("invalid flag combination: (0x%x)"), flags); return -1; @@ -2783,13 +2783,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_PARAM_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_PARAM_CONFIG)) { qemuReportError(VIR_ERR_OPERATION_INVALID, "%s", _("cannot change persistent config of a transient domain")); goto endjob; @@ -2808,7 +2808,7 @@ qemudDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus, goto endjob; } - if (!(flags & VIR_DOMAIN_VCPU_MAXIMUM) && vm->def->maxvcpus < max) { + if (!(flags & VIR_DOMAIN_PARAM_MAXIMUM) && vm->def->maxvcpus < max) { max = vm->def->maxvcpus; } @@ -2823,23 +2823,23 @@ qemudDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus, goto endjob; switch (flags) { - case VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_VCPU_CONFIG: + case VIR_DOMAIN_PARAM_MAXIMUM | VIR_DOMAIN_PARAM_CONFIG: persistentDef->maxvcpus = nvcpus; if (nvcpus < persistentDef->vcpus) persistentDef->vcpus = nvcpus; ret = 0; break; - case VIR_DOMAIN_VCPU_CONFIG: + case VIR_DOMAIN_PARAM_CONFIG: persistentDef->vcpus = nvcpus; ret = 0; break; - case VIR_DOMAIN_VCPU_LIVE: + case VIR_DOMAIN_PARAM_LIVE: ret = qemudDomainHotplugVcpus(vm, nvcpus); break; - case VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_CONFIG: + case VIR_DOMAIN_PARAM_LIVE | VIR_DOMAIN_PARAM_CONFIG: ret = qemudDomainHotplugVcpus(vm, nvcpus); if (ret == 0) { persistentDef->vcpus = nvcpus; @@ -2848,7 +2848,7 @@ qemudDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus, } /* Save the persistent config to disk */ - if (flags & VIR_DOMAIN_VCPU_CONFIG) + if (flags & VIR_DOMAIN_PARAM_CONFIG) ret = virDomainSaveConfig(driver->configDir, persistentDef); endjob: @@ -2864,7 +2864,7 @@ cleanup: static int qemudDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus) { - return qemudDomainSetVcpusFlags(dom, nvcpus, VIR_DOMAIN_VCPU_LIVE); + return qemudDomainSetVcpusFlags(dom, nvcpus, VIR_DOMAIN_PARAM_LIVE); } @@ -3038,12 +3038,12 @@ qemudDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags) virDomainDefPtr def; int ret = -1; - virCheckFlags(VIR_DOMAIN_VCPU_LIVE | - VIR_DOMAIN_VCPU_CONFIG | - VIR_DOMAIN_VCPU_MAXIMUM, -1); + virCheckFlags(VIR_DOMAIN_PARAM_LIVE | + VIR_DOMAIN_PARAM_CONFIG | + VIR_DOMAIN_PARAM_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_PARAM_LIVE) == !(flags & VIR_DOMAIN_PARAM_CONFIG)) { qemuReportError(VIR_ERR_INVALID_ARG, _("invalid flag combination: (0x%x)"), flags); return -1; @@ -3061,7 +3061,7 @@ qemudDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags) goto cleanup; } - if (flags & VIR_DOMAIN_VCPU_LIVE) { + if (flags & VIR_DOMAIN_PARAM_LIVE) { if (!virDomainObjIsActive(vm)) { qemuReportError(VIR_ERR_OPERATION_INVALID, "%s", _("domain not active")); @@ -3072,7 +3072,7 @@ qemudDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags) def = vm->newDef ? vm->newDef : vm->def; } - ret = (flags & VIR_DOMAIN_VCPU_MAXIMUM) ? def->maxvcpus : def->vcpus; + ret = (flags & VIR_DOMAIN_PARAM_MAXIMUM) ? def->maxvcpus : def->vcpus; cleanup: if (vm) @@ -3083,8 +3083,8 @@ cleanup: static int qemudDomainGetMaxVcpus(virDomainPtr dom) { - return qemudDomainGetVcpusFlags(dom, (VIR_DOMAIN_VCPU_LIVE | - VIR_DOMAIN_VCPU_MAXIMUM)); + return qemudDomainGetVcpusFlags(dom, (VIR_DOMAIN_PARAM_LIVE | + VIR_DOMAIN_PARAM_MAXIMUM)); } static int qemudDomainGetSecurityLabel(virDomainPtr dom, virSecurityLabelPtr seclabel) @@ -4406,13 +4406,13 @@ qemuDomainModifyDeviceFlags(virDomainPtr dom, const char *xml, virDomainObjPtr vm = NULL; virDomainDefPtr vmdef = NULL; virDomainDeviceDefPtr dev = NULL; - bool force = (flags & VIR_DOMAIN_DEVICE_MODIFY_FORCE) != 0; + bool force = (flags & VIR_DOMAIN_PARAM_FORCE) != 0; int ret = -1; - virCheckFlags(VIR_DOMAIN_DEVICE_MODIFY_LIVE | - VIR_DOMAIN_DEVICE_MODIFY_CONFIG | + virCheckFlags(VIR_DOMAIN_PARAM_LIVE | + VIR_DOMAIN_PARAM_CONFIG | (action == QEMU_DEVICE_UPDATE ? - VIR_DOMAIN_DEVICE_MODIFY_FORCE : 0), -1); + VIR_DOMAIN_PARAM_FORCE : 0), -1); qemuDriverLock(driver); vm = virDomainFindByUUID(&driver->domains, dom->uuid); @@ -4428,13 +4428,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_PARAM_CURRENT) + flags |= VIR_DOMAIN_PARAM_LIVE; } else { - if (flags == VIR_DOMAIN_DEVICE_MODIFY_CURRENT) - flags |= VIR_DOMAIN_DEVICE_MODIFY_CONFIG; + if (flags == VIR_DOMAIN_PARAM_CURRENT) + flags |= VIR_DOMAIN_PARAM_CONFIG; /* check consistency between flags and the vm state */ - if (flags & VIR_DOMAIN_DEVICE_MODIFY_LIVE) { + if (flags & VIR_DOMAIN_PARAM_LIVE) { qemuReportError(VIR_ERR_OPERATION_INVALID, "%s", _("cannot do live update a device on " @@ -4443,13 +4443,13 @@ qemuDomainModifyDeviceFlags(virDomainPtr dom, const char *xml, } } - if ((flags & VIR_DOMAIN_DEVICE_MODIFY_CONFIG) && !vm->persistent) { + if ((flags & VIR_DOMAIN_PARAM_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_PARAM_CONFIG) { dev = virDomainDeviceDefParse(driver->caps, vm->def, xml, VIR_DOMAIN_XML_INACTIVE); if (dev == NULL) @@ -4477,7 +4477,7 @@ qemuDomainModifyDeviceFlags(virDomainPtr dom, const char *xml, } else ret = 0; - if (!ret && (flags & VIR_DOMAIN_DEVICE_MODIFY_LIVE)) { + if (!ret && (flags & VIR_DOMAIN_PARAM_LIVE)) { /* If dev exists it was created to modify the domain config. Free it. */ virDomainDeviceDefFree(dev); dev = virDomainDeviceDefParse(driver->caps, vm->def, xml, @@ -4509,7 +4509,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_PARAM_CONFIG)) { ret = virDomainSaveConfig(driver->configDir, vmdef); if (!ret) { virDomainObjAssignDef(vm, vmdef, false); @@ -4539,7 +4539,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_PARAM_LIVE); } @@ -4559,7 +4559,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_PARAM_LIVE); } static int qemudDomainGetAutostart(virDomainPtr dom, @@ -4870,8 +4870,8 @@ static int qemuDomainSetMemoryParameters(virDomainPtr dom, int ret = -1; bool isActive; - virCheckFlags(VIR_DOMAIN_MEMORY_PARAM_LIVE | - VIR_DOMAIN_MEMORY_PARAM_CONFIG, -1); + virCheckFlags(VIR_DOMAIN_PARAM_LIVE | + VIR_DOMAIN_PARAM_CONFIG, -1); qemuDriverLock(driver); @@ -4885,14 +4885,14 @@ static int qemuDomainSetMemoryParameters(virDomainPtr dom, isActive = virDomainObjIsActive(vm); - if (flags == VIR_DOMAIN_MEMORY_PARAM_CURRENT) { + if (flags == VIR_DOMAIN_PARAM_CURRENT) { if (isActive) - flags = VIR_DOMAIN_MEMORY_PARAM_LIVE; + flags = VIR_DOMAIN_PARAM_LIVE; else - flags = VIR_DOMAIN_MEMORY_PARAM_CONFIG; + flags = VIR_DOMAIN_PARAM_CONFIG; } - if (flags & VIR_DOMAIN_MEMORY_PARAM_LIVE) { + if (flags & VIR_DOMAIN_PARAM_LIVE) { if (!isActive) { qemuReportError(VIR_ERR_OPERATION_INVALID, "%s", _("domain is not running")); @@ -4912,7 +4912,7 @@ static int qemuDomainSetMemoryParameters(virDomainPtr dom, } } - if (flags & VIR_DOMAIN_MEMORY_PARAM_CONFIG) { + if (flags & VIR_DOMAIN_PARAM_CONFIG) { if (!vm->persistent) { qemuReportError(VIR_ERR_OPERATION_INVALID, "%s", _("cannot change persistent config of a transient domain")); @@ -4935,7 +4935,7 @@ static int qemuDomainSetMemoryParameters(virDomainPtr dom, continue; } - if (flags & VIR_DOMAIN_MEMORY_PARAM_LIVE) { + if (flags & VIR_DOMAIN_PARAM_LIVE) { rc = virCgroupSetMemoryHardLimit(group, params[i].value.ul); if (rc != 0) { virReportSystemError(-rc, "%s", @@ -4944,7 +4944,7 @@ static int qemuDomainSetMemoryParameters(virDomainPtr dom, } } - if (flags & VIR_DOMAIN_MEMORY_PARAM_CONFIG) { + if (flags & VIR_DOMAIN_PARAM_CONFIG) { persistentDef->mem.hard_limit = params[i].value.ul; } } else if (STREQ(param->field, VIR_DOMAIN_MEMORY_SOFT_LIMIT)) { @@ -4956,7 +4956,7 @@ static int qemuDomainSetMemoryParameters(virDomainPtr dom, continue; } - if (flags & VIR_DOMAIN_MEMORY_PARAM_LIVE) { + if (flags & VIR_DOMAIN_PARAM_LIVE) { rc = virCgroupSetMemorySoftLimit(group, params[i].value.ul); if (rc != 0) { virReportSystemError(-rc, "%s", @@ -4965,7 +4965,7 @@ static int qemuDomainSetMemoryParameters(virDomainPtr dom, } } - if (flags & VIR_DOMAIN_MEMORY_PARAM_CONFIG) { + if (flags & VIR_DOMAIN_PARAM_CONFIG) { persistentDef->mem.soft_limit = params[i].value.ul; } } else if (STREQ(param->field, VIR_DOMAIN_MEMORY_SWAP_HARD_LIMIT)) { @@ -4977,7 +4977,7 @@ static int qemuDomainSetMemoryParameters(virDomainPtr dom, continue; } - if (flags & VIR_DOMAIN_MEMORY_PARAM_LIVE) { + if (flags & VIR_DOMAIN_PARAM_LIVE) { rc = virCgroupSetMemSwapHardLimit(group, params[i].value.ul); if (rc != 0) { virReportSystemError(-rc, "%s", @@ -4985,7 +4985,7 @@ static int qemuDomainSetMemoryParameters(virDomainPtr dom, ret = -1; } } - if (flags & VIR_DOMAIN_MEMORY_PARAM_CONFIG) { + if (flags & VIR_DOMAIN_PARAM_CONFIG) { persistentDef->mem.swap_hard_limit = params[i].value.ul; } } else if (STREQ(param->field, VIR_DOMAIN_MEMORY_MIN_GUARANTEE)) { @@ -4999,7 +4999,7 @@ static int qemuDomainSetMemoryParameters(virDomainPtr dom, } } - if (flags & VIR_DOMAIN_MEMORY_PARAM_CONFIG) { + if (flags & VIR_DOMAIN_PARAM_CONFIG) { ret = virDomainSaveConfig(driver->configDir, persistentDef); } @@ -5026,8 +5026,8 @@ static int qemuDomainGetMemoryParameters(virDomainPtr dom, int rc; bool isActive; - virCheckFlags(VIR_DOMAIN_MEMORY_PARAM_LIVE | - VIR_DOMAIN_MEMORY_PARAM_CONFIG, -1); + virCheckFlags(VIR_DOMAIN_PARAM_LIVE | + VIR_DOMAIN_PARAM_CONFIG, -1); qemuDriverLock(driver); @@ -5041,14 +5041,14 @@ static int qemuDomainGetMemoryParameters(virDomainPtr dom, isActive = virDomainObjIsActive(vm); - if (flags == VIR_DOMAIN_MEMORY_PARAM_CURRENT) { + if (flags == VIR_DOMAIN_PARAM_CURRENT) { if (isActive) - flags = VIR_DOMAIN_MEMORY_PARAM_LIVE; + flags = VIR_DOMAIN_PARAM_LIVE; else - flags = VIR_DOMAIN_MEMORY_PARAM_CONFIG; + flags = VIR_DOMAIN_PARAM_CONFIG; } - if (flags & VIR_DOMAIN_MEMORY_PARAM_LIVE) { + if (flags & VIR_DOMAIN_PARAM_LIVE) { if (!isActive) { qemuReportError(VIR_ERR_OPERATION_INVALID, "%s", _("domain is not running")); @@ -5068,7 +5068,7 @@ static int qemuDomainGetMemoryParameters(virDomainPtr dom, } } - if (flags & VIR_DOMAIN_MEMORY_PARAM_CONFIG) { + if (flags & VIR_DOMAIN_PARAM_CONFIG) { if (!vm->persistent) { qemuReportError(VIR_ERR_OPERATION_INVALID, "%s", _("cannot change persistent config of a transient domain")); @@ -5091,7 +5091,7 @@ static int qemuDomainGetMemoryParameters(virDomainPtr dom, goto cleanup; } - if (flags & VIR_DOMAIN_MEMORY_PARAM_CONFIG) { + if (flags & VIR_DOMAIN_PARAM_CONFIG) { for (i = 0; i < *nparams; i++) { virMemoryParameterPtr param = ¶ms[i]; val = 0; @@ -5218,8 +5218,8 @@ static int qemuSetSchedulerParametersFlags(virDomainPtr dom, int ret = -1; bool isActive; - virCheckFlags(VIR_DOMAIN_SCHEDPARAM_LIVE | - VIR_DOMAIN_SCHEDPARAM_CONFIG, -1); + virCheckFlags(VIR_DOMAIN_PARAM_LIVE | + VIR_DOMAIN_PARAM_CONFIG, -1); qemuDriverLock(driver); @@ -5233,20 +5233,20 @@ static int qemuSetSchedulerParametersFlags(virDomainPtr dom, isActive = virDomainObjIsActive(vm); - if (flags == VIR_DOMAIN_SCHEDPARAM_CURRENT) { + if (flags == VIR_DOMAIN_PARAM_CURRENT) { if (isActive) - flags = VIR_DOMAIN_SCHEDPARAM_LIVE; + flags = VIR_DOMAIN_PARAM_LIVE; else - flags = VIR_DOMAIN_SCHEDPARAM_CONFIG; + flags = VIR_DOMAIN_PARAM_CONFIG; } - if ((flags & VIR_DOMAIN_SCHEDPARAM_CONFIG) && !vm->persistent) { + if ((flags & VIR_DOMAIN_PARAM_CONFIG) && !vm->persistent) { qemuReportError(VIR_ERR_OPERATION_INVALID, "%s", _("cannot change persistent config of a transient domain")); goto cleanup; } - if (flags & VIR_DOMAIN_SCHEDPARAM_LIVE) { + if (flags & VIR_DOMAIN_PARAM_LIVE) { if (!isActive) { qemuReportError(VIR_ERR_OPERATION_INVALID, "%s", _("domain is not running")); @@ -5277,7 +5277,7 @@ static int qemuSetSchedulerParametersFlags(virDomainPtr dom, goto cleanup; } - if (flags & VIR_DOMAIN_SCHEDPARAM_LIVE) { + if (flags & VIR_DOMAIN_PARAM_LIVE) { rc = virCgroupSetCpuShares(group, params[i].value.ul); if (rc != 0) { virReportSystemError(-rc, "%s", @@ -5288,7 +5288,7 @@ static int qemuSetSchedulerParametersFlags(virDomainPtr dom, vm->def->cputune.shares = params[i].value.ul; } - if (flags & VIR_DOMAIN_SCHEDPARAM_CONFIG) { + if (flags & VIR_DOMAIN_PARAM_CONFIG) { persistentDef = virDomainObjGetPersistentDef(driver->caps, vm); if (!persistentDef) { qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", @@ -5327,7 +5327,7 @@ static int qemuSetSchedulerParameters(virDomainPtr dom, return qemuSetSchedulerParametersFlags(dom, params, nparams, - VIR_DOMAIN_SCHEDPARAM_LIVE); + VIR_DOMAIN_PARAM_LIVE); } static int @@ -5344,11 +5344,11 @@ qemuGetSchedulerParametersFlags(virDomainPtr dom, int rc; bool isActive; - virCheckFlags(VIR_DOMAIN_SCHEDPARAM_LIVE | - VIR_DOMAIN_SCHEDPARAM_CONFIG, -1); + virCheckFlags(VIR_DOMAIN_PARAM_LIVE | + VIR_DOMAIN_PARAM_CONFIG, -1); - if ((flags & (VIR_DOMAIN_SCHEDPARAM_LIVE | VIR_DOMAIN_SCHEDPARAM_CONFIG)) == - (VIR_DOMAIN_SCHEDPARAM_LIVE | VIR_DOMAIN_SCHEDPARAM_CONFIG)) { + if ((flags & (VIR_DOMAIN_PARAM_LIVE | VIR_DOMAIN_PARAM_CONFIG)) == + (VIR_DOMAIN_PARAM_LIVE | VIR_DOMAIN_PARAM_CONFIG)) { qemuReportError(VIR_ERR_INVALID_ARG, "%s", _("cannot query live and config together")); goto cleanup; @@ -5371,14 +5371,14 @@ qemuGetSchedulerParametersFlags(virDomainPtr dom, isActive = virDomainObjIsActive(vm); - if (flags == VIR_DOMAIN_SCHEDPARAM_CURRENT) { + if (flags == VIR_DOMAIN_PARAM_CURRENT) { if (isActive) - flags = VIR_DOMAIN_SCHEDPARAM_LIVE; + flags = VIR_DOMAIN_PARAM_LIVE; else - flags = VIR_DOMAIN_SCHEDPARAM_CONFIG; + flags = VIR_DOMAIN_PARAM_CONFIG; } - if (flags & VIR_DOMAIN_SCHEDPARAM_CONFIG) { + if (flags & VIR_DOMAIN_PARAM_CONFIG) { if (!vm->persistent) { qemuReportError(VIR_ERR_OPERATION_INVALID, "%s", _("cannot query persistent config of a transient domain")); @@ -5451,7 +5451,7 @@ qemuGetSchedulerParameters(virDomainPtr dom, int *nparams) { return qemuGetSchedulerParametersFlags(dom, params, nparams, - VIR_DOMAIN_SCHEDPARAM_CURRENT); + VIR_DOMAIN_PARAM_CURRENT); } /* This uses the 'info blockstats' monitor command which was diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 2da24f1..b996ee1 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -2066,12 +2066,12 @@ testDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags) virDomainDefPtr def; int ret = -1; - virCheckFlags(VIR_DOMAIN_VCPU_LIVE | - VIR_DOMAIN_VCPU_CONFIG | - VIR_DOMAIN_VCPU_MAXIMUM, -1); + virCheckFlags(VIR_DOMAIN_PARAM_LIVE | + VIR_DOMAIN_PARAM_CONFIG | + VIR_DOMAIN_PARAM_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_PARAM_LIVE) == !(flags & VIR_DOMAIN_PARAM_CONFIG)) { testError(VIR_ERR_INVALID_ARG, _("invalid flag combination: (0x%x)"), flags); return -1; @@ -2089,7 +2089,7 @@ testDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags) goto cleanup; } - if (flags & VIR_DOMAIN_VCPU_LIVE) { + if (flags & VIR_DOMAIN_PARAM_LIVE) { if (!virDomainObjIsActive(vm)) { testError(VIR_ERR_OPERATION_INVALID, "%s", _("domain not active")); @@ -2100,7 +2100,7 @@ testDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags) def = vm->newDef ? vm->newDef : vm->def; } - ret = (flags & VIR_DOMAIN_VCPU_MAXIMUM) ? def->maxvcpus : def->vcpus; + ret = (flags & VIR_DOMAIN_PARAM_MAXIMUM) ? def->maxvcpus : def->vcpus; cleanup: if (vm) @@ -2111,8 +2111,8 @@ cleanup: static int testDomainGetMaxVcpus(virDomainPtr domain) { - return testDomainGetVcpusFlags(domain, (VIR_DOMAIN_VCPU_LIVE | - VIR_DOMAIN_VCPU_MAXIMUM)); + return testDomainGetVcpusFlags(domain, (VIR_DOMAIN_PARAM_LIVE | + VIR_DOMAIN_PARAM_MAXIMUM)); } static int @@ -2124,15 +2124,15 @@ testDomainSetVcpusFlags(virDomainPtr domain, unsigned int nrCpus, virDomainDefPtr persistentDef; int ret = -1, maxvcpus; - virCheckFlags(VIR_DOMAIN_VCPU_LIVE | - VIR_DOMAIN_VCPU_CONFIG | - VIR_DOMAIN_VCPU_MAXIMUM, -1); + virCheckFlags(VIR_DOMAIN_PARAM_LIVE | + VIR_DOMAIN_PARAM_CONFIG | + VIR_DOMAIN_PARAM_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_PARAM_LIVE | VIR_DOMAIN_PARAM_CONFIG)) == 0 || + (flags & (VIR_DOMAIN_PARAM_MAXIMUM | VIR_DOMAIN_PARAM_LIVE)) == + (VIR_DOMAIN_PARAM_MAXIMUM | VIR_DOMAIN_PARAM_LIVE)) { testError(VIR_ERR_INVALID_ARG, _("invalid flag combination: (0x%x)"), flags); return -1; @@ -2152,7 +2152,7 @@ testDomainSetVcpusFlags(virDomainPtr domain, unsigned int nrCpus, goto cleanup; } - if (!virDomainObjIsActive(privdom) && (flags & VIR_DOMAIN_VCPU_LIVE)) { + if (!virDomainObjIsActive(privdom) && (flags & VIR_DOMAIN_PARAM_LIVE)) { testError(VIR_ERR_OPERATION_INVALID, "%s", _("cannot hotplug vcpus for an inactive domain")); goto cleanup; @@ -2160,7 +2160,7 @@ testDomainSetVcpusFlags(virDomainPtr domain, unsigned int nrCpus, /* We allow more cpus in guest than host, but not more than the * domain's starting limit. */ - if (!(flags & (VIR_DOMAIN_VCPU_MAXIMUM)) && + if (!(flags & (VIR_DOMAIN_PARAM_MAXIMUM)) && privdom->def->maxvcpus < maxvcpus) maxvcpus = privdom->def->maxvcpus; @@ -2176,23 +2176,23 @@ testDomainSetVcpusFlags(virDomainPtr domain, unsigned int nrCpus, goto cleanup; switch (flags) { - case VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_VCPU_CONFIG: + case VIR_DOMAIN_PARAM_MAXIMUM | VIR_DOMAIN_PARAM_CONFIG: persistentDef->maxvcpus = nrCpus; if (nrCpus < persistentDef->vcpus) persistentDef->vcpus = nrCpus; ret = 0; break; - case VIR_DOMAIN_VCPU_CONFIG: + case VIR_DOMAIN_PARAM_CONFIG: persistentDef->vcpus = nrCpus; ret = 0; break; - case VIR_DOMAIN_VCPU_LIVE: + case VIR_DOMAIN_PARAM_LIVE: ret = testDomainUpdateVCPUs(domain->conn, privdom, nrCpus, 0); break; - case VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_CONFIG: + case VIR_DOMAIN_PARAM_LIVE | VIR_DOMAIN_PARAM_CONFIG: ret = testDomainUpdateVCPUs(domain->conn, privdom, nrCpus, 0); if (ret == 0) { persistentDef->vcpus = nrCpus; @@ -2209,7 +2209,7 @@ cleanup: static int testSetVcpus(virDomainPtr domain, unsigned int nrCpus) { - return testDomainSetVcpusFlags(domain, nrCpus, VIR_DOMAIN_VCPU_LIVE); + return testDomainSetVcpusFlags(domain, nrCpus, VIR_DOMAIN_PARAM_LIVE); } static int testDomainGetVcpus(virDomainPtr domain, diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c index 536cd8c..0991f1e 100644 --- a/src/uml/uml_driver.c +++ b/src/uml/uml_driver.c @@ -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_PARAM_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_PARAM_CONFIG) { umlReportError(VIR_ERR_OPERATION_INVALID, "%s", _("cannot modify the persistent configuration of a domain")); return -1; diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c index 2986f5a..22c842c 100644 --- a/src/vbox/vbox_tmpl.c +++ b/src/vbox/vbox_tmpl.c @@ -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_PARAM_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_PARAM_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_PARAM_LIVE | VIR_DOMAIN_PARAM_MAXIMUM)) { vboxError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags); return -1; } @@ -2127,8 +2127,8 @@ vboxDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags) static int vboxDomainGetMaxVcpus(virDomainPtr dom) { - return vboxDomainGetVcpusFlags(dom, (VIR_DOMAIN_VCPU_LIVE | - VIR_DOMAIN_VCPU_MAXIMUM)); + return vboxDomainGetVcpusFlags(dom, (VIR_DOMAIN_PARAM_LIVE | + VIR_DOMAIN_PARAM_MAXIMUM)); } static char *vboxDomainGetXMLDesc(virDomainPtr dom, int flags) { @@ -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_PARAM_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_PARAM_CURRENT | + VIR_DOMAIN_PARAM_LIVE | + VIR_DOMAIN_PARAM_CONFIG, -1); - if (flags & VIR_DOMAIN_DEVICE_MODIFY_CONFIG) { + if (flags & VIR_DOMAIN_PARAM_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_PARAM_CONFIG) { vboxError(VIR_ERR_OPERATION_INVALID, "%s", _("cannot modify the persistent configuration of a domain")); return -1; diff --git a/tools/virsh.c b/tools/virsh.c index dfd5bd2..e47f9fe 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -1729,12 +1729,12 @@ cmdSchedinfo(vshControl *ctl, const vshCmd *cmd) vshError(ctl, "%s", _("--current must be specified exclusively")); return false; } - flags = VIR_DOMAIN_SCHEDPARAM_CURRENT; + flags = VIR_DOMAIN_PARAM_CURRENT; } else { if (config) - flags |= VIR_DOMAIN_SCHEDPARAM_CONFIG; + flags |= VIR_DOMAIN_PARAM_CONFIG; if (live) - flags |= VIR_DOMAIN_SCHEDPARAM_LIVE; + flags |= VIR_DOMAIN_PARAM_LIVE; } if (!vshConnectionUsability(ctl, ctl->conn)) @@ -2567,8 +2567,8 @@ cmdVcpucount(vshControl *ctl, const vshCmd *cmd) * talking to an older client, try a fallback API before giving * up. */ if (all || (maximum && config)) { - count = virDomainGetVcpusFlags(dom, (VIR_DOMAIN_VCPU_MAXIMUM | - VIR_DOMAIN_VCPU_CONFIG)); + count = virDomainGetVcpusFlags(dom, (VIR_DOMAIN_PARAM_MAXIMUM | + VIR_DOMAIN_PARAM_CONFIG)); if (count < 0 && (last_error->code == VIR_ERR_NO_SUPPORT || last_error->code == VIR_ERR_INVALID_ARG)) { char *tmp; @@ -2597,8 +2597,8 @@ cmdVcpucount(vshControl *ctl, const vshCmd *cmd) } if (all || (maximum && live)) { - count = virDomainGetVcpusFlags(dom, (VIR_DOMAIN_VCPU_MAXIMUM | - VIR_DOMAIN_VCPU_LIVE)); + count = virDomainGetVcpusFlags(dom, (VIR_DOMAIN_PARAM_MAXIMUM | + VIR_DOMAIN_PARAM_LIVE)); if (count < 0 && (last_error->code == VIR_ERR_NO_SUPPORT || last_error->code == VIR_ERR_INVALID_ARG)) { count = virDomainGetMaxVcpus(dom); @@ -2618,7 +2618,7 @@ cmdVcpucount(vshControl *ctl, const vshCmd *cmd) } if (all || (current && config)) { - count = virDomainGetVcpusFlags(dom, VIR_DOMAIN_VCPU_CONFIG); + count = virDomainGetVcpusFlags(dom, VIR_DOMAIN_PARAM_CONFIG); if (count < 0 && (last_error->code == VIR_ERR_NO_SUPPORT || last_error->code == VIR_ERR_INVALID_ARG)) { char *tmp, *end; @@ -2655,7 +2655,7 @@ cmdVcpucount(vshControl *ctl, const vshCmd *cmd) } if (all || (current && live)) { - count = virDomainGetVcpusFlags(dom, VIR_DOMAIN_VCPU_LIVE); + count = virDomainGetVcpusFlags(dom, VIR_DOMAIN_PARAM_LIVE); if (count < 0 && (last_error->code == VIR_ERR_NO_SUPPORT || last_error->code == VIR_ERR_INVALID_ARG)) { virDomainInfo info; @@ -2927,9 +2927,9 @@ cmdSetvcpus(vshControl *ctl, const vshCmd *cmd) int maximum = vshCommandOptBool(cmd, "maximum"); 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)); + int flags = ((maximum ? VIR_DOMAIN_PARAM_MAXIMUM : 0) | + (config ? VIR_DOMAIN_PARAM_CONFIG : 0) | + (live ? VIR_DOMAIN_PARAM_LIVE : 0)); if (!vshConnectionUsability(ctl, ctl->conn)) return false; @@ -3045,12 +3045,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_PARAM_CURRENT; } else { if (config) - flags |= VIR_DOMAIN_MEM_CONFIG; + flags |= VIR_DOMAIN_PARAM_CONFIG; if (live) - flags |= VIR_DOMAIN_MEM_LIVE; + flags |= VIR_DOMAIN_PARAM_LIVE; /* neither option is specified */ if (!live && !config) flags = -1; @@ -3127,7 +3127,7 @@ cmdSetmaxmem(vshControl *ctl, const vshCmd *cmd) int config = vshCommandOptBool(cmd, "config"); int live = vshCommandOptBool(cmd, "live"); int current = vshCommandOptBool(cmd, "current"); - int flags = VIR_DOMAIN_MEM_MAXIMUM; + int flags = VIR_DOMAIN_PARAM_MAXIMUM; if (current) { if (live || config) { @@ -3136,9 +3136,9 @@ cmdSetmaxmem(vshControl *ctl, const vshCmd *cmd) } } else { if (config) - flags |= VIR_DOMAIN_MEM_CONFIG; + flags |= VIR_DOMAIN_PARAM_CONFIG; if (live) - flags |= VIR_DOMAIN_MEM_LIVE; + flags |= VIR_DOMAIN_PARAM_LIVE; /* neither option is specified */ if (!live && !config) flags = -1; @@ -3355,12 +3355,12 @@ cmdMemtune(vshControl * ctl, const vshCmd * cmd) vshError(ctl, "%s", _("--current must be specified exclusively")); return false; } - flags = VIR_DOMAIN_MEMORY_PARAM_CURRENT; + flags = VIR_DOMAIN_PARAM_CURRENT; } else { if (config) - flags |= VIR_DOMAIN_MEMORY_PARAM_CONFIG; + flags |= VIR_DOMAIN_PARAM_CONFIG; if (live) - flags |= VIR_DOMAIN_MEMORY_PARAM_LIVE; + flags |= VIR_DOMAIN_PARAM_LIVE; } if (!vshConnectionUsability(ctl, ctl->conn)) @@ -9141,9 +9141,9 @@ cmdAttachDevice(vshControl *ctl, const vshCmd *cmd) } if (vshCommandOptBool(cmd, "persistent")) { - flags = VIR_DOMAIN_DEVICE_MODIFY_CONFIG; + flags = VIR_DOMAIN_PARAM_CONFIG; if (virDomainIsActive(dom) == 1) - flags |= VIR_DOMAIN_DEVICE_MODIFY_LIVE; + flags |= VIR_DOMAIN_PARAM_LIVE; ret = virDomainAttachDeviceFlags(dom, buffer, flags); } else { ret = virDomainAttachDevice(dom, buffer); @@ -9206,9 +9206,9 @@ cmdDetachDevice(vshControl *ctl, const vshCmd *cmd) } if (vshCommandOptBool(cmd, "persistent")) { - flags = VIR_DOMAIN_DEVICE_MODIFY_CONFIG; + flags = VIR_DOMAIN_PARAM_CONFIG; if (virDomainIsActive(dom) == 1) - flags |= VIR_DOMAIN_DEVICE_MODIFY_LIVE; + flags |= VIR_DOMAIN_PARAM_LIVE; ret = virDomainDetachDeviceFlags(dom, buffer, flags); } else { ret = virDomainDetachDevice(dom, buffer); @@ -9272,15 +9272,15 @@ cmdUpdateDevice(vshControl *ctl, const vshCmd *cmd) } if (vshCommandOptBool(cmd, "persistent")) { - flags = VIR_DOMAIN_DEVICE_MODIFY_CONFIG; + flags = VIR_DOMAIN_PARAM_CONFIG; if (virDomainIsActive(dom) == 1) - flags |= VIR_DOMAIN_DEVICE_MODIFY_LIVE; + flags |= VIR_DOMAIN_PARAM_LIVE; } else { - flags = VIR_DOMAIN_DEVICE_MODIFY_LIVE; + flags = VIR_DOMAIN_PARAM_LIVE; } if (vshCommandOptBool(cmd, "force")) - flags |= VIR_DOMAIN_DEVICE_MODIFY_FORCE; + flags |= VIR_DOMAIN_PARAM_FORCE; ret = virDomainUpdateDeviceFlags(dom, buffer, flags); VIR_FREE(buffer); @@ -9388,9 +9388,9 @@ cmdAttachInterface(vshControl *ctl, const vshCmd *cmd) xml = virBufferContentAndReset(&buf); if (vshCommandOptBool(cmd, "persistent")) { - flags = VIR_DOMAIN_DEVICE_MODIFY_CONFIG; + flags = VIR_DOMAIN_PARAM_CONFIG; if (virDomainIsActive(dom) == 1) - flags |= VIR_DOMAIN_DEVICE_MODIFY_LIVE; + flags |= VIR_DOMAIN_PARAM_LIVE; ret = virDomainAttachDeviceFlags(dom, xml, flags); } else { ret = virDomainAttachDevice(dom, xml); @@ -9527,9 +9527,9 @@ cmdDetachInterface(vshControl *ctl, const vshCmd *cmd) } if (vshCommandOptBool(cmd, "persistent")) { - flags = VIR_DOMAIN_DEVICE_MODIFY_CONFIG; + flags = VIR_DOMAIN_PARAM_CONFIG; if (virDomainIsActive(dom) == 1) - flags |= VIR_DOMAIN_DEVICE_MODIFY_LIVE; + flags |= VIR_DOMAIN_PARAM_LIVE; ret = virDomainDetachDeviceFlags(dom, (char *)xmlBufferContent(xml_buf), flags); @@ -9665,9 +9665,9 @@ cmdAttachDisk(vshControl *ctl, const vshCmd *cmd) xml = virBufferContentAndReset(&buf); if (vshCommandOptBool(cmd, "persistent")) { - flags = VIR_DOMAIN_DEVICE_MODIFY_CONFIG; + flags = VIR_DOMAIN_PARAM_CONFIG; if (virDomainIsActive(dom) == 1) - flags |= VIR_DOMAIN_DEVICE_MODIFY_LIVE; + flags |= VIR_DOMAIN_PARAM_LIVE; ret = virDomainAttachDeviceFlags(dom, xml, flags); } else { ret = virDomainAttachDevice(dom, xml); @@ -9787,9 +9787,9 @@ cmdDetachDisk(vshControl *ctl, const vshCmd *cmd) } if (vshCommandOptBool(cmd, "persistent")) { - flags = VIR_DOMAIN_DEVICE_MODIFY_CONFIG; + flags = VIR_DOMAIN_PARAM_CONFIG; if (virDomainIsActive(dom) == 1) - flags |= VIR_DOMAIN_DEVICE_MODIFY_LIVE; + flags |= VIR_DOMAIN_PARAM_LIVE; ret = virDomainDetachDeviceFlags(dom, (char *)xmlBufferContent(xml_buf), flags); -- 1.7.3.1

On Fri, Jun 03, 2011 at 10:15:29AM +0800, Hu Tao wrote:
This patch unify the PARAM_CURRENT/PARAM_LIVE/PARAM_CONFIG flags as Daniel Veillard suggested. --- include/libvirt/libvirt.h.in | 58 ++++--------- src/esx/esx_driver.c | 10 +- src/libvirt.c | 4 +- src/openvz/openvz_driver.c | 10 +- src/qemu/qemu_driver.c | 194 +++++++++++++++++++++--------------------- src/test/test_driver.c | 42 +++++----- src/uml/uml_driver.c | 4 +- src/vbox/vbox_tmpl.c | 22 +++--- tools/virsh.c | 74 ++++++++-------- 9 files changed, 196 insertions(+), 222 deletions(-)
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in index 8058229..8ef07b0 100644 --- a/include/libvirt/libvirt.h.in +++ b/include/libvirt/libvirt.h.in @@ -142,6 +142,22 @@ typedef enum { } virDomainCrashedReason;
/** + * virDomainParamFlags: + * + * common flags for commands that support --current, --live, --config + * and --force parameters + */ + +typedef enum { + VIR_DOMAIN_PARAM_CURRENT = 0, /* affect current domain state */ + VIR_DOMAIN_PARAM_LIVE = (1 << 0), /* affect active domain */ + VIR_DOMAIN_PARAM_CONFIG = (1 << 1), /* affect next boot */ + VIR_DOMAIN_PARAM_FORCE = (1 << 2), /* Forcibly modify device + (ex. force eject a cdrom) */ + VIR_DOMAIN_PARAM_MAXIMUM = (1 << 3), /* affect Max rather than current */ +} virDomainParamFlags; + +/** * virDomainInfoPtr: * * a virDomainInfo is a structure filled by virDomainGetInfo() and extracting @@ -338,12 +354,6 @@ typedef virTypedParameter *virTypedParameterPtr;
/* Management of scheduler parameters */
-typedef enum { - VIR_DOMAIN_SCHEDPARAM_CURRENT = 0, /* affect current domain state */ - VIR_DOMAIN_SCHEDPARAM_LIVE = (1 << 0), /* Affect active domain */ - VIR_DOMAIN_SCHEDPARAM_CONFIG = (1 << 1), /* Affect next boot */ -} virDomainSchedParameterFlags; - /* * Fetch scheduler parameters, caller allocates 'params' field of size 'nparams' */ @@ -799,13 +809,6 @@ int virDomainGetBlkioParameters(virDomainPtr domain,
/* Manage memory parameters. */
-/* flags for setting memory parameters */ -typedef enum { - VIR_DOMAIN_MEMORY_PARAM_CURRENT = 0, /* affect current domain state */ - VIR_DOMAIN_MEMORY_PARAM_LIVE = (1 << 0), /* affect active domain */ - VIR_DOMAIN_MEMORY_PARAM_CONFIG = (1 << 1) /* affect next boot */ -} virMemoryParamFlags; - /** * VIR_DOMAIN_MEMORY_PARAM_UNLIMITED: * @@ -859,15 +862,6 @@ int virDomainGetMemoryParameters(virDomainPtr domain, virTypedParameterPtr params, int *nparams, unsigned int flags);
-/* 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 */ - VIR_DOMAIN_MEM_MAXIMUM = (1 << 2), /* affect Max rather than current */ -} virDomainMemoryModFlags; - - /* * Dynamic control of domains */ @@ -1023,16 +1017,6 @@ struct _virVcpuInfo { }; 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 */ - - /* Additional flags to be bit-wise OR'd in */ - VIR_DOMAIN_VCPU_MAXIMUM = (1 << 2), /* Max rather than current count */ -} virDomainVcpuFlags; - int virDomainSetVcpus (virDomainPtr domain, unsigned int nvcpus); int virDomainSetVcpusFlags (virDomainPtr domain, @@ -1131,16 +1115,6 @@ int virDomainGetVcpus (virDomainPtr domain, */ #define VIR_GET_CPUMAP(cpumaps,maplen,vcpu) &(cpumaps[(vcpu)*(maplen)])
- -typedef enum { - - 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) */ -} virDomainDeviceModifyFlags; - int virDomainAttachDevice(virDomainPtr domain, const char *xml); int virDomainDetachDevice(virDomainPtr domain, const char *xml);
NACK, you can't just go deleting things from the libvirt.h header file. Everything in there is public API which must be maintained for application compatibility *forever* Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

On Fri, Jun 03, 2011 at 10:38:24AM +0100, Daniel P. Berrange wrote:
On Fri, Jun 03, 2011 at 10:15:29AM +0800, Hu Tao wrote:
This patch unify the PARAM_CURRENT/PARAM_LIVE/PARAM_CONFIG flags as Daniel Veillard suggested. --- include/libvirt/libvirt.h.in | 58 ++++--------- src/esx/esx_driver.c | 10 +- src/libvirt.c | 4 +- src/openvz/openvz_driver.c | 10 +- src/qemu/qemu_driver.c | 194 +++++++++++++++++++++--------------------- src/test/test_driver.c | 42 +++++----- src/uml/uml_driver.c | 4 +- src/vbox/vbox_tmpl.c | 22 +++--- tools/virsh.c | 74 ++++++++-------- 9 files changed, 196 insertions(+), 222 deletions(-)
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in index 8058229..8ef07b0 100644 --- a/include/libvirt/libvirt.h.in +++ b/include/libvirt/libvirt.h.in @@ -142,6 +142,22 @@ typedef enum { } virDomainCrashedReason;
/** + * virDomainParamFlags: + * + * common flags for commands that support --current, --live, --config + * and --force parameters + */ + +typedef enum { + VIR_DOMAIN_PARAM_CURRENT = 0, /* affect current domain state */ + VIR_DOMAIN_PARAM_LIVE = (1 << 0), /* affect active domain */ + VIR_DOMAIN_PARAM_CONFIG = (1 << 1), /* affect next boot */ + VIR_DOMAIN_PARAM_FORCE = (1 << 2), /* Forcibly modify device + (ex. force eject a cdrom) */ + VIR_DOMAIN_PARAM_MAXIMUM = (1 << 3), /* affect Max rather than current */ +} virDomainParamFlags; + +/** * virDomainInfoPtr: * * a virDomainInfo is a structure filled by virDomainGetInfo() and extracting @@ -338,12 +354,6 @@ typedef virTypedParameter *virTypedParameterPtr;
/* Management of scheduler parameters */
-typedef enum { - VIR_DOMAIN_SCHEDPARAM_CURRENT = 0, /* affect current domain state */ - VIR_DOMAIN_SCHEDPARAM_LIVE = (1 << 0), /* Affect active domain */ - VIR_DOMAIN_SCHEDPARAM_CONFIG = (1 << 1), /* Affect next boot */ -} virDomainSchedParameterFlags; - /* * Fetch scheduler parameters, caller allocates 'params' field of size 'nparams' */ @@ -799,13 +809,6 @@ int virDomainGetBlkioParameters(virDomainPtr domain,
/* Manage memory parameters. */
-/* flags for setting memory parameters */ -typedef enum { - VIR_DOMAIN_MEMORY_PARAM_CURRENT = 0, /* affect current domain state */ - VIR_DOMAIN_MEMORY_PARAM_LIVE = (1 << 0), /* affect active domain */ - VIR_DOMAIN_MEMORY_PARAM_CONFIG = (1 << 1) /* affect next boot */ -} virMemoryParamFlags; - /** * VIR_DOMAIN_MEMORY_PARAM_UNLIMITED: * @@ -859,15 +862,6 @@ int virDomainGetMemoryParameters(virDomainPtr domain, virTypedParameterPtr params, int *nparams, unsigned int flags);
-/* 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 */ - VIR_DOMAIN_MEM_MAXIMUM = (1 << 2), /* affect Max rather than current */ -} virDomainMemoryModFlags; - - /* * Dynamic control of domains */ @@ -1023,16 +1017,6 @@ struct _virVcpuInfo { }; 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 */ - - /* Additional flags to be bit-wise OR'd in */ - VIR_DOMAIN_VCPU_MAXIMUM = (1 << 2), /* Max rather than current count */ -} virDomainVcpuFlags; - int virDomainSetVcpus (virDomainPtr domain, unsigned int nvcpus); int virDomainSetVcpusFlags (virDomainPtr domain, @@ -1131,16 +1115,6 @@ int virDomainGetVcpus (virDomainPtr domain, */ #define VIR_GET_CPUMAP(cpumaps,maplen,vcpu) &(cpumaps[(vcpu)*(maplen)])
- -typedef enum { - - 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) */ -} virDomainDeviceModifyFlags; - int virDomainAttachDevice(virDomainPtr domain, const char *xml); int virDomainDetachDevice(virDomainPtr domain, const char *xml);
NACK, you can't just go deleting things from the libvirt.h header file. Everything in there is public API which must be maintained for application compatibility *forever*
Thanks for the reminding me of this. I didn't realize this is public api. -- Thanks, Hu Tao

On 06/02/2011 08:15 PM, Hu Tao wrote:
This patch unify the PARAM_CURRENT/PARAM_LIVE/PARAM_CONFIG flags as Daniel Veillard suggested.
I concur with danpb's NACK. See how I kept existing enum names while adding a new consolidation enum in commit 824dcaf, as well as how I sunk deprecated enum names to the bottom of the file in commig a9b3a78 as well as documenting versions so a user knows whether to use the new or the old name depending on how old of a libvirt they are targetting. You have to take the same approach for this patch to have any chance of getting approved. However, there is one exception - anything that did not exist in 0.9.1 is fair game, if we do it now.
/** + * virDomainParamFlags: + * + * common flags for commands that support --current, --live, --config + * and --force parameters + */ + +typedef enum { + VIR_DOMAIN_PARAM_CURRENT = 0, /* affect current domain state */ + VIR_DOMAIN_PARAM_LIVE = (1 << 0), /* affect active domain */ + VIR_DOMAIN_PARAM_CONFIG = (1 << 1), /* affect next boot */ + VIR_DOMAIN_PARAM_FORCE = (1 << 2), /* Forcibly modify device + (ex. force eject a cdrom) */ + VIR_DOMAIN_PARAM_MAXIMUM = (1 << 3), /* affect Max rather than current */ +} virDomainParamFlags;
If we introduce a new enum, we should _only_ list the three values _CURRENT, _LIVE, and _CONFIG. Leave other function-specific flags to function-specific enums. Furthermore, you _can't_ change values - an older client that thinks that _MAXIMUM is 1<<2 calling a newer server that thinks _MAXIMUM is 1<<3 is a recipe for disaster. Also, I wonder if the names might be better represented as: VIR_DOMAIN_AFFECT_CURRENT = 0, VIR_DOMAIN_AFFECT_LIVE = 1<<1, VIR_DOMAIN_AFFECT_CONFIG = 1<<2,
/* Management of scheduler parameters */
-typedef enum { - VIR_DOMAIN_SCHEDPARAM_CURRENT = 0, /* affect current domain state */ - VIR_DOMAIN_SCHEDPARAM_LIVE = (1 << 0), /* Affect active domain */ - VIR_DOMAIN_SCHEDPARAM_CONFIG = (1 << 1), /* Affect next boot */ -} virDomainSchedParameterFlags; -
_IF_ we hurry, we can delete this enum prior to 0.9.2, since this particular enum has not been released yet. But if 0.9.2 is released, we are stuck with these enum names.
-/* flags for setting memory parameters */ -typedef enum { - VIR_DOMAIN_MEMORY_PARAM_CURRENT = 0, /* affect current domain state */ - VIR_DOMAIN_MEMORY_PARAM_LIVE = (1 << 0), /* affect active domain */ - VIR_DOMAIN_MEMORY_PARAM_CONFIG = (1 << 1) /* affect next boot */ -} virMemoryParamFlags;
Likewise a set of unreleased enum names.
-/* 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 */ - VIR_DOMAIN_MEM_MAXIMUM = (1 << 2), /* affect Max rather than current */ -} virDomainMemoryModFlags;
Must be kept; these existed in 0.9.1. Furthermore, this is a case where VIR_DOMAIN_MEM_MAXIMUM cannot change in value.
-/* 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 */ - - /* Additional flags to be bit-wise OR'd in */ - VIR_DOMAIN_VCPU_MAXIMUM = (1 << 2), /* Max rather than current count */ -} virDomainVcpuFlags;
Must be kept; these existed in 0.9.1. VIR_DOMAIN_VCPU_MAXIMUM cannot change in value. However, we _could_ add VIR_DOMAIN_VCPU_CURRENT == 0 (although that should be a separate patch, and preferably post-0.9.2).
-typedef enum { - - 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) */ -} virDomainDeviceModifyFlags;
Must be kept; these existed in 0.9.1. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

On Fri, Jun 03, 2011 at 08:36:26AM -0600, Eric Blake wrote:
On 06/02/2011 08:15 PM, Hu Tao wrote:
This patch unify the PARAM_CURRENT/PARAM_LIVE/PARAM_CONFIG flags as Daniel Veillard suggested.
I concur with danpb's NACK. See how I kept existing enum names while adding a new consolidation enum in commit 824dcaf, as well as how I sunk deprecated enum names to the bottom of the file in commig a9b3a78 as well as documenting versions so a user knows whether to use the new or the old name depending on how old of a libvirt they are targetting. You have to take the same approach for this patch to have any chance of getting approved.
Thanks for the info.
However, there is one exception - anything that did not exist in 0.9.1 is fair game, if we do it now.
/** + * virDomainParamFlags: + * + * common flags for commands that support --current, --live, --config + * and --force parameters + */ + +typedef enum { + VIR_DOMAIN_PARAM_CURRENT = 0, /* affect current domain state */ + VIR_DOMAIN_PARAM_LIVE = (1 << 0), /* affect active domain */ + VIR_DOMAIN_PARAM_CONFIG = (1 << 1), /* affect next boot */ + VIR_DOMAIN_PARAM_FORCE = (1 << 2), /* Forcibly modify device + (ex. force eject a cdrom) */ + VIR_DOMAIN_PARAM_MAXIMUM = (1 << 3), /* affect Max rather than current */ +} virDomainParamFlags;
If we introduce a new enum, we should _only_ list the three values _CURRENT, _LIVE, and _CONFIG. Leave other function-specific flags to function-specific enums. Furthermore, you _can't_ change values - an older client that thinks that _MAXIMUM is 1<<2 calling a newer server that thinks _MAXIMUM is 1<<3 is a recipe for disaster.
OK.
Also, I wonder if the names might be better represented as:
VIR_DOMAIN_AFFECT_CURRENT = 0, VIR_DOMAIN_AFFECT_LIVE = 1<<1, VIR_DOMAIN_AFFECT_CONFIG = 1<<2,
OK.
/* Management of scheduler parameters */
-typedef enum { - VIR_DOMAIN_SCHEDPARAM_CURRENT = 0, /* affect current domain state */ - VIR_DOMAIN_SCHEDPARAM_LIVE = (1 << 0), /* Affect active domain */ - VIR_DOMAIN_SCHEDPARAM_CONFIG = (1 << 1), /* Affect next boot */ -} virDomainSchedParameterFlags; -
_IF_ we hurry, we can delete this enum prior to 0.9.2, since this particular enum has not been released yet. But if 0.9.2 is released, we are stuck with these enum names.
0.9.2 is released at June 6 (+0800)
-/* flags for setting memory parameters */ -typedef enum { - VIR_DOMAIN_MEMORY_PARAM_CURRENT = 0, /* affect current domain state */ - VIR_DOMAIN_MEMORY_PARAM_LIVE = (1 << 0), /* affect active domain */ - VIR_DOMAIN_MEMORY_PARAM_CONFIG = (1 << 1) /* affect next boot */ -} virMemoryParamFlags;
Likewise a set of unreleased enum names.
-/* 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 */ - VIR_DOMAIN_MEM_MAXIMUM = (1 << 2), /* affect Max rather than current */ -} virDomainMemoryModFlags;
Must be kept; these existed in 0.9.1. Furthermore, this is a case where VIR_DOMAIN_MEM_MAXIMUM cannot change in value.
OK.
-/* 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 */ - - /* Additional flags to be bit-wise OR'd in */ - VIR_DOMAIN_VCPU_MAXIMUM = (1 << 2), /* Max rather than current count */ -} virDomainVcpuFlags;
Must be kept; these existed in 0.9.1. VIR_DOMAIN_VCPU_MAXIMUM cannot change in value. However, we _could_ add VIR_DOMAIN_VCPU_CURRENT == 0 (although that should be a separate patch, and preferably post-0.9.2).
OK.
-typedef enum { - - 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) */ -} virDomainDeviceModifyFlags;
Must be kept; these existed in 0.9.1.
OK. -- Thanks, Hu Tao

/* Management of scheduler parameters */
-typedef enum { - VIR_DOMAIN_SCHEDPARAM_CURRENT = 0, /* affect current domain state */ - VIR_DOMAIN_SCHEDPARAM_LIVE = (1 << 0), /* Affect active domain */ - VIR_DOMAIN_SCHEDPARAM_CONFIG = (1 << 1), /* Affect next boot */ -} virDomainSchedParameterFlags; -
_IF_ we hurry, we can delete this enum prior to 0.9.2, since this particular enum has not been released yet. But if 0.9.2 is released, we are stuck with these enum names.
0.9.2 is released at June 6 (+0800)
See the changes are already in 0.9.2 right now. Thanks Eric. -- Thanks, Hu Tao

--- src/qemu/qemu_driver.c | 124 +++++++++++++++++++++++++++++++++--------------- 1 files changed, 86 insertions(+), 38 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 43bb0fc..7b855d6 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -4773,18 +4773,16 @@ static int qemuDomainGetBlkioParameters(virDomainPtr dom, int i; virCgroupPtr group = NULL; virDomainObjPtr vm = NULL; + virDomainDefPtr persistentDef = NULL; unsigned int val; int ret = -1; int rc; + bool isActive; - virCheckFlags(0, -1); + virCheckFlags(VIR_DOMAIN_PARAM_LIVE | + VIR_DOMAIN_PARAM_CONFIG, -1); qemuDriverLock(driver); - if (!qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_BLKIO)) { - qemuReportError(VIR_ERR_NO_SUPPORT, _("blkio cgroup isn't mounted")); - goto cleanup; - } - vm = virDomainFindByUUID(&driver->domains, dom->uuid); if (vm == NULL) { @@ -4793,12 +4791,6 @@ static int qemuDomainGetBlkioParameters(virDomainPtr dom, goto cleanup; } - if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); - goto cleanup; - } - if ((*nparams) == 0) { /* Current number of blkio parameters supported by cgroups */ *nparams = QEMU_NB_BLKIO_PARAM; @@ -4812,37 +4804,93 @@ static int qemuDomainGetBlkioParameters(virDomainPtr dom, goto cleanup; } - if (virCgroupForDomain(driver->cgroup, vm->def->name, &group, 0) != 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot find cgroup for domain %s"), vm->def->name); - goto cleanup; + isActive = virDomainObjIsActive(vm); + + if (flags == VIR_DOMAIN_PARAM_CURRENT) { + if (isActive) + flags = VIR_DOMAIN_PARAM_LIVE; + else + flags = VIR_DOMAIN_PARAM_CONFIG; } - for (i = 0; i < *nparams; i++) { - virTypedParameterPtr param = ¶ms[i]; - val = 0; - param->value.ui = 0; - param->type = VIR_TYPED_PARAM_UINT; + if (flags & VIR_DOMAIN_PARAM_LIVE) { + if (!isActive) { + qemuReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is not running")); + goto cleanup; + } - switch (i) { - case 0: /* fill blkio weight here */ - rc = virCgroupGetBlkioWeight(group, &val); - if (rc != 0) { - virReportSystemError(-rc, "%s", - _("unable to get blkio weight")); - goto cleanup; - } - if (virStrcpyStatic(param->field, VIR_DOMAIN_BLKIO_WEIGHT) == NULL) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Field blkio weight too long for destination")); - goto cleanup; + if (!qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_BLKIO)) { + qemuReportError(VIR_ERR_NO_SUPPORT, _("blkio cgroup isn't mounted")); + goto cleanup; + } + + if (virCgroupForDomain(driver->cgroup, vm->def->name, &group, 0) != 0) { + qemuReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot find cgroup for domain %s"), vm->def->name); + goto cleanup; + } + } + + if (flags & VIR_DOMAIN_PARAM_CONFIG) { + if (!vm->persistent) { + qemuReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("cannot change persistent config of a transient domain")); + goto cleanup; + } + if (!(persistentDef = virDomainObjGetPersistentDef(driver->caps, vm))) + goto cleanup; + } + + if (flags & VIR_DOMAIN_PARAM_LIVE) { + for (i = 0; i < *nparams; i++) { + virTypedParameterPtr param = ¶ms[i]; + val = 0; + param->value.ui = 0; + param->type = VIR_TYPED_PARAM_UINT; + + switch (i) { + case 0: /* fill blkio weight here */ + rc = virCgroupGetBlkioWeight(group, &val); + if (rc != 0) { + virReportSystemError(-rc, "%s", + _("unable to get blkio weight")); + goto cleanup; + } + if (virStrcpyStatic(param->field, VIR_DOMAIN_BLKIO_WEIGHT) == NULL) { + qemuReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Field blkio weight too long for destination")); + goto cleanup; + } + param->value.ui = val; + break; + + default: + break; + /* should not hit here */ } - param->value.ui = val; - break; + } + } else if (flags & VIR_DOMAIN_PARAM_CONFIG) { + for (i = 0; i < *nparams; i++) { + virTypedParameterPtr param = ¶ms[i]; + val = 0; + param->value.ui = 0; + param->type = VIR_TYPED_PARAM_UINT; - default: - break; - /* should not hit here */ + switch (i) { + case 0: /* fill blkio weight here */ + if (virStrcpyStatic(param->field, VIR_DOMAIN_BLKIO_WEIGHT) == NULL) { + qemuReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Field blkio weight too long for destination")); + goto cleanup; + } + param->value.ui = persistentDef->blkio.weight; + break; + + default: + break; + /* should not hit here */ + } } } -- 1.7.3.1

On 06/02/2011 08:15 PM, Hu Tao wrote:
--- src/qemu/qemu_driver.c | 124 +++++++++++++++++++++++++++++++++--------------- 1 files changed, 86 insertions(+), 38 deletions(-)
Caveat: I have not reviewed this closely. By mere description, this looks useful, and similar to other recent changes, so I'm looking foward to v2. Patch 1/3 can be split and a part of it applied before 0.9.2 (see my email about the two unreleased enum names that we could drop before they become permanent due to a release), but this patch is a new feature and should definitely be post-release, in addition to being rebased on top of whatever happens with the 1/3 fallout. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

--- src/qemu/qemu_driver.c | 126 ++++++++++++++++++++++++++++++++++-------------- 1 files changed, 90 insertions(+), 36 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 7b855d6..edefb5a 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -4694,14 +4694,13 @@ static int qemuDomainSetBlkioParameters(virDomainPtr dom, int i; virCgroupPtr group = NULL; virDomainObjPtr vm = NULL; + virDomainDefPtr persistentDef = NULL; int ret = -1; + bool isActive; - virCheckFlags(0, -1); + virCheckFlags(VIR_DOMAIN_PARAM_LIVE | + VIR_DOMAIN_PARAM_CONFIG, -1); qemuDriverLock(driver); - if (!qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_BLKIO)) { - qemuReportError(VIR_ERR_NO_SUPPORT, _("blkio cgroup isn't mounted")); - goto cleanup; - } vm = virDomainFindByUUID(&driver->domains, dom->uuid); @@ -4711,49 +4710,104 @@ static int qemuDomainSetBlkioParameters(virDomainPtr dom, goto cleanup; } - if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); - goto cleanup; + isActive = virDomainObjIsActive(vm); + + if (flags == VIR_DOMAIN_PARAM_CURRENT) { + if (isActive) + flags = VIR_DOMAIN_PARAM_LIVE; + else + flags = VIR_DOMAIN_PARAM_CONFIG; } - if (virCgroupForDomain(driver->cgroup, vm->def->name, &group, 0) != 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot find cgroup for domain %s"), vm->def->name); - goto cleanup; + if (flags & VIR_DOMAIN_PARAM_LIVE) { + if (!isActive) { + qemuReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is not running")); + goto cleanup; + } + + if (!qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_BLKIO)) { + qemuReportError(VIR_ERR_NO_SUPPORT, _("blkio cgroup isn't mounted")); + goto cleanup; + } + + if (virCgroupForDomain(driver->cgroup, vm->def->name, &group, 0) != 0) { + qemuReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot find cgroup for domain %s"), vm->def->name); + goto cleanup; + } + } + + if (flags & VIR_DOMAIN_PARAM_CONFIG) { + if (!vm->persistent) { + qemuReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("cannot change persistent config of a transient domain")); + goto cleanup; + } + if (!(persistentDef = virDomainObjGetPersistentDef(driver->caps, vm))) + goto cleanup; } ret = 0; - for (i = 0; i < nparams; i++) { - virTypedParameterPtr param = ¶ms[i]; + if (flags & VIR_DOMAIN_PARAM_LIVE) { + for (i = 0; i < nparams; i++) { + virTypedParameterPtr param = ¶ms[i]; - if (STREQ(param->field, VIR_DOMAIN_BLKIO_WEIGHT)) { - int rc; - if (param->type != VIR_TYPED_PARAM_UINT) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("invalid type for blkio weight tunable, expected a 'unsigned int'")); - ret = -1; - continue; - } + if (STREQ(param->field, VIR_DOMAIN_BLKIO_WEIGHT)) { + int rc; + if (param->type != VIR_TYPED_PARAM_UINT) { + qemuReportError(VIR_ERR_INVALID_ARG, "%s", + _("invalid type for blkio weight tunable, expected a 'unsigned int'")); + ret = -1; + continue; + } - if (params[i].value.ui > 1000 || params[i].value.ui < 100) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("out of blkio weight range.")); + if (params[i].value.ui > 1000 || params[i].value.ui < 100) { + qemuReportError(VIR_ERR_INVALID_ARG, "%s", + _("out of blkio weight range.")); + ret = -1; + continue; + } + + rc = virCgroupSetBlkioWeight(group, params[i].value.ui); + if (rc != 0) { + virReportSystemError(-rc, "%s", + _("unable to set blkio weight tunable")); + ret = -1; + } + } else { + qemuReportError(VIR_ERR_INVALID_ARG, + _("Parameter `%s' not supported"), param->field); ret = -1; - continue; } + } + } else if (flags & VIR_DOMAIN_PARAM_CONFIG) { + for (i = 0; i < nparams; i++) { + virTypedParameterPtr param = ¶ms[i]; - rc = virCgroupSetBlkioWeight(group, params[i].value.ui); - if (rc != 0) { - virReportSystemError(-rc, "%s", - _("unable to set blkio weight tunable")); + if (STREQ(param->field, VIR_DOMAIN_BLKIO_WEIGHT)) { + if (param->type != VIR_TYPED_PARAM_UINT) { + qemuReportError(VIR_ERR_INVALID_ARG, "%s", + _("invalid type for blkio weight tunable, expected a 'unsigned int'")); + ret = -1; + continue; + } + + if (params[i].value.ui > 1000 || params[i].value.ui < 100) { + qemuReportError(VIR_ERR_INVALID_ARG, "%s", + _("out of blkio weight range.")); + ret = -1; + continue; + } + + persistentDef->blkio.weight = params[i].value.ui; + } else { + qemuReportError(VIR_ERR_INVALID_ARG, + _("Parameter `%s' not supported"), param->field); ret = -1; } - } else { - qemuReportError(VIR_ERR_INVALID_ARG, - _("Parameter `%s' not supported"), param->field); - ret = -1; } + ret = virDomainSaveConfig(driver->configDir, persistentDef); } cleanup: -- 1.7.3.1
participants (3)
-
Daniel P. Berrange
-
Eric Blake
-
Hu Tao