Kevins Thoughts
2011-Aug-30 02:09 UTC
[libvirt-users] New with Libvirt and having problems.
Hi all. I've been playing around with KVM for a bit now and have several virtual machines up and running. Having passed what I considered "first look" stage, I'm ready to start using libvirt as a manager. For reference, pre-libvirt, I have started this VM with: /kvm -net nic,model=virtio -net tap,ifname=tap5,script=no -drive file=test1.img,if=virtio,boot=on -curses -no-reboot -m 1g -smp 2/ I have a test environment I like to play with, and created the initial domain XML using virt-install: /virt-install --name "Test" --ram 1024 --vcpus=2 --cpu host --description "Test VM" --import --file test1.img --os-type=linux --os-variant=virtio26 --network bridge=br0,model=virtio --graphics=none --autostart --prompt/ When I look in /var/log/libvirt/qemu/Test.log I see the VM is started with the command (edited down to the relevant parts): //usr/bin/qemu-kvm -S -m 1024 -smp 2 -name Test,process=qemu:Test -nographics -boot c -drive file=/kvms/test1.img,if=none,boot=on /This has two problems: 1) The "-S" is keeping the system from booting 2) the "if=none" needs to be "if=virtio" I've confirmed both by changing -nographics to -curses and watching what happens. For #1, its a big fat nothing (no surprise since -S turns off the CPUs), for #2 grub loads and the kernel boots, but my /dev/vda3 isn't found so "init" can't start. I'm anticipating a 3rd problem: I don't see where to specify that I want the VM to use "tap5" of my bridged network. Can some kind soul please let me know what I need to change in the domain XML file to fix these issues? Thanks, Kevin ps. I've post this to my blog at http://www.kevinsthoughts.com/2011/08/kvm-management-libvirt/ if anyone would prefer to answer there. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20110829/187b30f8/attachment.htm>
Kevins Thoughts
2011-Aug-30 05:01 UTC
[libvirt-users] New with Libvirt and having problems.
> > Ah I never gave KVM or virtualization a try in Gentoo. None of my > servers have X though using X11 forwarding still works. In CentOS the > package is xorg-x11-xauth , looks like it may be x11-apps/xauth in > Gentoo.No X anywhere in my environment <smile>. Somehow I normally manage!> > Does "virsh iface-list" show tap5?Actually that command errors out: /virsh # iface-list error: Failed to list active interfaces error: this function is not supported by the connection driver: virConnectNumOfInterfaces/> > For the disk, this is what I have for my virtio disks... > > <disk type='file' device='disk'> > <driver name='qemu' type='qcow2'/> > <source file='/vmstore/images/domain0001.qcow2'/> > *<target dev='vdb' bus='virtio'/>* > <address type='pci' domain='0x0000' bus='0x00' slot='0x06' > function='0x0'/> > </disk>My XML had the type wrong, setting it to raw. Alas, I still see the invoked KVM being passed: /-drive file=/kvms/test1.img,if=none,id=drive-virtio-disk0,boot=on,format=qcow2 / The "if=none" is the problem, it needs to be "if=virtio". KVM is also still being passed the "-S" flag as its first parameter, so the CPUs are not starting.> > Also maybe add something like this to your virt-install line... > > "--disk path=test1.img,device=disk,bus=virtio"At this point, I'm just editing the XML, its easier. Once I get one working, I can tweak for the others. Virt-install at least got me started. Kevin -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20110830/af0898a3/attachment.htm>
On 08/29/2011 08:09 PM, Kevins Thoughts wrote:> > When I look in /var/log/libvirt/qemu/Test.log I see the VM is started > with the command (edited down to the relevant parts): > > //usr/bin/qemu-kvm -S -m 1024 -smp 2 -name Test,process=qemu:Test > -nographics -boot c -drive file=/kvms/test1.img,if=none,boot=on > > /This has two problems: > > 1) The "-S" is keeping the system from bootingThis is intentional. Libvirt has to make some changes via the monitor, since qemu does not expose all functionality from the command line, so libvirt blindly starts qemu with -S, makes subsequent monitor changes, and then released the vcpus via monitor command (unless you used the VIR_DOMAIN_START_PAUSED flag to keep things paused). There is no XML to control this, nor does there need to be, given the existence of virDomainCreateWithFlags().> 2) the "if=none" needs to be "if=virtio"Have you tried 'virsh domxml-from-native qemu-argv /path/to/args' for a shell-style command line containing the qemu command you want to run? It's not perfect, but may give you some hints on this regard. Meanwhile, according to the documentation, <target dev=... bus='virtio'/> inside your <drive> xml appears to be the right way to request a virtio drive. Paste the actual XML you are trying to use, so we can offer suggestions relative to your questions.> > I've confirmed both by changing -nographics to -curses and watching what > happens. For #1, its a big fat nothing (no surprise since -S turns off > the CPUs), for #2 grub loads and the kernel boots, but my /dev/vda3 > isn't found so "init" can't start. > > I'm anticipating a 3rd problem: I don't see where to specify that I > want the VM to use "tap5" of my bridged network.Does the documentation help? http://libvirt.org/formatdomain.html#elementsNICS -- Eric Blake eblake at redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org