[libvirt] [PATCH 06/11] qemu: Refactor qemuDomainGetBlkioParameters
Ján Tomko
jtomko at redhat.com
Wed May 25 14:11:01 UTC 2016
On Wed, May 25, 2016 at 03:04:04PM +0200, Peter Krempa wrote:
> Get rid of lots of duplicated code.
> ---
> src/qemu/qemu_driver.c | 411 +++++++++----------------------------------------
> 1 file changed, 75 insertions(+), 336 deletions(-)
>
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index e8e1418..a9cfde2 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -9080,6 +9080,57 @@ qemuDomainSetBlkioParameters(virDomainPtr dom,
> return ret;
> }
>
> +
Two empty lines here...
> +static int
> +qemuDomainGetBlkioParametersAssignFromDef(virDomainDefPtr def,
> + virTypedParameterPtr params,
> + int *nparams,
> + int maxparams)
...
> + error:
> + VIR_FREE(data);
> + virBufferFreeAndReset(&buf);
> + return -1;
> +}
> +
... but only one here.
> static int
> qemuDomainGetBlkioParameters(virDomainPtr dom,
> virTypedParameterPtr params,
...
> - if (virTypedParameterAssign(param,
> - VIR_DOMAIN_BLKIO_DEVICE_READ_BPS,
> - VIR_TYPED_PARAM_STRING,
> - param->value.s) < 0)
> - goto cleanup;
> - break;
> + /* fill blkio weight here */
The indentation is off.
> + if (virCgroupGetBlkioWeight(priv->cgroup, &val) < 0)
> + goto cleanup;
> + if (virTypedParameterAssign(&(params[(*nparams)++]),
> + VIR_DOMAIN_BLKIO_WEIGHT,
> + VIR_TYPED_PARAM_UINT, val) < 0)
> + goto cleanup;
>
...
> - virReportError(VIR_ERR_INTERNAL_ERROR,
> - _("Field name '%s' too long"),
> - VIR_DOMAIN_BLKIO_DEVICE_WRITE_BPS);
> - goto cleanup;
> - }
> - break;
> -
> + /* fill blkio weight here */
Here too.
Jan
More information about the libvir-list
mailing list