On 11/29/2011 10:14 AM, Daniel P. Berrange wrote:
>
> Does more than the function name says. Would it be better to just do the
> parsing here, and set the cgroup values after parsing(see my comment to
> patch 3 for filtering out 0-weight when writing to xml):
>
Yes, IMHO it is better to do the setting of values, after parsing
is fully complete.
Okay, the series is now pushed with this last round of improvements
included. However, I'm still working on a 5/4. Consider:
# virsh blkiotune dom --device-weights /dev/sda,502,/dev/sdb,498
# virsh blkiotune dom --device-weights /dev/sda,503
# virsh blkiotune dom
weight : 500
device_weight : /dev/sda,503
# cat /cgroup/blkio/libvirt/qemu/dom/blkio.weight_device
8:0 503
8:16 498
Oops - /dev/sdb wasn't cleared, even though our new query no longer
reports it.
Calling virsh blkiotune dome --device-weights should either clear all
existing weights before writing in just the specified weights of the new
string. Or it should only affect the weights of paths specified in the
new string, while preserving all pre-existing weights for all other paths.
I'm leaning towards the latter (that is, you _have_ to pass an explicit
0 to set in order to remove /dev/sdb from the XML and from get, and that
mentioning just /dev/sda on set leaves /dev/sdb's setting alone).
Besides, that's how cgroups does it - write an explicit 0 to remove a
device from the cgroup file; all other writes modify a device if it is
already listed, otherwise they add a new line to the file.
--
Eric Blake eblake(a)redhat.com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org