Re: [PATCH 7/8] qemu: allow to setup throttle blkio cgroup through virsh

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Dec 11, 2013 at 04:29:52PM +0800, Gao feng wrote:
> With this patch, user can setup throttle blkio cgroup
> through virsh for qemu domain.
> 
> Signed-off-by: Guan Qiang <hzguanqiang@xxxxxxxxxxxxxxxx>
> Signed-off-by: Gao feng <gaofeng@xxxxxxxxxxxxxx>
> ---
>  src/qemu/qemu_driver.c | 425 ++++++++++++++++++++++++++++++++++++++++++++-----
>  1 file changed, 386 insertions(+), 39 deletions(-)


> -                for (j = 0; j < ndevices; j++) {
> -                    if (virCgroupSetBlkioDeviceWeight(priv->cgroup,
> -                                                      devices[j].path,
> -                                                      devices[j].weight) < 0) {
> -                        ret = -1;
> -                        break;
> +
> +                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) {
> +                            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) {
> +                            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) {
> +                            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) {
> +                            ret = -1;
> +                            break;
> +                        }
> +                    }
> +                } else {

You should check for WRITE_BPS here, and have a final 'else' clause reporting an
error on unknown strings I think

> +                    for (j = 0; j < ndevices; j++) {
> +                        if (virCgroupSetBlkioDeviceWriteBps(priv->cgroup,
> +                                                            devices[j].path,
> +                                                            devices[j].wbps) < 0) {
> +                            ret = -1;
> +                            break;
> +                        }
>                      }
>                  }

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




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]