The older names still work, but we might as well use the newer type and enum names internally. * include/libvirt/libvirt.h.in: Rearrange older names to the bottom and improve documentation on preferred names. (virDomainGetSchedulerParameters, virDomainSetSchedulerParameters) (virDomainSetSchedulerParametersFlags) (virDomainSetBlkioParameters, virDomainGetBlkioParameters) (virDomainSetMemoryParameters, virDomainGetMemoryParameters): Use newer type names. * src/driver.h: Likewise. * src/libvirt.c: Likewise. * daemon/remote.c: Likewise. * src/esx/esx_driver.c: Likewise. * src/libxl/libxl_driver.c: Likewise. * src/lxc/lxc_driver.c: Likewise. * src/qemu/qemu_driver.c: Likewise. * src/remote/remote_driver.c: Likewise. * src/test/test_driver.c: Likewise. * src/xen/xen_driver.c: Likewise. * src/xen/xen_hypervisor.c: Likewise. * src/xen/xen_hypervisor.h: Likewise. * src/xen/xend_internal.c: Likewise. * tools/virsh.c: Likewise. * python/libvirt-override.c: Likewise. --- Designed for use after 2/7, with minor fallout in the rest of the series when introducing the new virDomainGetSchedulerParametersFlags. daemon/remote.c | 14 +- include/libvirt/libvirt.h.in | 264 +++++++++++++++++++++++------------------- python/libvirt-override.c | 28 +++--- src/driver.h | 14 +- src/esx/esx_driver.c | 36 +++--- src/libvirt.c | 20 ++-- src/libxl/libxl_driver.c | 14 +- src/lxc/lxc_driver.c | 26 ++-- src/qemu/qemu_driver.c | 40 +++--- src/remote/remote_driver.c | 16 ++-- src/test/test_driver.c | 8 +- src/xen/xen_driver.c | 6 +- src/xen/xen_hypervisor.c | 14 +- src/xen/xen_hypervisor.h | 6 +- src/xen/xend_internal.c | 12 +- tools/virsh.c | 68 ++++++------ 16 files changed, 305 insertions(+), 281 deletions(-) diff --git a/daemon/remote.c b/daemon/remote.c index 001e5bf..425bce7 100644 --- a/daemon/remote.c +++ b/daemon/remote.c @@ -678,7 +678,7 @@ remoteDispatchDomainGetSchedulerParameters(struct qemud_server *server ATTRIBUTE remote_domain_get_scheduler_parameters_ret *ret) { virDomainPtr dom = NULL; - virSchedParameterPtr params = NULL; + virTypedParameterPtr params = NULL; int nparams = args->nparams; int rv = -1; @@ -730,7 +730,7 @@ remoteDispatchDomainSetSchedulerParameters(struct qemud_server *server ATTRIBUTE void *ret ATTRIBUTE_UNUSED) { virDomainPtr dom = NULL; - virSchedParameterPtr params = NULL; + virTypedParameterPtr params = NULL; int nparams; int rv = -1; @@ -774,7 +774,7 @@ remoteDispatchDomainSetSchedulerParametersFlags(struct qemud_server *server ATTR void *ret ATTRIBUTE_UNUSED) { virDomainPtr dom = NULL; - virSchedParameterPtr params = NULL; + virTypedParameterPtr params = NULL; int nparams; int rv = -1; @@ -1387,7 +1387,7 @@ remoteDispatchDomainSetMemoryParameters(struct qemud_server *server * args, void *ret ATTRIBUTE_UNUSED) { virDomainPtr dom = NULL; - virMemoryParameterPtr params = NULL; + virTypedParameterPtr params = NULL; int nparams; unsigned int flags; int rv = -1; @@ -1437,7 +1437,7 @@ remoteDispatchDomainGetMemoryParameters(struct qemud_server *server * ret) { virDomainPtr dom = NULL; - virMemoryParameterPtr params = NULL; + virTypedParameterPtr params = NULL; int nparams = args->nparams; unsigned int flags; int rv = -1; @@ -1502,7 +1502,7 @@ remoteDispatchDomainSetBlkioParameters(struct qemud_server *server * args, void *ret ATTRIBUTE_UNUSED) { virDomainPtr dom = NULL; - virBlkioParameterPtr params = NULL; + virTypedParameterPtr params = NULL; int nparams; unsigned int flags; int rv = -1; @@ -1552,7 +1552,7 @@ remoteDispatchDomainGetBlkioParameters(struct qemud_server *server * ret) { virDomainPtr dom = NULL; - virBlkioParameterPtr params = NULL; + virTypedParameterPtr params = NULL; int nparams = args->nparams; unsigned int flags; int rv = -1; diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in index 7cd6e13..2174cfd 100644 --- a/include/libvirt/libvirt.h.in +++ b/include/libvirt/libvirt.h.in @@ -308,6 +308,10 @@ typedef enum { * virTypedParameter: * * A named parameter, including a type and value. + * + * The types virSchedParameter, virBlkioParameter, and + * virMemoryParameter are aliases of this type, for use when + * targetting libvirt earlier than 0.9.2. */ typedef struct _virTypedParameter virTypedParameter; @@ -331,21 +335,8 @@ struct _virTypedParameter { */ typedef virTypedParameter *virTypedParameterPtr; -/* Management of scheduler parameters */ -/** - * virDomainSchedParameterType: - * - * A scheduler parameter field type - */ -typedef enum { - VIR_DOMAIN_SCHED_FIELD_INT = VIR_TYPED_PARAM_INT, - VIR_DOMAIN_SCHED_FIELD_UINT = VIR_TYPED_PARAM_UINT, - VIR_DOMAIN_SCHED_FIELD_LLONG = VIR_TYPED_PARAM_LLONG, - VIR_DOMAIN_SCHED_FIELD_ULLONG = VIR_TYPED_PARAM_ULLONG, - VIR_DOMAIN_SCHED_FIELD_DOUBLE = VIR_TYPED_PARAM_DOUBLE, - VIR_DOMAIN_SCHED_FIELD_BOOLEAN = VIR_TYPED_PARAM_BOOLEAN, -} virSchedParameterType; +/* Management of scheduler parameters */ typedef enum { VIR_DOMAIN_SCHEDPARAM_CURRENT = 0, /* affect current domain state */ @@ -353,49 +344,25 @@ typedef enum { VIR_DOMAIN_SCHEDPARAM_CONFIG = (1 << 1), /* Affect next boot */ } virDomainSchedParameterFlags; -/** - * VIR_DOMAIN_SCHED_FIELD_LENGTH: - * - * Macro providing the field length of virSchedParameter - */ - -#define VIR_DOMAIN_SCHED_FIELD_LENGTH VIR_TYPED_PARAM_FIELD_LENGTH - -/** - * virDomainSchedParameter: - * - * a virDomainSchedParameter is the set of scheduler parameters - */ - -typedef struct _virTypedParameter virSchedParameter; - -/** - * virSchedParameterPtr: - * - * a virSchedParameterPtr is a pointer to a virSchedParameter structure. - */ - -typedef virSchedParameter *virSchedParameterPtr; - /* * Fetch scheduler parameters, caller allocates 'params' field of size 'nparams' */ int virDomainGetSchedulerParameters (virDomainPtr domain, - virSchedParameterPtr params, + virTypedParameterPtr params, int *nparams); /* * Change scheduler parameters */ int virDomainSetSchedulerParameters (virDomainPtr domain, - virSchedParameterPtr params, + virTypedParameterPtr params, int nparams); /* * Change scheduler parameters */ int virDomainSetSchedulerParametersFlags (virDomainPtr domain, - virSchedParameterPtr params, + virTypedParameterPtr params, int nparams, unsigned int flags); @@ -798,29 +765,8 @@ int virDomainGetState (virDomainPtr domain, char * virDomainGetSchedulerType(virDomainPtr domain, int *nparams); -/* Manage blkio parameters. */ - -/** - * virDomainBlkioParameterType: - * - * A blkio parameter field type - */ -typedef enum { - VIR_DOMAIN_BLKIO_PARAM_INT = VIR_TYPED_PARAM_INT, - VIR_DOMAIN_BLKIO_PARAM_UINT = VIR_TYPED_PARAM_UINT, - VIR_DOMAIN_BLKIO_PARAM_LLONG = VIR_TYPED_PARAM_LLONG, - VIR_DOMAIN_BLKIO_PARAM_ULLONG = VIR_TYPED_PARAM_ULLONG, - VIR_DOMAIN_BLKIO_PARAM_DOUBLE = VIR_TYPED_PARAM_DOUBLE, - VIR_DOMAIN_BLKIO_PARAM_BOOLEAN = VIR_TYPED_PARAM_BOOLEAN, -} virBlkioParameterType; -/** - * VIR_DOMAIN_BLKIO_FIELD_LENGTH: - * - * Macro providing the field length of virBlkioParameter - */ - -#define VIR_DOMAIN_BLKIO_FIELD_LENGTH VIR_TYPED_PARAM_FIELD_LENGTH +/* Manage blkio parameters. */ /** * VIR_DOMAIN_BLKIO_WEIGHT: @@ -831,55 +777,17 @@ typedef enum { #define VIR_DOMAIN_BLKIO_WEIGHT "weight" -/** - * virDomainBlkioParameter: - * - * a virDomainBlkioParameter is the set of blkio parameters - */ - -typedef struct _virTypedParameter virBlkioParameter; - -/** - * virBlkioParameterPtr: - * - * a virBlkioParameterPtr is a pointer to a virBlkioParameter structure. - */ - -typedef virBlkioParameter *virBlkioParameterPtr; - /* Set Blkio tunables for the domain*/ int virDomainSetBlkioParameters(virDomainPtr domain, - virBlkioParameterPtr params, + virTypedParameterPtr params, int nparams, unsigned int flags); int virDomainGetBlkioParameters(virDomainPtr domain, - virBlkioParameterPtr params, + virTypedParameterPtr params, int *nparams, unsigned int flags); /* Manage memory parameters. */ /** - * virDomainMemoryParameterType: - * - * A memory parameter field type - */ -typedef enum { - VIR_DOMAIN_MEMORY_PARAM_INT = VIR_TYPED_PARAM_INT, - VIR_DOMAIN_MEMORY_PARAM_UINT = VIR_TYPED_PARAM_UINT, - VIR_DOMAIN_MEMORY_PARAM_LLONG = VIR_TYPED_PARAM_LLONG, - VIR_DOMAIN_MEMORY_PARAM_ULLONG = VIR_TYPED_PARAM_ULLONG, - VIR_DOMAIN_MEMORY_PARAM_DOUBLE = VIR_TYPED_PARAM_DOUBLE, - VIR_DOMAIN_MEMORY_PARAM_BOOLEAN = VIR_TYPED_PARAM_BOOLEAN, -} virMemoryParameterType; - -/** - * VIR_DOMAIN_MEMORY_FIELD_LENGTH: - * - * Macro providing the field length of virMemoryParameter - */ - -#define VIR_DOMAIN_MEMORY_FIELD_LENGTH VIR_TYPED_PARAM_FIELD_LENGTH - -/** * VIR_DOMAIN_MEMORY_PARAM_UNLIMITED: * * Macro providing the virMemoryParameter value that indicates "unlimited" @@ -924,28 +832,12 @@ typedef enum { #define VIR_DOMAIN_MEMORY_SWAP_HARD_LIMIT "swap_hard_limit" -/** - * virDomainMemoryParameter: - * - * a virDomainMemoryParameter is the set of scheduler parameters - */ - -typedef struct _virTypedParameter virMemoryParameter; - -/** - * virMemoryParameterPtr: - * - * a virMemoryParameterPtr is a pointer to a virMemoryParameter structure. - */ - -typedef virMemoryParameter *virMemoryParameterPtr; - /* Set memory tunables for the domain*/ int virDomainSetMemoryParameters(virDomainPtr domain, - virMemoryParameterPtr params, + virTypedParameterPtr params, int nparams, unsigned int flags); int virDomainGetMemoryParameters(virDomainPtr domain, - virMemoryParameterPtr params, + virTypedParameterPtr params, int *nparams, unsigned int flags); /* Memory size modification flags. */ @@ -2617,6 +2509,136 @@ int virDomainOpenConsole(virDomainPtr dom, int virDomainInjectNMI(virDomainPtr domain, unsigned int flags); + +/** + * virDomainSchedParameterType: + * + * A scheduler parameter field type. Provided for backwards + * compatibility; virTypedParameterType is the preferred enum since + * 0.9.2. + */ +typedef enum { + VIR_DOMAIN_SCHED_FIELD_INT = VIR_TYPED_PARAM_INT, + VIR_DOMAIN_SCHED_FIELD_UINT = VIR_TYPED_PARAM_UINT, + VIR_DOMAIN_SCHED_FIELD_LLONG = VIR_TYPED_PARAM_LLONG, + VIR_DOMAIN_SCHED_FIELD_ULLONG = VIR_TYPED_PARAM_ULLONG, + VIR_DOMAIN_SCHED_FIELD_DOUBLE = VIR_TYPED_PARAM_DOUBLE, + VIR_DOMAIN_SCHED_FIELD_BOOLEAN = VIR_TYPED_PARAM_BOOLEAN, +} virSchedParameterType; + +/** + * VIR_DOMAIN_SCHED_FIELD_LENGTH: + * + * Macro providing the field length of virSchedParameter. Provided + * for backwards compatibility; VIR_TYPED_PARAM_FIELD_LENGTH is the + * preferred value since 0.9.2. + */ +#define VIR_DOMAIN_SCHED_FIELD_LENGTH VIR_TYPED_PARAM_FIELD_LENGTH + +/** + * virDomainSchedParameter: + * + * a virDomainSchedParameter is the set of scheduler parameters. + * Provided for backwards compatibility; virTypedParameter is the + * preferred alias since 0.9.2. + */ +typedef struct _virTypedParameter virSchedParameter; + +/** + * virSchedParameterPtr: + * + * a virSchedParameterPtr is a pointer to a virSchedParameter structure. + * Provided for backwards compatibility; virTypedParameterPtr is the + * preferred alias since 0.9.2. + */ +typedef virSchedParameter *virSchedParameterPtr; + +/** + * virDomainBlkioParameterType: + * + * A blkio parameter field type. Provided for backwards + * compatibility; virTypedParameterType is the preferred enum since + * 0.9.2. + */ +typedef enum { + VIR_DOMAIN_BLKIO_PARAM_INT = VIR_TYPED_PARAM_INT, + VIR_DOMAIN_BLKIO_PARAM_UINT = VIR_TYPED_PARAM_UINT, + VIR_DOMAIN_BLKIO_PARAM_LLONG = VIR_TYPED_PARAM_LLONG, + VIR_DOMAIN_BLKIO_PARAM_ULLONG = VIR_TYPED_PARAM_ULLONG, + VIR_DOMAIN_BLKIO_PARAM_DOUBLE = VIR_TYPED_PARAM_DOUBLE, + VIR_DOMAIN_BLKIO_PARAM_BOOLEAN = VIR_TYPED_PARAM_BOOLEAN, +} virBlkioParameterType; + +/** + * VIR_DOMAIN_BLKIO_FIELD_LENGTH: + * + * Macro providing the field length of virBlkioParameter. Provided + * for backwards compatibility; VIR_TYPED_PARAM_FIELD_LENGTH is the + * preferred value since 0.9.2. + */ +#define VIR_DOMAIN_BLKIO_FIELD_LENGTH VIR_TYPED_PARAM_FIELD_LENGTH + +/** + * virDomainBlkioParameter: + * + * a virDomainBlkioParameter is the set of blkio parameters. + * Provided for backwards compatibility; virTypedParameter is the + * preferred alias since 0.9.2. + */ +typedef struct _virTypedParameter virBlkioParameter; + +/** + * virBlkioParameterPtr: + * + * a virBlkioParameterPtr is a pointer to a virBlkioParameter structure. + * Provided for backwards compatibility; virTypedParameterPtr is the + * preferred alias since 0.9.2. + */ +typedef virBlkioParameter *virBlkioParameterPtr; + +/** + * virDomainMemoryParameterType: + * + * A memory parameter field type. Provided for backwards + * compatibility; virTypedParameterType is the preferred enum since + * 0.9.2. + */ +typedef enum { + VIR_DOMAIN_MEMORY_PARAM_INT = VIR_TYPED_PARAM_INT, + VIR_DOMAIN_MEMORY_PARAM_UINT = VIR_TYPED_PARAM_UINT, + VIR_DOMAIN_MEMORY_PARAM_LLONG = VIR_TYPED_PARAM_LLONG, + VIR_DOMAIN_MEMORY_PARAM_ULLONG = VIR_TYPED_PARAM_ULLONG, + VIR_DOMAIN_MEMORY_PARAM_DOUBLE = VIR_TYPED_PARAM_DOUBLE, + VIR_DOMAIN_MEMORY_PARAM_BOOLEAN = VIR_TYPED_PARAM_BOOLEAN, +} virMemoryParameterType; + +/** + * VIR_DOMAIN_MEMORY_FIELD_LENGTH: + * + * Macro providing the field length of virMemoryParameter. Provided + * for backwards compatibility; VIR_TYPED_PARAM_FIELD_LENGTH is the + * preferred value since 0.9.2. + */ +#define VIR_DOMAIN_MEMORY_FIELD_LENGTH VIR_TYPED_PARAM_FIELD_LENGTH + +/** + * virDomainMemoryParameter: + * + * a virDomainMemoryParameter is the set of scheduler parameters. + * Provided for backwards compatibility; virTypedParameter is the + * preferred alias since 0.9.2. + */ +typedef struct _virTypedParameter virMemoryParameter; + +/** + * virMemoryParameterPtr: + * + * a virMemoryParameterPtr is a pointer to a virMemoryParameter structure. + * Provided for backwards compatibility; virTypedParameterPtr is the + * preferred alias since 0.9.2. + */ +typedef virMemoryParameter *virMemoryParameterPtr; + #ifdef __cplusplus } #endif diff --git a/python/libvirt-override.c b/python/libvirt-override.c index 11e1d0c..26b8f62 100644 --- a/python/libvirt-override.c +++ b/python/libvirt-override.c @@ -203,7 +203,7 @@ libvirt_virDomainGetSchedulerParameters(PyObject *self ATTRIBUTE_UNUSED, char *c_retval; int i_retval; int nparams, i; - virSchedParameterPtr params; + virTypedParameterPtr params; if (!PyArg_ParseTuple(args, (char *)"O:virDomainGetScedulerParameters", &pyobj_domain)) @@ -239,27 +239,27 @@ libvirt_virDomainGetSchedulerParameters(PyObject *self ATTRIBUTE_UNUSED, PyObject *key, *val; switch (params[i].type) { - case VIR_DOMAIN_SCHED_FIELD_INT: + case VIR_TYPED_PARAM_INT: val = PyInt_FromLong((long)params[i].value.i); break; - case VIR_DOMAIN_SCHED_FIELD_UINT: + case VIR_TYPED_PARAM_UINT: val = PyInt_FromLong((long)params[i].value.ui); break; - case VIR_DOMAIN_SCHED_FIELD_LLONG: + case VIR_TYPED_PARAM_LLONG: val = PyLong_FromLongLong((long long)params[i].value.l); break; - case VIR_DOMAIN_SCHED_FIELD_ULLONG: + case VIR_TYPED_PARAM_ULLONG: val = PyLong_FromLongLong((long long)params[i].value.ul); break; - case VIR_DOMAIN_SCHED_FIELD_DOUBLE: + case VIR_TYPED_PARAM_DOUBLE: val = PyFloat_FromDouble((double)params[i].value.d); break; - case VIR_DOMAIN_SCHED_FIELD_BOOLEAN: + case VIR_TYPED_PARAM_BOOLEAN: val = PyBool_FromLong((long)params[i].value.b); break; @@ -284,7 +284,7 @@ libvirt_virDomainSetSchedulerParameters(PyObject *self ATTRIBUTE_UNUSED, char *c_retval; int i_retval; int nparams, i; - virSchedParameterPtr params; + virTypedParameterPtr params; if (!PyArg_ParseTuple(args, (char *)"OO:virDomainSetScedulerParameters", &pyobj_domain, &info)) @@ -322,27 +322,27 @@ libvirt_virDomainSetSchedulerParameters(PyObject *self ATTRIBUTE_UNUSED, continue; switch (params[i].type) { - case VIR_DOMAIN_SCHED_FIELD_INT: + case VIR_TYPED_PARAM_INT: params[i].value.i = (int)PyInt_AS_LONG(val); break; - case VIR_DOMAIN_SCHED_FIELD_UINT: + case VIR_TYPED_PARAM_UINT: params[i].value.ui = (unsigned int)PyInt_AS_LONG(val); break; - case VIR_DOMAIN_SCHED_FIELD_LLONG: + case VIR_TYPED_PARAM_LLONG: params[i].value.l = (long long)PyLong_AsLongLong(val); break; - case VIR_DOMAIN_SCHED_FIELD_ULLONG: + case VIR_TYPED_PARAM_ULLONG: params[i].value.ul = (unsigned long long)PyLong_AsLongLong(val); break; - case VIR_DOMAIN_SCHED_FIELD_DOUBLE: + case VIR_TYPED_PARAM_DOUBLE: params[i].value.d = (double)PyFloat_AsDouble(val); break; - case VIR_DOMAIN_SCHED_FIELD_BOOLEAN: + case VIR_TYPED_PARAM_BOOLEAN: { /* Hack - Python's definition of Py_True breaks strict * aliasing rules, so can't directly compare :-( diff --git a/src/driver.h b/src/driver.h index 450dd53..d3842d0 100644 --- a/src/driver.h +++ b/src/driver.h @@ -141,25 +141,25 @@ typedef int typedef int (*virDrvDomainSetMemoryParameters) (virDomainPtr domain, - virMemoryParameterPtr params, + virTypedParameterPtr params, int nparams, unsigned int flags); typedef int (*virDrvDomainGetMemoryParameters) (virDomainPtr domain, - virMemoryParameterPtr params, + virTypedParameterPtr params, int *nparams, unsigned int flags); typedef int (*virDrvDomainSetBlkioParameters) (virDomainPtr domain, - virBlkioParameterPtr params, + virTypedParameterPtr params, int nparams, unsigned int flags); typedef int (*virDrvDomainGetBlkioParameters) (virDomainPtr domain, - virBlkioParameterPtr params, + virTypedParameterPtr params, int *nparams, unsigned int flags); typedef int @@ -276,19 +276,19 @@ typedef char * typedef int (*virDrvDomainGetSchedulerParameters) (virDomainPtr domain, - virSchedParameterPtr params, + virTypedParameterPtr params, int *nparams); typedef int (*virDrvDomainSetSchedulerParameters) (virDomainPtr domain, - virSchedParameterPtr params, + virTypedParameterPtr params, int nparams); typedef int (*virDrvDomainSetSchedulerParametersFlags) (virDomainPtr domain, - virSchedParameterPtr params, + virTypedParameterPtr params, int nparams, unsigned int flags); diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c index bb9d60a..5d3325b 100644 --- a/src/esx/esx_driver.c +++ b/src/esx/esx_driver.c @@ -3483,12 +3483,12 @@ esxDomainSetAutostart(virDomainPtr domain, int autostart) * * Available parameters: * - * - reservation (VIR_DOMAIN_SCHED_FIELD_LLONG >= 0, in megaherz) + * - reservation (VIR_TYPED_PARAM_LLONG >= 0, in megaherz) * * The amount of CPU resource that is guaranteed to be available to the domain. * * - * - limit (VIR_DOMAIN_SCHED_FIELD_LLONG >= 0, or -1, in megaherz) + * - limit (VIR_TYPED_PARAM_LLONG >= 0, or -1, in megaherz) * * The CPU utilization of the domain will be limited to this value, even if * more CPU resources are available. If the limit is set to -1, the CPU @@ -3496,7 +3496,7 @@ esxDomainSetAutostart(virDomainPtr domain, int autostart) * must be greater than or equal to the reservation. * * - * - shares (VIR_DOMAIN_SCHED_FIELD_INT >= 0, or in {-1, -2, -3}, no unit) + * - shares (VIR_TYPED_PARAM_INT >= 0, or in {-1, -2, -3}, no unit) * * Shares are used to determine relative CPU allocation between domains. In * general, a domain with more shares gets proportionally more of the CPU @@ -3522,7 +3522,7 @@ esxDomainGetSchedulerType(virDomainPtr domain ATTRIBUTE_UNUSED, int *nparams) static int esxDomainGetSchedulerParameters(virDomainPtr domain, - virSchedParameterPtr params, int *nparams) + virTypedParameterPtr params, int *nparams) { int result = -1; esxPrivate *priv = domain->conn->privateData; @@ -3558,10 +3558,10 @@ esxDomainGetSchedulerParameters(virDomainPtr domain, dynamicProperty = dynamicProperty->_next) { if (STREQ(dynamicProperty->name, "config.cpuAllocation.reservation") && ! (mask & (1 << 0))) { - snprintf (params[i].field, VIR_DOMAIN_SCHED_FIELD_LENGTH, "%s", + snprintf (params[i].field, VIR_TYPED_PARAM_FIELD_LENGTH, "%s", "reservation"); - params[i].type = VIR_DOMAIN_SCHED_FIELD_LLONG; + params[i].type = VIR_TYPED_PARAM_LLONG; if (esxVI_AnyType_ExpectType(dynamicProperty->val, esxVI_Type_Long) < 0) { @@ -3574,10 +3574,10 @@ esxDomainGetSchedulerParameters(virDomainPtr domain, } else if (STREQ(dynamicProperty->name, "config.cpuAllocation.limit") && ! (mask & (1 << 1))) { - snprintf (params[i].field, VIR_DOMAIN_SCHED_FIELD_LENGTH, "%s", + snprintf (params[i].field, VIR_TYPED_PARAM_FIELD_LENGTH, "%s", "limit"); - params[i].type = VIR_DOMAIN_SCHED_FIELD_LLONG; + params[i].type = VIR_TYPED_PARAM_LLONG; if (esxVI_AnyType_ExpectType(dynamicProperty->val, esxVI_Type_Long) < 0) { @@ -3590,10 +3590,10 @@ esxDomainGetSchedulerParameters(virDomainPtr domain, } else if (STREQ(dynamicProperty->name, "config.cpuAllocation.shares") && ! (mask & (1 << 2))) { - snprintf (params[i].field, VIR_DOMAIN_SCHED_FIELD_LENGTH, "%s", + snprintf (params[i].field, VIR_TYPED_PARAM_FIELD_LENGTH, "%s", "shares"); - params[i].type = VIR_DOMAIN_SCHED_FIELD_INT; + params[i].type = VIR_TYPED_PARAM_INT; if (esxVI_SharesInfo_CastFromAnyType(dynamicProperty->val, &sharesInfo) < 0) { @@ -3647,7 +3647,7 @@ esxDomainGetSchedulerParameters(virDomainPtr domain, static int esxDomainSetSchedulerParameters(virDomainPtr domain, - virSchedParameterPtr params, int nparams) + virTypedParameterPtr params, int nparams) { int result = -1; esxPrivate *priv = domain->conn->privateData; @@ -3673,7 +3673,7 @@ esxDomainSetSchedulerParameters(virDomainPtr domain, for (i = 0; i < nparams; ++i) { if (STREQ (params[i].field, "reservation") && - params[i].type == VIR_DOMAIN_SCHED_FIELD_LLONG) { + params[i].type == VIR_TYPED_PARAM_LLONG) { if (esxVI_Long_Alloc(&spec->cpuAllocation->reservation) < 0) { goto cleanup; } @@ -3687,7 +3687,7 @@ esxDomainSetSchedulerParameters(virDomainPtr domain, spec->cpuAllocation->reservation->value = params[i].value.l; } else if (STREQ (params[i].field, "limit") && - params[i].type == VIR_DOMAIN_SCHED_FIELD_LLONG) { + params[i].type == VIR_TYPED_PARAM_LLONG) { if (esxVI_Long_Alloc(&spec->cpuAllocation->limit) < 0) { goto cleanup; } @@ -3702,7 +3702,7 @@ esxDomainSetSchedulerParameters(virDomainPtr domain, spec->cpuAllocation->limit->value = params[i].value.l; } else if (STREQ (params[i].field, "shares") && - params[i].type == VIR_DOMAIN_SCHED_FIELD_INT) { + params[i].type == VIR_TYPED_PARAM_INT) { if (esxVI_SharesInfo_Alloc(&sharesInfo) < 0 || esxVI_Int_Alloc(&sharesInfo->shares) < 0) { goto cleanup; @@ -4495,7 +4495,7 @@ esxDomainSnapshotDelete(virDomainSnapshotPtr snapshot, unsigned int flags) static int -esxDomainSetMemoryParameters(virDomainPtr domain, virMemoryParameterPtr params, +esxDomainSetMemoryParameters(virDomainPtr domain, virTypedParameterPtr params, int nparams, unsigned int flags) { int result = -1; @@ -4523,7 +4523,7 @@ esxDomainSetMemoryParameters(virDomainPtr domain, virMemoryParameterPtr params, for (i = 0; i < nparams; ++i) { if (STREQ (params[i].field, VIR_DOMAIN_MEMORY_MIN_GUARANTEE) && - params[i].type == VIR_DOMAIN_SCHED_FIELD_ULLONG) { + params[i].type == VIR_TYPED_PARAM_ULLONG) { if (esxVI_Long_Alloc(&spec->memoryAllocation->reservation) < 0) { goto cleanup; } @@ -4567,7 +4567,7 @@ esxDomainSetMemoryParameters(virDomainPtr domain, virMemoryParameterPtr params, static int -esxDomainGetMemoryParameters(virDomainPtr domain, virMemoryParameterPtr params, +esxDomainGetMemoryParameters(virDomainPtr domain, virTypedParameterPtr params, int *nparams, unsigned int flags) { int result = -1; @@ -4611,7 +4611,7 @@ esxDomainGetMemoryParameters(virDomainPtr domain, virMemoryParameterPtr params, goto cleanup; } - params[0].type = VIR_DOMAIN_SCHED_FIELD_ULLONG; + params[0].type = VIR_TYPED_PARAM_ULLONG; params[0].value.ul = reservation->value * 1024; /* Scale from megabytes to kilobytes */ *nparams = 1; diff --git a/src/libvirt.c b/src/libvirt.c index 56b1257..0292b66 100644 --- a/src/libvirt.c +++ b/src/libvirt.c @@ -3003,7 +3003,7 @@ error: */ int virDomainSetMemoryParameters(virDomainPtr domain, - virMemoryParameterPtr params, + virTypedParameterPtr params, int nparams, unsigned int flags) { virConnectPtr conn; @@ -3057,15 +3057,15 @@ error: * As the value of @nparams is dynamic, call the API setting @nparams to 0 and * @params as NULL, the API returns the number of parameters supported by the * HV by updating @nparams on SUCCESS. The caller should then allocate @params - * array, i.e. (sizeof(@virMemoryParameter) * @nparams) bytes and call the API + * array, i.e. (sizeof(@virTypedParameter) * @nparams) bytes and call the API * again. * * Here is the sample code snippet: * * if ((virDomainGetMemoryParameters(dom, NULL, &nparams, 0) == 0) && * (nparams != 0)) { - * params = vshMalloc(ctl, sizeof(virMemoryParameter) * nparams); - * memset(params, 0, sizeof(virMemoryParameter) * nparams); + * params = vshMalloc(ctl, sizeof(*params) * nparams); + * memset(params, 0, sizeof(*params) * nparams); * if (virDomainGetMemoryParameters(dom, params, &nparams, 0)) { * vshError(ctl, "%s", _("Unable to get memory parameters")); * goto error; @@ -3079,7 +3079,7 @@ error: */ int virDomainGetMemoryParameters(virDomainPtr domain, - virMemoryParameterPtr params, + virTypedParameterPtr params, int *nparams, unsigned int flags) { virConnectPtr conn; @@ -3129,7 +3129,7 @@ error: */ int virDomainSetBlkioParameters(virDomainPtr domain, - virBlkioParameterPtr params, + virTypedParameterPtr params, int nparams, unsigned int flags) { virConnectPtr conn; @@ -3187,7 +3187,7 @@ error: */ int virDomainGetBlkioParameters(virDomainPtr domain, - virBlkioParameterPtr params, + virTypedParameterPtr params, int *nparams, unsigned int flags) { virConnectPtr conn; @@ -5027,7 +5027,7 @@ error: */ int virDomainGetSchedulerParameters(virDomainPtr domain, - virSchedParameterPtr params, int *nparams) + virTypedParameterPtr params, int *nparams) { virConnectPtr conn; @@ -5071,7 +5071,7 @@ error: */ int virDomainSetSchedulerParameters(virDomainPtr domain, - virSchedParameterPtr params, int nparams) + virTypedParameterPtr params, int nparams) { virConnectPtr conn; @@ -5121,7 +5121,7 @@ error: */ int virDomainSetSchedulerParametersFlags(virDomainPtr domain, - virSchedParameterPtr params, + virTypedParameterPtr params, int nparams, unsigned int flags) { diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 6226a49..25e8adb 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -2427,7 +2427,7 @@ cleanup: } static int -libxlDomainGetSchedulerParameters(virDomainPtr dom, virSchedParameterPtr params, +libxlDomainGetSchedulerParameters(virDomainPtr dom, virTypedParameterPtr params, int *nparams) { libxlDriverPrivatePtr driver = dom->conn->privateData; @@ -2479,7 +2479,7 @@ libxlDomainGetSchedulerParameters(virDomainPtr dom, virSchedParameterPtr params, } params[0].value.ui = sc_info.weight; - params[0].type = VIR_DOMAIN_SCHED_FIELD_UINT; + params[0].type = VIR_TYPED_PARAM_UINT; if (virStrcpyStatic(params[0].field, "weight") == NULL) { libxlError(VIR_ERR_INTERNAL_ERROR, "%s", _("Field weight too long for destination")); @@ -2487,7 +2487,7 @@ libxlDomainGetSchedulerParameters(virDomainPtr dom, virSchedParameterPtr params, } params[1].value.ui = sc_info.cap; - params[1].type = VIR_DOMAIN_SCHED_FIELD_UINT; + params[1].type = VIR_TYPED_PARAM_UINT; if (virStrcpyStatic(params[1].field, "cap") == NULL) { libxlError(VIR_ERR_INTERNAL_ERROR, "%s", _("Field cap too long for destination")); @@ -2503,7 +2503,7 @@ cleanup: } static int -libxlDomainSetSchedulerParameters(virDomainPtr dom, virSchedParameterPtr params, +libxlDomainSetSchedulerParameters(virDomainPtr dom, virTypedParameterPtr params, int nparams) { libxlDriverPrivatePtr driver = dom->conn->privateData; @@ -2549,10 +2549,10 @@ libxlDomainSetSchedulerParameters(virDomainPtr dom, virSchedParameterPtr params, } for (i = 0; i < nparams; ++i) { - virSchedParameterPtr param = ¶ms[i]; + virTypedParameterPtr param = ¶ms[i]; if (STREQ(param->field, "weight")) { - if (param->type != VIR_DOMAIN_SCHED_FIELD_UINT) { + if (param->type != VIR_TYPED_PARAM_UINT) { libxlError(VIR_ERR_INVALID_ARG, "%s", _("invalid type for weight tunable, expected a 'uint'")); goto cleanup; @@ -2560,7 +2560,7 @@ libxlDomainSetSchedulerParameters(virDomainPtr dom, virSchedParameterPtr params, sc_info.weight = params[i].value.ui; } else if (STREQ(param->field, "cap")) { - if (param->type != VIR_DOMAIN_SCHED_FIELD_UINT) { + if (param->type != VIR_TYPED_PARAM_UINT) { libxlError(VIR_ERR_INVALID_ARG, "%s", _("invalid type for cap tunable, expected a 'uint'")); goto cleanup; diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index 2bb592d..40e1746 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -745,7 +745,7 @@ cleanup: } static int lxcDomainSetMemoryParameters(virDomainPtr dom, - virMemoryParameterPtr params, + virTypedParameterPtr params, int nparams, unsigned int flags ATTRIBUTE_UNUSED) { @@ -774,11 +774,11 @@ static int lxcDomainSetMemoryParameters(virDomainPtr dom, ret = 0; for (i = 0; i < nparams; i++) { - virMemoryParameterPtr param = ¶ms[i]; + virTypedParameterPtr param = ¶ms[i]; if (STREQ(param->field, VIR_DOMAIN_MEMORY_HARD_LIMIT)) { int rc; - if (param->type != VIR_DOMAIN_MEMORY_PARAM_ULLONG) { + if (param->type != VIR_TYPED_PARAM_ULLONG) { lxcError(VIR_ERR_INVALID_ARG, "%s", _("invalid type for memory hard_limit tunable, expected a 'ullong'")); ret = -1; @@ -793,7 +793,7 @@ static int lxcDomainSetMemoryParameters(virDomainPtr dom, } } else if (STREQ(param->field, VIR_DOMAIN_MEMORY_SOFT_LIMIT)) { int rc; - if (param->type != VIR_DOMAIN_MEMORY_PARAM_ULLONG) { + if (param->type != VIR_TYPED_PARAM_ULLONG) { lxcError(VIR_ERR_INVALID_ARG, "%s", _("invalid type for memory soft_limit tunable, expected a 'ullong'")); ret = -1; @@ -808,7 +808,7 @@ static int lxcDomainSetMemoryParameters(virDomainPtr dom, } } else if (STREQ(param->field, VIR_DOMAIN_MEMORY_SWAP_HARD_LIMIT)) { int rc; - if (param->type != VIR_DOMAIN_MEMORY_PARAM_ULLONG) { + if (param->type != VIR_TYPED_PARAM_ULLONG) { lxcError(VIR_ERR_INVALID_ARG, "%s", _("invalid type for swap_hard_limit tunable, expected a 'ullong'")); ret = -1; @@ -842,7 +842,7 @@ cleanup: } static int lxcDomainGetMemoryParameters(virDomainPtr dom, - virMemoryParameterPtr params, + virTypedParameterPtr params, int *nparams, unsigned int flags ATTRIBUTE_UNUSED) { @@ -884,10 +884,10 @@ static int lxcDomainGetMemoryParameters(virDomainPtr dom, } for (i = 0; i < *nparams; i++) { - virMemoryParameterPtr param = ¶ms[i]; + virTypedParameterPtr param = ¶ms[i]; val = 0; param->value.ul = 0; - param->type = VIR_DOMAIN_MEMORY_PARAM_ULLONG; + param->type = VIR_TYPED_PARAM_ULLONG; switch(i) { case 0: /* fill memory hard limit here */ @@ -2161,7 +2161,7 @@ static char *lxcGetSchedulerType(virDomainPtr domain ATTRIBUTE_UNUSED, } static int lxcSetSchedulerParameters(virDomainPtr domain, - virSchedParameterPtr params, + virTypedParameterPtr params, int nparams) { lxc_driver_t *driver = domain->conn->privateData; @@ -2188,7 +2188,7 @@ static int lxcSetSchedulerParameters(virDomainPtr domain, goto cleanup; for (i = 0; i < nparams; i++) { - virSchedParameterPtr param = ¶ms[i]; + virTypedParameterPtr param = ¶ms[i]; if (STRNEQ(param->field, "cpu_shares")) { lxcError(VIR_ERR_INVALID_ARG, @@ -2196,7 +2196,7 @@ static int lxcSetSchedulerParameters(virDomainPtr domain, goto cleanup; } - if (param->type != VIR_DOMAIN_SCHED_FIELD_ULLONG) { + if (param->type != VIR_TYPED_PARAM_ULLONG) { lxcError(VIR_ERR_INVALID_ARG, "%s", _("Invalid type for cpu_shares tunable, expected a 'ullong'")); goto cleanup; @@ -2222,7 +2222,7 @@ cleanup: } static int lxcGetSchedulerParameters(virDomainPtr domain, - virSchedParameterPtr params, + virTypedParameterPtr params, int *nparams) { lxc_driver_t *driver = domain->conn->privateData; @@ -2262,7 +2262,7 @@ static int lxcGetSchedulerParameters(virDomainPtr domain, "%s", _("Field cpu_shares too big for destination")); goto cleanup; } - params[0].type = VIR_DOMAIN_SCHED_FIELD_ULLONG; + params[0].type = VIR_TYPED_PARAM_ULLONG; ret = 0; diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index fdb3b30..ffc9e78 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -4638,7 +4638,7 @@ cleanup: } static int qemuDomainSetBlkioParameters(virDomainPtr dom, - virBlkioParameterPtr params, + virTypedParameterPtr params, int nparams, unsigned int flags) { @@ -4677,11 +4677,11 @@ static int qemuDomainSetBlkioParameters(virDomainPtr dom, ret = 0; for (i = 0; i < nparams; i++) { - virBlkioParameterPtr param = ¶ms[i]; + virTypedParameterPtr param = ¶ms[i]; if (STREQ(param->field, VIR_DOMAIN_BLKIO_WEIGHT)) { int rc; - if (param->type != VIR_DOMAIN_BLKIO_PARAM_UINT) { + 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; @@ -4717,7 +4717,7 @@ cleanup: } static int qemuDomainGetBlkioParameters(virDomainPtr dom, - virBlkioParameterPtr params, + virTypedParameterPtr params, int *nparams, unsigned int flags) { @@ -4771,10 +4771,10 @@ static int qemuDomainGetBlkioParameters(virDomainPtr dom, } for (i = 0; i < *nparams; i++) { - virBlkioParameterPtr param = ¶ms[i]; + virTypedParameterPtr param = ¶ms[i]; val = 0; param->value.ui = 0; - param->type = VIR_DOMAIN_BLKIO_PARAM_UINT; + param->type = VIR_TYPED_PARAM_UINT; switch (i) { case 0: /* fill blkio weight here */ @@ -4810,7 +4810,7 @@ cleanup: } static int qemuDomainSetMemoryParameters(virDomainPtr dom, - virMemoryParameterPtr params, + virTypedParameterPtr params, int nparams, unsigned int flags ATTRIBUTE_UNUSED) { @@ -4849,11 +4849,11 @@ static int qemuDomainSetMemoryParameters(virDomainPtr dom, ret = 0; for (i = 0; i < nparams; i++) { - virMemoryParameterPtr param = ¶ms[i]; + virTypedParameterPtr param = ¶ms[i]; if (STREQ(param->field, VIR_DOMAIN_MEMORY_HARD_LIMIT)) { int rc; - if (param->type != VIR_DOMAIN_MEMORY_PARAM_ULLONG) { + if (param->type != VIR_TYPED_PARAM_ULLONG) { qemuReportError(VIR_ERR_INVALID_ARG, "%s", _("invalid type for memory hard_limit tunable, expected a 'ullong'")); ret = -1; @@ -4868,7 +4868,7 @@ static int qemuDomainSetMemoryParameters(virDomainPtr dom, } } else if (STREQ(param->field, VIR_DOMAIN_MEMORY_SOFT_LIMIT)) { int rc; - if (param->type != VIR_DOMAIN_MEMORY_PARAM_ULLONG) { + if (param->type != VIR_TYPED_PARAM_ULLONG) { qemuReportError(VIR_ERR_INVALID_ARG, "%s", _("invalid type for memory soft_limit tunable, expected a 'ullong'")); ret = -1; @@ -4883,7 +4883,7 @@ static int qemuDomainSetMemoryParameters(virDomainPtr dom, } } else if (STREQ(param->field, VIR_DOMAIN_MEMORY_SWAP_HARD_LIMIT)) { int rc; - if (param->type != VIR_DOMAIN_MEMORY_PARAM_ULLONG) { + if (param->type != VIR_TYPED_PARAM_ULLONG) { qemuReportError(VIR_ERR_INVALID_ARG, "%s", _("invalid type for swap_hard_limit tunable, expected a 'ullong'")); ret = -1; @@ -4916,7 +4916,7 @@ cleanup: } static int qemuDomainGetMemoryParameters(virDomainPtr dom, - virMemoryParameterPtr params, + virTypedParameterPtr params, int *nparams, unsigned int flags ATTRIBUTE_UNUSED) { @@ -4970,10 +4970,10 @@ static int qemuDomainGetMemoryParameters(virDomainPtr dom, } for (i = 0; i < *nparams; i++) { - virMemoryParameterPtr param = ¶ms[i]; + virTypedParameterPtr param = ¶ms[i]; val = 0; param->value.ul = 0; - param->type = VIR_DOMAIN_MEMORY_PARAM_ULLONG; + param->type = VIR_TYPED_PARAM_ULLONG; switch (i) { case 0: /* fill memory hard limit here */ @@ -5039,7 +5039,7 @@ cleanup: } static int qemuSetSchedulerParametersFlags(virDomainPtr dom, - virSchedParameterPtr params, + virTypedParameterPtr params, int nparams, unsigned int flags) { @@ -5100,11 +5100,11 @@ static int qemuSetSchedulerParametersFlags(virDomainPtr dom, } for (i = 0; i < nparams; i++) { - virSchedParameterPtr param = ¶ms[i]; + virTypedParameterPtr param = ¶ms[i]; if (STREQ(param->field, "cpu_shares")) { int rc; - if (param->type != VIR_DOMAIN_SCHED_FIELD_ULLONG) { + if (param->type != VIR_TYPED_PARAM_ULLONG) { qemuReportError(VIR_ERR_INVALID_ARG, "%s", _("invalid type for cpu_shares tunable, expected a 'ullong'")); goto cleanup; @@ -5154,7 +5154,7 @@ cleanup: } static int qemuSetSchedulerParameters(virDomainPtr dom, - virSchedParameterPtr params, + virTypedParameterPtr params, int nparams) { return qemuSetSchedulerParametersFlags(dom, @@ -5164,7 +5164,7 @@ static int qemuSetSchedulerParameters(virDomainPtr dom, } static int qemuGetSchedulerParameters(virDomainPtr dom, - virSchedParameterPtr params, + virTypedParameterPtr params, int *nparams) { struct qemud_driver *driver = dom->conn->privateData; @@ -5214,7 +5214,7 @@ static int qemuGetSchedulerParameters(virDomainPtr dom, } out: params[0].value.ul = val; - params[0].type = VIR_DOMAIN_SCHED_FIELD_ULLONG; + params[0].type = VIR_TYPED_PARAM_ULLONG; if (virStrcpyStatic(params[0].field, "cpu_shares") == NULL) { qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Field cpu_shares too long for destination")); diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 5348ea3..a53b781 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -1914,7 +1914,7 @@ cleanup: static int remoteDomainSetMemoryParameters (virDomainPtr domain, - virMemoryParameterPtr params, + virTypedParameterPtr params, int nparams, unsigned int flags) { @@ -1950,7 +1950,7 @@ done: static int remoteDomainGetMemoryParameters (virDomainPtr domain, - virMemoryParameterPtr params, int *nparams, + virTypedParameterPtr params, int *nparams, unsigned int flags) { int rv = -1; @@ -1998,7 +1998,7 @@ done: static int remoteDomainSetBlkioParameters (virDomainPtr domain, - virBlkioParameterPtr params, + virTypedParameterPtr params, int nparams, unsigned int flags) { @@ -2034,8 +2034,8 @@ done: static int remoteDomainGetBlkioParameters (virDomainPtr domain, - virBlkioParameterPtr params, int *nparams, - unsigned int flags) + virTypedParameterPtr params, int *nparams, + unsigned int flags) { int rv = -1; remote_domain_get_blkio_parameters_args args; @@ -2465,7 +2465,7 @@ done: static int remoteDomainGetSchedulerParameters (virDomainPtr domain, - virSchedParameterPtr params, int *nparams) + virTypedParameterPtr params, int *nparams) { int rv = -1; remote_domain_get_scheduler_parameters_args args; @@ -2501,7 +2501,7 @@ done: static int remoteDomainSetSchedulerParameters (virDomainPtr domain, - virSchedParameterPtr params, int nparams) + virTypedParameterPtr params, int nparams) { int rv = -1; remote_domain_set_scheduler_parameters_args args; @@ -2533,7 +2533,7 @@ done: static int remoteDomainSetSchedulerParametersFlags(virDomainPtr domain, - virSchedParameterPtr params, + virTypedParameterPtr params, int nparams, unsigned int flags) { diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 658bcee..abcdb9d 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -2626,7 +2626,7 @@ static char *testDomainGetSchedulerType(virDomainPtr domain ATTRIBUTE_UNUSED, } static int testDomainGetSchedulerParams(virDomainPtr domain, - virSchedParameterPtr params, + virTypedParameterPtr params, int *nparams) { testConnPtr privconn = domain->conn->privateData; @@ -2648,7 +2648,7 @@ static int testDomainGetSchedulerParams(virDomainPtr domain, goto cleanup; } strcpy(params[0].field, "weight"); - params[0].type = VIR_DOMAIN_SCHED_FIELD_UINT; + params[0].type = VIR_TYPED_PARAM_UINT; /* XXX */ /*params[0].value.ui = privdom->weight;*/ params[0].value.ui = 50; @@ -2662,7 +2662,7 @@ cleanup: static int testDomainSetSchedulerParams(virDomainPtr domain, - virSchedParameterPtr params, + virTypedParameterPtr params, int nparams) { testConnPtr privconn = domain->conn->privateData; @@ -2687,7 +2687,7 @@ static int testDomainSetSchedulerParams(virDomainPtr domain, testError(VIR_ERR_INVALID_ARG, "field"); goto cleanup; } - if (params[0].type != VIR_DOMAIN_SCHED_FIELD_UINT) { + if (params[0].type != VIR_TYPED_PARAM_UINT) { testError(VIR_ERR_INVALID_ARG, "type"); goto cleanup; } diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c index fea8548..f527a7a 100644 --- a/src/xen/xen_driver.c +++ b/src/xen/xen_driver.c @@ -1677,7 +1677,8 @@ xenUnifiedDomainGetSchedulerType (virDomainPtr dom, int *nparams) static int xenUnifiedDomainGetSchedulerParameters (virDomainPtr dom, - virSchedParameterPtr params, int *nparams) + virTypedParameterPtr params, + int *nparams) { GET_PRIVATE(dom->conn); int i, ret; @@ -1694,7 +1695,8 @@ xenUnifiedDomainGetSchedulerParameters (virDomainPtr dom, static int xenUnifiedDomainSetSchedulerParameters (virDomainPtr dom, - virSchedParameterPtr params, int nparams) + virTypedParameterPtr params, + int nparams) { GET_PRIVATE(dom->conn); int i, ret; diff --git a/src/xen/xen_hypervisor.c b/src/xen/xen_hypervisor.c index 3ec6e2b..efd70cb 100644 --- a/src/xen/xen_hypervisor.c +++ b/src/xen/xen_hypervisor.c @@ -1,7 +1,7 @@ /* * xen_internal.c: direct access to Xen hypervisor level * - * Copyright (C) 2005-2010 Red Hat, Inc. + * Copyright (C) 2005-2011 Red Hat, Inc. * * See COPYING.LIB for the License of this software * @@ -1242,7 +1242,7 @@ static const char *str_cap = "cap"; */ int xenHypervisorGetSchedulerParameters(virDomainPtr domain, - virSchedParameterPtr params, int *nparams) + virTypedParameterPtr params, int *nparams) { xenUnifiedPrivatePtr priv; @@ -1308,7 +1308,7 @@ xenHypervisorGetSchedulerParameters(virDomainPtr domain, "Weight %s too big for destination", str_weight); return -1; } - params[0].type = VIR_DOMAIN_SCHED_FIELD_UINT; + params[0].type = VIR_TYPED_PARAM_UINT; params[0].value.ui = op_dom.u.getschedinfo.u.credit.weight; if (virStrcpyStatic(params[1].field, str_cap) == NULL) { @@ -1316,7 +1316,7 @@ xenHypervisorGetSchedulerParameters(virDomainPtr domain, "Cap %s too big for destination", str_cap); return -1; } - params[1].type = VIR_DOMAIN_SCHED_FIELD_UINT; + params[1].type = VIR_TYPED_PARAM_UINT; params[1].value.ui = op_dom.u.getschedinfo.u.credit.cap; *nparams = 2; @@ -1342,7 +1342,7 @@ xenHypervisorGetSchedulerParameters(virDomainPtr domain, */ int xenHypervisorSetSchedulerParameters(virDomainPtr domain, - virSchedParameterPtr params, int nparams) + virTypedParameterPtr params, int nparams) { int i; unsigned int val; @@ -1416,7 +1416,7 @@ xenHypervisorSetSchedulerParameters(virDomainPtr domain, for (i = 0; i < nparams; i++) { memset(&buf, 0, sizeof(buf)); if (STREQ (params[i].field, str_weight) && - params[i].type == VIR_DOMAIN_SCHED_FIELD_UINT) { + params[i].type == VIR_TYPED_PARAM_UINT) { val = params[i].value.ui; if ((val < 1) || (val > USHRT_MAX)) { snprintf(buf, sizeof(buf), _("Credit scheduler weight parameter (%d) is out of range (1-65535)"), val); @@ -1425,7 +1425,7 @@ xenHypervisorSetSchedulerParameters(virDomainPtr domain, } op_dom.u.getschedinfo.u.credit.weight = val; } else if (STREQ (params[i].field, str_cap) && - params[i].type == VIR_DOMAIN_SCHED_FIELD_UINT) { + params[i].type == VIR_TYPED_PARAM_UINT) { val = params[i].value.ui; if (val >= USHRT_MAX) { snprintf(buf, sizeof(buf), _("Credit scheduler cap parameter (%d) is out of range (0-65534)"), val); diff --git a/src/xen/xen_hypervisor.h b/src/xen/xen_hypervisor.h index f7e7699..02ff63a 100644 --- a/src/xen/xen_hypervisor.h +++ b/src/xen/xen_hypervisor.h @@ -1,7 +1,7 @@ /* * xen_internal.h: internal API for direct access to Xen hypervisor level * - * Copyright (C) 2005, 2010 Red Hat, Inc. + * Copyright (C) 2005, 2010-2011 Red Hat, Inc. * * See COPYING.LIB for the License of this software * @@ -101,12 +101,12 @@ char * xenHypervisorGetSchedulerType (virDomainPtr domain, ATTRIBUTE_NONNULL (1); int xenHypervisorGetSchedulerParameters(virDomainPtr domain, - virSchedParameterPtr params, + virTypedParameterPtr params, int *nparams) ATTRIBUTE_NONNULL (1); int xenHypervisorSetSchedulerParameters(virDomainPtr domain, - virSchedParameterPtr params, + virTypedParameterPtr params, int nparams) ATTRIBUTE_NONNULL (1); diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c index dfa0342..b712e8e 100644 --- a/src/xen/xend_internal.c +++ b/src/xen/xend_internal.c @@ -3598,7 +3598,7 @@ static const char *str_cap = "cap"; */ static int xenDaemonGetSchedulerParameters(virDomainPtr domain, - virSchedParameterPtr params, int *nparams) + virTypedParameterPtr params, int *nparams) { xenUnifiedPrivatePtr priv; struct sexpr *root; @@ -3657,7 +3657,7 @@ xenDaemonGetSchedulerParameters(virDomainPtr domain, str_weight); goto error; } - params[0].type = VIR_DOMAIN_SCHED_FIELD_UINT; + params[0].type = VIR_TYPED_PARAM_UINT; params[0].value.ui = sexpr_int(root, "domain/cpu_weight"); if (virStrcpyStatic(params[1].field, str_cap) == NULL) { @@ -3665,7 +3665,7 @@ xenDaemonGetSchedulerParameters(virDomainPtr domain, _("Cap %s too big for destination"), str_cap); goto error; } - params[1].type = VIR_DOMAIN_SCHED_FIELD_UINT; + params[1].type = VIR_TYPED_PARAM_UINT; params[1].value.ui = sexpr_int(root, "domain/cpu_cap"); *nparams = XEN_SCHED_CRED_NPARAM; ret = 0; @@ -3693,7 +3693,7 @@ error: */ static int xenDaemonSetSchedulerParameters(virDomainPtr domain, - virSchedParameterPtr params, int nparams) + virTypedParameterPtr params, int nparams) { xenUnifiedPrivatePtr priv; struct sexpr *root; @@ -3745,10 +3745,10 @@ xenDaemonSetSchedulerParameters(virDomainPtr domain, memset(&buf_cap, 0, VIR_UUID_BUFLEN); for (i = 0; i < nparams; i++) { if (STREQ (params[i].field, str_weight) && - params[i].type == VIR_DOMAIN_SCHED_FIELD_UINT) { + params[i].type == VIR_TYPED_PARAM_UINT) { snprintf(buf_weight, sizeof(buf_weight), "%u", params[i].value.ui); } else if (STREQ (params[i].field, str_cap) && - params[i].type == VIR_DOMAIN_SCHED_FIELD_UINT) { + params[i].type == VIR_TYPED_PARAM_UINT) { snprintf(buf_cap, sizeof(buf_cap), "%u", params[i].value.ui); } else { virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__); diff --git a/tools/virsh.c b/tools/virsh.c index c2f4de6..d98ac03 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -1617,13 +1617,13 @@ static const vshCmdOptDef opts_schedinfo[] = { static int cmdSchedInfoUpdate(vshControl *ctl, const vshCmd *cmd, - virSchedParameterPtr param) + virTypedParameterPtr param) { const char *data = NULL; /* Legacy 'weight' parameter */ if (STREQ(param->field, "weight") && - param->type == VIR_DOMAIN_SCHED_FIELD_UINT && + param->type == VIR_TYPED_PARAM_UINT && vshCommandOptBool(cmd, "weight")) { int val; if (vshCommandOptInt(cmd, "weight", &val) <= 0) { @@ -1637,7 +1637,7 @@ cmdSchedInfoUpdate(vshControl *ctl, const vshCmd *cmd, /* Legacy 'cap' parameter */ if (STREQ(param->field, "cap") && - param->type == VIR_DOMAIN_SCHED_FIELD_UINT && + param->type == VIR_TYPED_PARAM_UINT && vshCommandOptBool(cmd, "cap")) { int val; if (vshCommandOptInt(cmd, "cap", &val) <= 0) { @@ -1665,41 +1665,41 @@ cmdSchedInfoUpdate(vshControl *ctl, const vshCmd *cmd, return 0; switch (param->type) { - case VIR_DOMAIN_SCHED_FIELD_INT: + case VIR_TYPED_PARAM_INT: if (virStrToLong_i(val, NULL, 10, ¶m->value.i) < 0) { vshError(ctl, "%s", _("Invalid value for parameter, expecting an int")); return -1; } break; - case VIR_DOMAIN_SCHED_FIELD_UINT: + case VIR_TYPED_PARAM_UINT: if (virStrToLong_ui(val, NULL, 10, ¶m->value.ui) < 0) { vshError(ctl, "%s", _("Invalid value for parameter, expecting an unsigned int")); return -1; } break; - case VIR_DOMAIN_SCHED_FIELD_LLONG: + case VIR_TYPED_PARAM_LLONG: if (virStrToLong_ll(val, NULL, 10, ¶m->value.l) < 0) { vshError(ctl, "%s", _("Invalid value for parameter, expecting a long long")); return -1; } break; - case VIR_DOMAIN_SCHED_FIELD_ULLONG: + case VIR_TYPED_PARAM_ULLONG: if (virStrToLong_ull(val, NULL, 10, ¶m->value.ul) < 0) { vshError(ctl, "%s", _("Invalid value for parameter, expecting an unsigned long long")); return -1; } break; - case VIR_DOMAIN_SCHED_FIELD_DOUBLE: + case VIR_TYPED_PARAM_DOUBLE: if (virStrToDouble(val, NULL, ¶m->value.d) < 0) { vshError(ctl, "%s", _("Invalid value for parameter, expecting a double")); return -1; } break; - case VIR_DOMAIN_SCHED_FIELD_BOOLEAN: + case VIR_TYPED_PARAM_BOOLEAN: param->value.b = STREQ(val, "0") ? 0 : 1; } return 1; @@ -1714,7 +1714,7 @@ cmdSchedinfo(vshControl *ctl, const vshCmd *cmd) { char *schedulertype; virDomainPtr dom; - virSchedParameterPtr params = NULL; + virTypedParameterPtr params = NULL; int nparams = 0; int update = 0; int i, ret; @@ -1755,9 +1755,9 @@ cmdSchedinfo(vshControl *ctl, const vshCmd *cmd) } if (nparams) { - params = vshMalloc(ctl, sizeof(virSchedParameter)* nparams); + params = vshMalloc(ctl, sizeof(*params) * nparams); - memset(params, 0, sizeof(virSchedParameter)* nparams); + memset(params, 0, sizeof(*params) * nparams); ret = virDomainGetSchedulerParameters(dom, params, &nparams); if (ret == -1) goto cleanup; @@ -1800,22 +1800,22 @@ cmdSchedinfo(vshControl *ctl, const vshCmd *cmd) ret_val = true; for (i = 0; i < nparams; i++){ switch (params[i].type) { - case VIR_DOMAIN_SCHED_FIELD_INT: + case VIR_TYPED_PARAM_INT: vshPrint(ctl, "%-15s: %d\n", params[i].field, params[i].value.i); break; - case VIR_DOMAIN_SCHED_FIELD_UINT: + case VIR_TYPED_PARAM_UINT: vshPrint(ctl, "%-15s: %u\n", params[i].field, params[i].value.ui); break; - case VIR_DOMAIN_SCHED_FIELD_LLONG: + case VIR_TYPED_PARAM_LLONG: vshPrint(ctl, "%-15s: %lld\n", params[i].field, params[i].value.l); break; - case VIR_DOMAIN_SCHED_FIELD_ULLONG: + case VIR_TYPED_PARAM_ULLONG: vshPrint(ctl, "%-15s: %llu\n", params[i].field, params[i].value.ul); break; - case VIR_DOMAIN_SCHED_FIELD_DOUBLE: + case VIR_TYPED_PARAM_DOUBLE: vshPrint(ctl, "%-15s: %f\n", params[i].field, params[i].value.d); break; - case VIR_DOMAIN_SCHED_FIELD_BOOLEAN: + case VIR_TYPED_PARAM_BOOLEAN: vshPrint(ctl, "%-15s: %d\n", params[i].field, params[i].value.b); break; default: @@ -3181,7 +3181,7 @@ cmdBlkiotune(vshControl * ctl, const vshCmd * cmd) int weight = 0; int nparams = 0; unsigned int i = 0; - virBlkioParameterPtr params = NULL, temp = NULL; + virTypedParameterPtr params = NULL, temp = NULL; bool ret = false; if (!vshConnectionUsability(ctl, ctl->conn)) @@ -3228,27 +3228,27 @@ cmdBlkiotune(vshControl * ctl, const vshCmd * cmd) for (i = 0; i < nparams; i++) { switch (params[i].type) { - case VIR_DOMAIN_BLKIO_PARAM_INT: + case VIR_TYPED_PARAM_INT: vshPrint(ctl, "%-15s: %d\n", params[i].field, params[i].value.i); break; - case VIR_DOMAIN_BLKIO_PARAM_UINT: + case VIR_TYPED_PARAM_UINT: vshPrint(ctl, "%-15s: %u\n", params[i].field, params[i].value.ui); break; - case VIR_DOMAIN_BLKIO_PARAM_LLONG: + case VIR_TYPED_PARAM_LLONG: vshPrint(ctl, "%-15s: %lld\n", params[i].field, params[i].value.l); break; - case VIR_DOMAIN_BLKIO_PARAM_ULLONG: + case VIR_TYPED_PARAM_ULLONG: vshPrint(ctl, "%-15s: %llu\n", params[i].field, params[i].value.ul); break; - case VIR_DOMAIN_BLKIO_PARAM_DOUBLE: + case VIR_TYPED_PARAM_DOUBLE: vshPrint(ctl, "%-15s: %f\n", params[i].field, params[i].value.d); break; - case VIR_DOMAIN_BLKIO_PARAM_BOOLEAN: + case VIR_TYPED_PARAM_BOOLEAN: vshPrint(ctl, "%-15s: %d\n", params[i].field, params[i].value.b); break; @@ -3264,7 +3264,7 @@ cmdBlkiotune(vshControl * ctl, const vshCmd * cmd) for (i = 0; i < nparams; i++) { temp = ¶ms[i]; - temp->type = VIR_DOMAIN_BLKIO_PARAM_UINT; + temp->type = VIR_TYPED_PARAM_UINT; if (weight) { temp->value.ui = weight; @@ -3318,7 +3318,7 @@ cmdMemtune(vshControl * ctl, const vshCmd * cmd) long long min_guarantee = 0; int nparams = 0; unsigned int i = 0; - virMemoryParameterPtr params = NULL, temp = NULL; + virTypedParameterPtr params = NULL, temp = NULL; bool ret = false; if (!vshConnectionUsability(ctl, ctl->conn)) @@ -3371,30 +3371,30 @@ cmdMemtune(vshControl * ctl, const vshCmd * cmd) for (i = 0; i < nparams; i++) { switch (params[i].type) { - case VIR_DOMAIN_MEMORY_PARAM_INT: + case VIR_TYPED_PARAM_INT: vshPrint(ctl, "%-15s: %d\n", params[i].field, params[i].value.i); break; - case VIR_DOMAIN_MEMORY_PARAM_UINT: + case VIR_TYPED_PARAM_UINT: vshPrint(ctl, "%-15s: %u\n", params[i].field, params[i].value.ui); break; - case VIR_DOMAIN_MEMORY_PARAM_LLONG: + case VIR_TYPED_PARAM_LLONG: vshPrint(ctl, "%-15s: %lld\n", params[i].field, params[i].value.l); break; - case VIR_DOMAIN_MEMORY_PARAM_ULLONG: + case VIR_TYPED_PARAM_ULLONG: if (params[i].value.ul == VIR_DOMAIN_MEMORY_PARAM_UNLIMITED) vshPrint(ctl, "%-15s: unlimited\n", params[i].field); else vshPrint(ctl, "%-15s: %llu kB\n", params[i].field, params[i].value.ul); break; - case VIR_DOMAIN_MEMORY_PARAM_DOUBLE: + case VIR_TYPED_PARAM_DOUBLE: vshPrint(ctl, "%-15s: %f\n", params[i].field, params[i].value.d); break; - case VIR_DOMAIN_MEMORY_PARAM_BOOLEAN: + case VIR_TYPED_PARAM_BOOLEAN: vshPrint(ctl, "%-15s: %d\n", params[i].field, params[i].value.b); break; @@ -3410,7 +3410,7 @@ cmdMemtune(vshControl * ctl, const vshCmd * cmd) for (i = 0; i < nparams; i++) { temp = ¶ms[i]; - temp->type = VIR_DOMAIN_MEMORY_PARAM_ULLONG; + temp->type = VIR_TYPED_PARAM_ULLONG; /* * Some magic here, this is used to fill the params structure with -- 1.7.4.4 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list