if (qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_BLKIO)) {
for (i = 0; i < vm->def->blkio.ndevices; i++) {
virBlkioDeviceWeightPtr dw = &vm->def->blkio.devices[i];
+ if (!dw->weight)
+ continue;
rc = virCgroupSetBlkioDeviceWeight(cgroup, dw->path,
dw->weight);
if (rc != 0) {
if (vm->def->blkio.ndevices > 0) {
virBuffer buf = VIR_BUFFER_INITIALIZER;
bool comma = false;
+
for (j = 0; j < vm->def->blkio.ndevices; j++) {
if (!vm->def->blkio.devices[j].weight)
continue;
case 1: /* blkiotune.device_weight */
if (persistentDef->blkio.ndevices > 0) {
virBuffer buf = VIR_BUFFER_INITIALIZER;
+ bool comma = false;
+
for (j = 0; j < persistentDef->blkio.ndevices; j++) {
- if (j)
+ if (!persistentDef->blkio.devices[j].weight)
+ continue;
+ if (comma)
virBufferAddChar(&buf, ',');
+ else
+ comma = true;
virBufferAsprintf(&buf, "%s,%u",
persistentDef->blkio.devices[j].path,
persistentDef->blkio.devices[j].weight);
goto cleanup;
}
param->value.s = virBufferContentAndReset(&buf);
- } else {
+ }
+ if (!param->value.s) {
param->value.s = strdup("");
if (!param->value.s) {
virReportOOMError();