* KVM management and API
@ 2007-04-27 21:29 jd
[not found] ` <798858.14143.qm-sSuf+AbrE5qvuULXzWHTWIglqE1Y4D90QQ4Iyu8u01E@public.gmane.org>
0 siblings, 1 reply; 6+ messages in thread
From: jd @ 2007-04-27 21:29 UTC (permalink / raw)
To: kvm-devel
[-- Attachment #1.1: Type: text/plain, Size: 2657 bytes --]
Hi
This is a great project with a lots and lots of potential. I have a bunch of questions related to managing kvm VMs.
I would like to know what kind of options are available for doing effective management ot KVM/QEMU processes (VMs). And know more abut plans / roadmap /directions to get to a proper API. (similar to Xen-API)
1. Discovery : How does one find all processes running KVM vms ?
ps -ef | grep qemu ?
How does one know if qemu is using the kvm or not ?
2. Identity : I am assuming that each VM is a process and pid would be an identifier, is there any other more unique identifier available.
3. Managing running processs :
a. How does one connect to the manage the running vms ?
I have read about screen and socat options.
Both of these act as tty client, where success/failure and errors for a given command are very vague (parsing..). (A way to get return code for the operation would be great). Parsing ... command response and interpreting... is error prone.
Say I choose socat, how do I gracefully detach from the console. ( other than just killing socat)
b. How does one get the stats for the running VM ?
1. status : running, stopped, *migrating*..?
2. Current use of the memory : example allocated 1 GB, used 512 MB.
3. CPU : Effective cpu used ? Are vcpus supported ?
/proc can be used... what about windows ? (when and if we have kvm on windows)
4. How much I/O and Network I/O
5. Wait times to get to I/O or CPU. (contention measures)
6. What is kvm_stats ? How to interpret its output?
c. Can one change memory, cpus, disks and networks on the fly for a running VM ? If so how ?
This is critical for achiving dynamic resource management.
4. Shutdown : How does one send command to VM to shutdown normally. I see only reset and powerdown commands only. Also, after shutdown, the image running in the machine shuts down, but the VM keeps running. Shouldnt the process also die ?
5. Snapshots : where are snapshots saved ? I tried savevm with /tmp/x, I was expecting a file containing memory image... do these work differrently ?
Also, when one does loadvm, is the snapshot gone ? I mean can one restore the same snapshot multiple times ?
(I have played little in this area.. so may be I missed something.)
There are lot of questions... but I guess, answers to these questions would help a wider audiance.
Thanks
/Jd
---------------------------------
Ahhh...imagining that irresistible "new car" smell?
Check outnew cars at Yahoo! Autos.
[-- Attachment #1.2: Type: text/html, Size: 3423 bytes --]
[-- Attachment #2: Type: text/plain, Size: 286 bytes --]
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
[-- Attachment #3: Type: text/plain, Size: 186 bytes --]
_______________________________________________
kvm-devel mailing list
kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/kvm-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: KVM management and API
[not found] ` <798858.14143.qm-sSuf+AbrE5qvuULXzWHTWIglqE1Y4D90QQ4Iyu8u01E@public.gmane.org>
@ 2007-04-27 22:06 ` Daniel P. Berrange
[not found] ` <20070427220657.GB8384-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2007-05-01 7:31 ` Dor Laor
0 siblings, 2 replies; 6+ messages in thread
From: Daniel P. Berrange @ 2007-04-27 22:06 UTC (permalink / raw)
To: jd; +Cc: kvm-devel
On Fri, Apr 27, 2007 at 02:29:52PM -0700, jd wrote:
> Hi
> This is a great project with a lots and lots of potential. I have a
> bunch of questions related to managing kvm VMs.
>
> I would like to know what kind of options are available for doing
> effective management ot KVM/QEMU processes (VMs). And know more abut
> plans / roadmap /directions to get to a proper API. (similar to Xen-API)
We are supporting QEMU / KVM management in libvirt since version 0.3.0
aiming to have feature parity for our management APIs between Xen, QEMU
and KVM. This gives a C, Python & Perl API. A command line tool virsh.
And a couple of higher level tools virt-install & virt-manager. I'll
illustrate possible answers to your questions in terms of virsh...
> 1. Discovery : How does one find all processes running KVM vms ?
> ps -ef | grep qemu ?
libvirt doesn't expose the PIDs to app developers, but you can get a
list using
# export VIRSH_DEFAULT_CONNECT_URI=qemu:///system
# virsh list --all
Id Name State
----------------------------------
1 QEMUGuest1 running
- wizz shut off
> How does one know if qemu is using the kvm or not ?
# virsh dumpxml QEMUGuest1 | grep domain
<domain type='qemu' id='1'>
The 'type' attribute will be one of qemu, kqemu, kvm
> 2. Identity : I am assuming that each VM is a process and pid would
> be an identifier, is there any other more unique identifier available.
libvirt provides 3 identifiers with different levels of uniqueness
1. 'id' - integer uniquely identifying amongst active guests on a host
2. 'name' - string uniquely identifying amongst active & inactive guests on a host
3. 'uuid' - hex string uniquely identifying globally
> 3. Managing running processs :
> a. How does one connect to the manage the running vms ?
> I have read about screen and socat options.
> Both of these act as tty client, where success/failure and errors for a given
> command are very vague (parsing..). (A way to get return code for the operation
> would be great). Parsing ... command response and interpreting... is error prone.
> Say I choose socat, how do I gracefully detach from the console. ( other than
> just killing socat)
virsh provides a set of commands for controlling lifecycle & configuration
of the guest from the host machine, eg shutdown, start, pause, resume, suspend,
restore, dominfo, dumpxml, etc, etc
The graphical console is typically exposed with VNC / SDL. You can find the
VNC port with:
# virsh vncdisplay QEMUGuest1
:0
If you configured a serial port & setup the guest to start a getty on it
you can also connect via the 'serial console'
# virsh console QEMUGuest1
> b. How does one get the stats for the running VM ?
> 1. status : running, stopped, *migrating*..?
> 2. Current use of the memory : example allocated 1 GB, used 512 MB.
> 3. CPU : Effective cpu used ? Are vcpus supported ?
> /proc can be used... what about windows ? (when and if we have kvm on windows)
> 4. How much I/O and Network I/O
> 5. Wait times to get to I/O or CPU. (contention measures)
Can do the first 3 options
# virsh dominfo QEMUGuest1
Id: 1
Name: QEMUGuest1
UUID: c7a5fdbd-edaf-9455-926a-d65c16db1809
OS Type: hvm
State: running
CPU(s): 1
CPU time: 98.8s
Max memory: 219200 kB
Used memory: 219200 kB
We don't currently have APIs to show disk & network I/O stats. We also don't
yet provide migration support.
> 6. What is kvm_stats ? How to interpret its output?
No idea :-)
> c. Can one change memory, cpus, disks and networks on the fly for a running VM ? If so how ?
> This is critical for achiving dynamic resource management.
Not AFAIK. To be precise, libvirt provides APIs for that, but it requires better
guest support / paravirt device drivers. Also QEMU can do hot-add/remove of USB
devices.
> 4. Shutdown : How does one send command to VM to shutdown normally. I see only reset
> and powerdown commands only. Also, after shutdown, the image running in the machine
> shuts down, but the VM keeps running. Shouldnt the process also die ?
A controlled shutdown isn't provided by QEMU/KVM yet. One would need to simulate
some kind of ACPI power management support in the guest so it saw a virtual
software power button press i guess.
> 5. Snapshots : where are snapshots saved ? I tried savevm with /tmp/x, I was expecting a
> file containing memory image... do these work differrently ?
> Also, when one does loadvm, is the snapshot gone ? I mean can one restore the same
> snapshot multiple times ?
libvirt has APIs for snapshotting, but we've not implement them for QEMU
or KVM yet. You can save the file to any location you have write permissions
for. Its not a plain memory image because it also contains info about the
state of all the various virtual devices.
The snapshot doesn't deal with changes in state on your disks. So if you restored
a snapshot, ran it for a while doing disk IO and then quit & tried to restore the
snapshot again your disks would be out of sync.
That said if one could take snapshots of the disks (eg with LVM, or QCOW) then
it ought to be possible to use a snapshot multiple times over.
Dan.
--
|=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=|
|=- Perl modules: http://search.cpan.org/~danberr/ -=|
|=- Projects: http://freshmeat.net/~danielpb/ -=|
|=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: KVM management and API
[not found] ` <20070427220657.GB8384-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2007-04-27 22:23 ` Anthony Liguori
[not found] ` <463277E3.5070305-rdkfGonbjUSkNkDKm+mE6A@public.gmane.org>
0 siblings, 1 reply; 6+ messages in thread
From: Anthony Liguori @ 2007-04-27 22:23 UTC (permalink / raw)
To: Daniel P. Berrange; +Cc: kvm-devel
Daniel P. Berrange wrote:
>> 5. Snapshots : where are snapshots saved ? I tried savevm with /tmp/x, I was expecting a
>> file containing memory image... do these work differrently ?
>> Also, when one does loadvm, is the snapshot gone ? I mean can one restore the same
>> snapshot multiple times ?
>>
>
> libvirt has APIs for snapshotting, but we've not implement them for QEMU
> or KVM yet. You can save the file to any location you have write permissions
> for. Its not a plain memory image because it also contains info about the
> state of all the various virtual devices.
>
> The snapshot doesn't deal with changes in state on your disks. So if you restored
> a snapshot, ran it for a while doing disk IO and then quit & tried to restore the
> snapshot again your disks would be out of sync.
>
> That said if one could take snapshots of the disks (eg with LVM, or QCOW) then
> it ought to be possible to use a snapshot multiple times over.
>
With QEMU 0.9.0 (and by extension, KVM), snapshots are actually stored
as part of the disk image with qcow2. This allows you to have a
consistent snapshot that includes CPU state and disk state.
Regards,
Anthony Liguori
> Dan.
>
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: KVM management and API
[not found] ` <463277E3.5070305-rdkfGonbjUSkNkDKm+mE6A@public.gmane.org>
@ 2007-04-29 8:03 ` Avi Kivity
[not found] ` <4634515B.6020301-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
0 siblings, 1 reply; 6+ messages in thread
From: Avi Kivity @ 2007-04-29 8:03 UTC (permalink / raw)
To: Anthony Liguori; +Cc: kvm-devel
Anthony Liguori wrote:
> With QEMU 0.9.0 (and by extension, KVM), snapshots are actually stored
> as part of the disk image with qcow2. This allows you to have a
> consistent snapshot that includes CPU state and disk state.
>
How does that work when you have two qcow2 images attached to a guest?
--
error compiling committee.c: too many arguments to function
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: KVM management and API
[not found] ` <4634515B.6020301-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
@ 2007-04-29 15:46 ` Anthony Liguori
0 siblings, 0 replies; 6+ messages in thread
From: Anthony Liguori @ 2007-04-29 15:46 UTC (permalink / raw)
To: Avi Kivity; +Cc: kvm-devel
Avi Kivity wrote:
> Anthony Liguori wrote:
>> With QEMU 0.9.0 (and by extension, KVM), snapshots are actually
>> stored as part of the disk image with qcow2. This allows you to have
>> a consistent snapshot that includes CPU state and disk state.
>>
>
> How does that work when you have two qcow2 images attached to a guest?
The first disk that supports snapshots is used to store the CPU state.
All disks that can be snapshotted are snapshotted with the same tag.
Regards,
Anthony Liguori
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: KVM management and API
2007-04-27 22:06 ` Daniel P. Berrange
[not found] ` <20070427220657.GB8384-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2007-05-01 7:31 ` Dor Laor
1 sibling, 0 replies; 6+ messages in thread
From: Dor Laor @ 2007-05-01 7:31 UTC (permalink / raw)
To: jd, Daniel P. Berrange,
kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
[-- Attachment #1.1: Type: text/plain, Size: 2597 bytes --]
I'll try to answer the open questions.
Btw, libvirt is a great project and a very good option for managing kvm.
In the future use plain text for the list messages.
________________________________
From: jd [mailto:jdsw2002-/E1597aS9LQAvxtiuMwx3w@public.gmane.org]
Sent: Saturday, April 28, 2007 8:12 AM
To: Daniel P. Berrange
Subject: Re: [kvm-devel] KVM management and API
Thanks Daniel. But I was looking for bit of under the hood answers.
For cpu /proc seems to be used.. which seems fine, but will not work for
QEMU on Windows.
KVM is not supported in Windows host anyway.
Some core qemu quesions still remains
-- what are the plans to dynamically be able to change cpu , mem, disks
and n/w for a running vm ?
When we'll support SMP you could add vcpus dynamically. The same for
hotplug memory slots.
Regarding disks, you can post it in qemu's list.
-- proper shutdown/restart of VM ?
Currently powerdown/restart are supported.
Hoping some kvm/qemu experts would thrown in some light on the
directions and plans.
Thanks in advance.
/Jd
"Daniel P. Berrange" <berrange-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote:
On Fri, Apr 27, 2007 at 02:29:52PM -0700, jd wrote:
> Hi
> This is a great project with a lots and lots of potential. I have a
> bunch of questions related to managing kvm VMs.
> 4. How much I/O and Network I/O
You can get it from the tap interface.
> 5. Wait times to get to I/O or CPU. (contention measures)
Can be retrieved from /proc/pid/stat
> 6. What is kvm_stats ? How to interpret its output?
It is used for kvm development proposes, in general it counts the number
of vm exit events of
each type.
> c. Can one change memory, cpus, disks and networks on the fly for a
running VM ? If so how ?
> This is critical for achiving dynamic resource management.
Not AFAIK. To be precise, libvirt provides APIs for that, but it
requires better
guest support / paravirt device drivers. Also QEMU can do hot-add/remove
of USB
devices.
> 4. Shutdown : How does one send command to VM to shutdown normally. I
see only reset
> and powerdown commands only. Also, after shutdown, the image running
in the machine
> shuts down, but the VM keeps running. Shouldnt the process also die ?
If you're running with ACPI guest it should stop [works for me].
For non-acpi, you can install APM module and it also make the guest stop
and the process die [also works for me].
Try using the latest kvm.
[-- Attachment #1.2: Type: text/html, Size: 9589 bytes --]
[-- Attachment #2: Type: text/plain, Size: 286 bytes --]
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
[-- Attachment #3: Type: text/plain, Size: 186 bytes --]
_______________________________________________
kvm-devel mailing list
kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/kvm-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-05-01 7:31 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-27 21:29 KVM management and API jd
[not found] ` <798858.14143.qm-sSuf+AbrE5qvuULXzWHTWIglqE1Y4D90QQ4Iyu8u01E@public.gmane.org>
2007-04-27 22:06 ` Daniel P. Berrange
[not found] ` <20070427220657.GB8384-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2007-04-27 22:23 ` Anthony Liguori
[not found] ` <463277E3.5070305-rdkfGonbjUSkNkDKm+mE6A@public.gmane.org>
2007-04-29 8:03 ` Avi Kivity
[not found] ` <4634515B.6020301-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-04-29 15:46 ` Anthony Liguori
2007-05-01 7:31 ` Dor Laor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox