3

I'm using cgroups to cap disk IO that a VM does by using libvirt's support for cgroups.

So, I'm getting the major/minor number of the device from a 'ls -lL' on the drive where the '.img' file for the VM is located.

However, when I try to cap the IO, I get an error - root@Silver:/sys/fs/cgroup/blkio/sysdefault/libvirt/qemu/debian1# echo "8:6 1048576" > blkio.throttle.read_bps_device bash: echo: write error: No such device

Any idea what I'm doing wrong?

vineet
  • 31
  • 2

1 Answers1

1

It looks like you might be mixing sysctl syntax and filesystem syntax for these options. Check what the actual path is to the sysfs file you are wanting to write to (is it /sys/fs/cgroup/blkio/sysdefault/libvirt/qemu/debian1/blkio/throttle/read_bps_device?).

Falcon Momot
  • 24,975
  • 13
  • 61
  • 92
  • no, the path seems right. There are no subfolders in 'debian1'.. – vineet May 03 '12 at 01:22
  • Yeah, but is there a file `blkio.throttle.read_bps_device` in that folder? All the files in `/sys/` that can be there are already there; you cannot create them normally. Therefore it's likely that you have the wrong path. Alternatively, you need a kernel module you've not built, or you are doing it from the host when you should be doing it from the VM or visa versa. – Falcon Momot May 03 '12 at 04:18
  • yes, there is a `blkio.throttle.read_bps_device` and I am writing it correctly. In fact, there another CentOS machine at school where it works fine for me, but this does not work on my Kubuntu system. So i think I must be missing a configuration setting somewhere, dont know what.. – vineet May 03 '12 at 04:58
  • Try doing `stat` on that file. It's possible you may be missing a kernel module for it... – Falcon Momot May 03 '12 at 05:15
  • stat does not show any errors - `stat blkio.throttle.read_bps_device File: blkio.throttle.read_bps_device Size: 0 Blocks: 0 IO Block: 4096 regular empty file Device: 19h/25d Inode: 13206 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root) Access: 2012-05-03 09:55:23.762720263 -0400 Modify: 2012-05-03 09:55:23.762720263 -0400 Change: 2012-05-03 09:55:23.762720263 -0400 Birth: -` – vineet May 03 '12 at 13:57
  • It's the `Device: 19h/25d` part that is important. Getting errors when you tried to stat this type of file would be really weird. Usually the device is 0/0 for sysfs files, but yours may be different. Check that it is the same as on the working system. If it is, this is most likely a kernel bug. If it is not, check that you have an item in `mount` like this: `sysfs on /sys type sysfs (rw,nosuid,nodev,noexec)`. – Falcon Momot May 03 '12 at 16:18