On Thu, Jan 19, 2012 at 11:44:45AM -0700, Eric Blake wrote: > Reusing common code makes things smaller; it also buys us some > additional safety, such as now rejecting duplicate parameters > during a set operation. > > * src/qemu/qemu_driver.c (qemuDomainSetBlkioParameters) > (qemuDomainSetMemoryParameters, qemuDomainSetNumaParameters) > (qemuSetSchedulerParametersFlags) > (qemuDomainSetInterfaceParameters, qemuDomainSetBlockIoTune) > (qemuDomainGetBlkioParameters, qemuDomainGetMemoryParameters) > (qemuDomainGetNumaParameters, qemuGetSchedulerParametersFlags) > (qemuDomainBlockStatsFlags, qemuDomainGetInterfaceParameters) > (qemuDomainGetBlockIoTune): Use new helpers. > * src/esx/esx_driver.c (esxDomainSetSchedulerParametersFlags) > (esxDomainSetMemoryParameters) > (esxDomainGetSchedulerParametersFlags) > (esxDomainGetMemoryParameters): Likewise. > * src/libxl/libxl_driver.c > (libxlDomainSetSchedulerParametersFlags) > (libxlDomainGetSchedulerParametersFlags): Likewise. > * src/lxc/lxc_driver.c (lxcDomainSetMemoryParameters) > (lxcSetSchedulerParametersFlags, lxcDomainSetBlkioParameters) > (lxcDomainGetMemoryParameters, lxcGetSchedulerParametersFlags) > (lxcDomainGetBlkioParameters): Likewise. > * src/test/test_driver.c (testDomainSetSchedulerParamsFlags) > (testDomainGetSchedulerParamsFlags): Likewise. > * src/xen/xen_hypervisor.c (xenHypervisorSetSchedulerParameters) > (xenHypervisorGetSchedulerParameters): Likewise. > --- > src/esx/esx_driver.c | 81 +++--- > src/libxl/libxl_driver.c | 44 +--- > src/lxc/lxc_driver.c | 218 +++++----------- > src/qemu/qemu_driver.c | 656 ++++++++++++++-------------------------------- > src/test/test_driver.c | 27 +-- > src/xen/xen_hypervisor.c | 51 ++-- > 6 files changed, 350 insertions(+), 727 deletions(-) > @@ -2968,42 +2922,25 @@ lxcGetSchedulerParametersFlags(virDomainPtr dom, > > if (cpu_bw_status) { > if (*nparams > saved_nparams) { > - params[1].value.ul = period; > - params[1].type = VIR_TYPED_PARAM_ULLONG; > - if (virStrcpyStatic(params[1].field, > - VIR_DOMAIN_SCHEDULER_VCPU_PERIOD) == NULL) { > - lxcError(VIR_ERR_INTERNAL_ERROR, > - _("Field name '%s' too long"), > - VIR_DOMAIN_SCHEDULER_VCPU_PERIOD); > + if (virTypedParameterAssign(¶ms[1], > + VIR_DOMAIN_SCHEDULER_VCPU_PERIOD, > + VIR_TYPED_PARAM_ULLONG, shares) < 0) s/shares/period/ > @@ -6201,21 +6169,11 @@ static int qemuDomainGetBlkioParameters(virDomainPtr dom, > } > param->value.s = virBufferContentAndReset(&buf); > } > - if (!param->value.s) { > - param->value.s = strdup(""); > - if (!param->value.s) { > - virReportOOMError(); > - goto cleanup; > - } > - } > - param->type = VIR_TYPED_PARAM_STRING; > - if (virStrcpyStatic(param->field, > - VIR_DOMAIN_BLKIO_DEVICE_WEIGHT) == NULL) { > - qemuReportError(VIR_ERR_INTERNAL_ERROR, > - _("Field name '%s' too long"), > - VIR_DOMAIN_BLKIO_DEVICE_WEIGHT); > + if (virTypedParameterAssign(param, > + VIR_DOMAIN_BLKIO_DEVICE_WEIGHT, > + VIR_TYPED_PARAM_STRING, > + param->value.s) < 0) > goto cleanup; Is virTypedParameterAssign happy getting a NULL for the string value ? Previously we would have set "" for the parameter rather than NULL ACK with those 2 points resolved Regards, 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 :| -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list