mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-24 06:35:24 +00:00
LXC: blkio: allow to setup weight_device
libivrt lxc can only set generic weight for container, This patch allows user to setup per device blkio weigh for container. Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
This commit is contained in:
parent
e7b3349f5a
commit
350fd95f40
@ -123,21 +123,35 @@ cleanup:
|
|||||||
static int virLXCCgroupSetupBlkioTune(virDomainDefPtr def,
|
static int virLXCCgroupSetupBlkioTune(virDomainDefPtr def,
|
||||||
virCgroupPtr cgroup)
|
virCgroupPtr cgroup)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
int i, rc;
|
||||||
|
|
||||||
if (def->blkio.weight) {
|
if (def->blkio.weight) {
|
||||||
int rc = virCgroupSetBlkioWeight(cgroup, def->blkio.weight);
|
rc = virCgroupSetBlkioWeight(cgroup, def->blkio.weight);
|
||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
virReportSystemError(-rc,
|
virReportSystemError(-rc,
|
||||||
_("Unable to set Blkio weight for domain %s"),
|
_("Unable to set Blkio weight for domain %s"),
|
||||||
def->name);
|
def->name);
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = 0;
|
if (def->blkio.ndevices) {
|
||||||
cleanup:
|
for (i = 0; i < def->blkio.ndevices; i++) {
|
||||||
return ret;
|
virBlkioDeviceWeightPtr dw = &def->blkio.devices[i];
|
||||||
|
if (!dw->weight)
|
||||||
|
continue;
|
||||||
|
rc = virCgroupSetBlkioDeviceWeight(cgroup, dw->path, dw->weight);
|
||||||
|
if (rc != 0) {
|
||||||
|
virReportSystemError(-rc,
|
||||||
|
_("Unable to set io device weight "
|
||||||
|
"for domain %s"),
|
||||||
|
def->name);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user