Skip to contentSkip to conversation

how to manage KVM guests with libvirt ?

DISCUSSION Riccardo Veraldi 3 participants 5 messages Jun 1, 2009 KVM

lore
Share & tools
lore
#0 lore raw

Hello,
I have always created my guests by hand with qemu-kvm syntax. Is there a way to control and manage KVM guests with libvirt without being forced to create the guest with virtmanager or with virtsh ?

what if I post a guest from XEN to KVM, how to manage it with libvirt ?

thanks

Rick

#1 lore raw
Quoted 4 lines · Riccardo Veraldi

Hello,
I have always created my guests by hand with qemu-kvm syntax. Is there a way to control and manage KVM guests with libvirt without being forced to create the guest with virtmanager or with virtsh ?

i'm doing this, after seeing the managment tools available with libvirt. the easiest way is to write an XML that describes what you already know how to do with command line. there are still a couple of missing options (most notably cache=none, and getting to the command console); but you should be able to get it to work.

virt-install is a nice hack for installing well-behaved linux distros; but for windows (where you have to pick exactly which features to expose at different steps of the install), it's easier to do on the command line and write the needed XML after that.

one tip, if you choose to allow libvirt to manage an LVM storage pool, it's better not to create/destroy LVs manually. use virsh for that or just don't tell libvirt about your LVM. i had a couple of host crashes when the libvirt view of the storage got inconsistent with reality.

Signature · 1 line
Javier
#2 lore raw

thank you very much.

How do I know all the XML tag options ??

how to convert from comand line quemu options into XML tags ?

and here to put XML file ?

about the console I used to start qemu-kvm under SCREEN program. is ther another better way to have serial console ?

thank you

Rick

Quoted 28 lines · Javier Guerra
Quoted 5 lines · Riccardo Veraldi

Hello,
I have always created my guests by hand with qemu-kvm syntax. Is there a way to control and manage KVM guests with libvirt without being forced to create the guest with virtmanager or with virtsh ?

i'm doing this, after seeing the managment tools available with libvirt. the easiest way is to write an XML that describes what you already know how to do with command line. there are still a couple of missing options (most notably cache=none, and getting to the command console); but you should be able to get it to work.

virt-install is a nice hack for installing well-behaved linux distros; but for windows (where you have to pick exactly which features to expose at different steps of the install), it's easier to do on the command line and write the needed XML after that.

one tip, if you choose to allow libvirt to manage an LVM storage pool, it's better not to create/destroy LVs manually. use virsh for that or just don't tell libvirt about your LVM. i had a couple of host crashes when the libvirt view of the storage got inconsistent with reality.

#3 lore raw
Quoted 7 lines · Riccardo Veraldi

thank you very much.

How do I know all the XML tag options ??

how to convert from comand line quemu options into XML tags ?

and here to put XML file ?

you'll have to play around a little with a test machine before you get the hang of it. the xml options are documented on the libvirt site. put them in /etc/libvirt/qemu/blahblahblah.xml, and the libvirtd daemon will pick them at startup.

Quoted 2 lines

about the console I used to start qemu-kvm under SCREEN program. is ther another better way to have serial console ?

for that i don't have any good answer. it seems libvirt ties the qemu monitor with a pipe to its own process, so you don't have manual control anymore.

i'd much prefer if it used a unix socket, so you could open it with socat or similar tools.

Signature · 1 line
Javier
#4 lore raw
Quoted 6 lines · Javier Guerra
Quoted 4 lines · Riccardo Veraldi

thank you very much.

How do I know all the XML tag options ??

Quoted 8 lines
Quoted 3 lines

how to convert from comand line quemu options into XML tags ?

and here to put XML file ?

you'll have to play around a little with a test machine before you get the hang of it. the xml options are documented on the libvirt site. put them in /etc/libvirt/qemu/blahblahblah.xml, and the libvirtd daemon will pick them at startup.

With libvirt 0.6.4, you can use the "virsh domxml-from-native" tool to convert from QEMU arguments to XML automatically:
http://libvirt.org/drvqemu.html#xmlimport

Quoted 9 lines
Quoted 2 lines

about the console I used to start qemu-kvm under SCREEN program. is ther another better way to have serial console ?

for that i don't have any good answer. it seems libvirt ties the qemu monitor with a pipe to its own process, so you don't have manual control anymore.

i'd much prefer if it used a unix socket, so you could open it with socat or similar tools.

If by "serial console" you mean an actual emulated serial port, use the <serial> tag in the XML for this. You can point it to a socket, actual device, TCP server, etc.
http://libvirt.org/formatdomain.html#elementsConsole

If you want access to the Qemu monitor console, Libvirt does not provide that directly (by design), but it does use Unix sockets to interact with the monitor, so you could in theory kill Libvirt and talk to Qemu directly through the monitor socket in /var/run/libvirt/qemu.

-jim