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

Re: [Libguestfs] Assigning qemu process to cgroups



Do I understand correctly, that libguestfs use qemu to work with drives?
If I will try to use it, I think it solves my disk io problem.

On 18 January 2011 02:18, Richard W.M. Jones <rjones redhat com> wrote:
>
> I had a go at writing a patch, but I think it's possible already
> without any patch.
>
> After launch you can get the PID of the qemu subprocess:
>  guestfs_get_pid (g);
>  --> returns PID
>
> You can use Linux to map this to a list of thread IDs:
>  ls /proc/$PID/task/
>  --> returns a list of thread IDs
>
> [Yes, this is potentially racy, but in reality qemu has already
> started up fully after guestfs_launch returns and is almost quiescent
> when you're not issuing commands.]
>
> Then you can assign the threads to the cgroup:
>
>  for tid in $(ls -1 /proc/$PID/task); do
>    echo $tid > /cgroup/blkio/$group/tasks
>  done
>
> This is more cumbersome if you're using guestfish instead of some
> scripting language, and it's difficult if you want to port to
> non-Linux, but should work in the common case AFAICS.  I've not tried
> it though ...
>
> Rich.
>
> --
> Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
> libguestfs lets you edit virtual machines.  Supports shell scripting,
> bindings from many languages.  http://et.redhat.com/~rjones/libguestfs/
> See what it can do: http://et.redhat.com/~rjones/libguestfs/recipes.html
>



-- 
Nikita A Menkovich
JID: menkovich gmail com
Tel: +7 (921) 423-96-48


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