virBlkioDevicePtr dev = &def->blkio.devices[i];
if (dev->weight &&
- (virCgroupSetBlkioDeviceWeight(cgroup, dev->path,
- dev->weight) < 0 ||
- virCgroupGetBlkioDeviceWeight(cgroup, dev->path,
- &dev->weight) < 0))
+ virCgroupSetupBlkioDeviceWeight(cgroup, dev->path,
+ &dev->weight) < 0)
return -1;
if (dev->riops &&
- (virCgroupSetBlkioDeviceReadIops(cgroup, dev->path,
- dev->riops) < 0 ||
- virCgroupGetBlkioDeviceReadIops(cgroup, dev->path,
- &dev->riops) < 0))
+ virCgroupSetupBlkioDeviceReadIops(cgroup, dev->path,
+ &dev->riops) < 0)
return -1;
if (dev->wiops &&
- (virCgroupSetBlkioDeviceWriteIops(cgroup, dev->path,
- dev->wiops) < 0 ||
- virCgroupGetBlkioDeviceWriteIops(cgroup, dev->path,
- &dev->wiops) < 0))
+ virCgroupSetupBlkioDeviceWriteIops(cgroup, dev->path,
+ &dev->wiops) < 0)
return -1;
if (dev->rbps &&
- (virCgroupSetBlkioDeviceReadBps(cgroup, dev->path,
- dev->rbps) < 0 ||
- virCgroupGetBlkioDeviceReadBps(cgroup, dev->path,
- &dev->rbps) < 0))
+ virCgroupSetupBlkioDeviceReadBps(cgroup, dev->path,
+ &dev->rbps) < 0)
return -1;
if (dev->wbps &&
- (virCgroupSetBlkioDeviceWriteBps(cgroup, dev->path,
- dev->wbps) < 0 ||
- virCgroupGetBlkioDeviceWriteBps(cgroup, dev->path,
- &dev->wbps) < 0))
+ virCgroupSetupBlkioDeviceWriteBps(cgroup, dev->path,
+ &dev->wbps) < 0)
return -1;
}
}
STREQ(param->field, VIR_DOMAIN_BLKIO_DEVICE_WRITE_IOPS) ||
STREQ(param->field, VIR_DOMAIN_BLKIO_DEVICE_READ_BPS) ||
STREQ(param->field, VIR_DOMAIN_BLKIO_DEVICE_WRITE_BPS)) {
+ virCgroupPtr cgroup = priv->cgroup;
size_t ndevices;
virBlkioDevicePtr devices = NULL;
size_t j;
if (STREQ(param->field, VIR_DOMAIN_BLKIO_DEVICE_WEIGHT)) {
for (j = 0; j < ndevices; j++) {
- if (virCgroupSetBlkioDeviceWeight(priv->cgroup,
- devices[j].path,
- devices[j].weight) < 0 ||
- virCgroupGetBlkioDeviceWeight(priv->cgroup,
- devices[j].path,
- &devices[j].weight) < 0) {
+ if (virCgroupSetupBlkioDeviceWeight(cgroup, devices[j].path,
+ &devices[j].weight) < 0) {
ret = -1;
break;
}
}
} else if (STREQ(param->field, VIR_DOMAIN_BLKIO_DEVICE_READ_IOPS)) {
for (j = 0; j < ndevices; j++) {
- if (virCgroupSetBlkioDeviceReadIops(priv->cgroup,
- devices[j].path,
- devices[j].riops) < 0 ||
- virCgroupGetBlkioDeviceReadIops(priv->cgroup,
- devices[j].path,
- &devices[j].riops) < 0) {
+ if (virCgroupSetupBlkioDeviceReadIops(cgroup, devices[j].path,
+ &devices[j].riops) < 0) {
ret = -1;
break;
}
}
} else if (STREQ(param->field, VIR_DOMAIN_BLKIO_DEVICE_WRITE_IOPS)) {
for (j = 0; j < ndevices; j++) {
- if (virCgroupSetBlkioDeviceWriteIops(priv->cgroup,
- devices[j].path,
- devices[j].wiops) < 0 ||
- virCgroupGetBlkioDeviceWriteIops(priv->cgroup,
- devices[j].path,
- &devices[j].wiops) < 0) {
+ if (virCgroupSetupBlkioDeviceWriteIops(cgroup, devices[j].path,
+ &devices[j].wiops) < 0) {
ret = -1;
break;
}
}
} else if (STREQ(param->field, VIR_DOMAIN_BLKIO_DEVICE_READ_BPS)) {
for (j = 0; j < ndevices; j++) {
- if (virCgroupSetBlkioDeviceReadBps(priv->cgroup,
- devices[j].path,
- devices[j].rbps) < 0 ||
- virCgroupGetBlkioDeviceReadBps(priv->cgroup,
- devices[j].path,
- &devices[j].rbps) < 0) {
+ if (virCgroupSetupBlkioDeviceReadBps(cgroup, devices[j].path,
+ &devices[j].rbps) < 0) {
ret = -1;
break;
}
}
} else if (STREQ(param->field, VIR_DOMAIN_BLKIO_DEVICE_WRITE_BPS)) {
for (j = 0; j < ndevices; j++) {
- if (virCgroupSetBlkioDeviceWriteBps(priv->cgroup,
- devices[j].path,
- devices[j].wbps) < 0 ||
- virCgroupGetBlkioDeviceWriteBps(priv->cgroup,
- devices[j].path,
- &devices[j].wbps) < 0) {
+ if (virCgroupSetupBlkioDeviceWriteBps(cgroup, devices[j].path,
+ &devices[j].wbps) < 0) {
ret = -1;
break;
}
if (vm->def->blkio.ndevices) {
for (i = 0; i < vm->def->blkio.ndevices; i++) {
virBlkioDevicePtr dev = &vm->def->blkio.devices[i];
+ virCgroupPtr cgroup = priv->cgroup;
+
if (dev->weight &&
- (virCgroupSetBlkioDeviceWeight(priv->cgroup, dev->path,
- dev->weight) < 0 ||
- virCgroupGetBlkioDeviceWeight(priv->cgroup, dev->path,
- &dev->weight) < 0))
+ virCgroupSetupBlkioDeviceWeight(cgroup, dev->path,
+ &dev->weight) < 0)
return -1;
if (dev->riops &&
- (virCgroupSetBlkioDeviceReadIops(priv->cgroup, dev->path,
- dev->riops) < 0 ||
- virCgroupGetBlkioDeviceReadIops(priv->cgroup, dev->path,
- &dev->riops) < 0))
+ virCgroupSetupBlkioDeviceReadIops(cgroup, dev->path,
+ &dev->riops) < 0)
return -1;
if (dev->wiops &&
- (virCgroupSetBlkioDeviceWriteIops(priv->cgroup, dev->path,
- dev->wiops) < 0 ||
- virCgroupGetBlkioDeviceWriteIops(priv->cgroup, dev->path,
- &dev->wiops) < 0))
+ virCgroupSetupBlkioDeviceWriteIops(cgroup, dev->path,
+ &dev->wiops) < 0)
return -1;
if (dev->rbps &&
- (virCgroupSetBlkioDeviceReadBps(priv->cgroup, dev->path,
- dev->rbps) < 0 ||
- virCgroupGetBlkioDeviceReadBps(priv->cgroup, dev->path,
- &dev->rbps) < 0))
+ virCgroupSetupBlkioDeviceReadBps(cgroup, dev->path,
+ &dev->rbps) < 0)
return -1;
if (dev->wbps &&
- (virCgroupSetBlkioDeviceWriteBps(priv->cgroup, dev->path,
- dev->wbps) < 0 ||
- virCgroupGetBlkioDeviceWriteBps(priv->cgroup, dev->path,
- &dev->wbps) < 0))
+ virCgroupSetupBlkioDeviceWriteBps(cgroup, dev->path,
+ &dev->wbps) < 0)
return -1;
}
}
STREQ(param->field, VIR_DOMAIN_BLKIO_DEVICE_WRITE_IOPS) ||
STREQ(param->field, VIR_DOMAIN_BLKIO_DEVICE_READ_BPS) ||
STREQ(param->field, VIR_DOMAIN_BLKIO_DEVICE_WRITE_BPS)) {
+ virCgroupPtr cgroup = priv->cgroup;
size_t ndevices;
virBlkioDevicePtr devices = NULL;
size_t j;
if (STREQ(param->field, VIR_DOMAIN_BLKIO_DEVICE_WEIGHT)) {
for (j = 0; j < ndevices; j++) {
- if (virCgroupSetBlkioDeviceWeight(priv->cgroup,
- devices[j].path,
- devices[j].weight) < 0 ||
- virCgroupGetBlkioDeviceWeight(priv->cgroup,
- devices[j].path,
- &devices[j].weight) < 0) {
+ if (virCgroupSetupBlkioDeviceWeight(cgroup, devices[j].path,
+ &devices[j].weight) < 0) {
ret = -1;
break;
}
}
} else if (STREQ(param->field, VIR_DOMAIN_BLKIO_DEVICE_READ_IOPS)) {
for (j = 0; j < ndevices; j++) {
- if (virCgroupSetBlkioDeviceReadIops(priv->cgroup,
- devices[j].path,
- devices[j].riops) < 0 ||
- virCgroupGetBlkioDeviceReadIops(priv->cgroup,
- devices[j].path,
- &devices[j].riops) < 0) {
+ if (virCgroupSetupBlkioDeviceReadIops(cgroup, devices[j].path,
+ &devices[j].riops) < 0) {
ret = -1;
break;
}
}
} else if (STREQ(param->field, VIR_DOMAIN_BLKIO_DEVICE_WRITE_IOPS)) {
for (j = 0; j < ndevices; j++) {
- if (virCgroupSetBlkioDeviceWriteIops(priv->cgroup,
- devices[j].path,
- devices[j].wiops) < 0 ||
- virCgroupGetBlkioDeviceWriteIops(priv->cgroup,
- devices[j].path,
- &devices[j].wiops) < 0) {
+ if (virCgroupSetupBlkioDeviceWriteIops(cgroup, devices[j].path,
+ &devices[j].wiops) < 0) {
ret = -1;
break;
}
}
} else if (STREQ(param->field, VIR_DOMAIN_BLKIO_DEVICE_READ_BPS)) {
for (j = 0; j < ndevices; j++) {
- if (virCgroupSetBlkioDeviceReadBps(priv->cgroup,
- devices[j].path,
- devices[j].rbps) < 0 ||
- virCgroupGetBlkioDeviceReadBps(priv->cgroup,
- devices[j].path,
- &devices[j].rbps) < 0) {
+ if (virCgroupSetupBlkioDeviceReadBps(cgroup, devices[j].path,
+ &devices[j].rbps) < 0) {
ret = -1;
break;
}
}
} else if (STREQ(param->field, VIR_DOMAIN_BLKIO_DEVICE_WRITE_BPS)) {
for (j = 0; j < ndevices; j++) {
- if (virCgroupSetBlkioDeviceWriteBps(priv->cgroup,
- devices[j].path,
- devices[j].wbps) < 0 ||
- virCgroupGetBlkioDeviceWriteBps(priv->cgroup,
- devices[j].path,
- &devices[j].wbps) < 0) {
+ if (virCgroupSetupBlkioDeviceWriteBps(cgroup, devices[j].path,
+ &devices[j].wbps) < 0) {
ret = -1;
break;
}