Tag Info

Hot answers tagged

15

First of all, you should avoid using virsh attach-disk with its limited amount of options. Instead, I suggest to specify the exact disk format you prefer in a separate, temporary XML file, like this: <disk type='file' device='disk'> <driver name='qemu' type='qcow2' cache='writeback'/> <source file='/home/gert/kvm/testdomain-vdb.img'/> ...


12

The latest stable release for libvirt for Ubuntu is version 0.7.5, which doesn't have some newer features (i.e. script hooks and network filters) which make automatic network configuration easier. That said, here's how to enable port forwarding for libvirt 0.7.5 on Ubuntu 10.04 Lucid Lynx. These iptables rules should do the trick: iptables -t nat -I ...


12

virsh dumpxml myvm > foo.xml <edit foo.xml, change the name, move storage> virsh undefine myvm virsh define foo.xml Source: https://www.redhat.com/archives/libvirt-users/2010-October/msg00072.html


9

Use virsh define somefile.xml and virsh start domain-name, doing this the VM will be persistent. I can't check right now, but I think you can use virsh define on an already started VM and this will make it persistent.


9

Red Hat is making a huge containerization push. They're building an entire new product, Red Hat Enterprise Linux Atomic Host, around it. For a less radical approach, take a look at their RHEL7 beta Resource Management and Linux Containers Guide; you'll notice it pushes libvirt-lxc and makes no mention of the lxc tools.


8

Here is a better way to set up port forwarding, using a hook script (source). In /etc/libvirt/hooks/qemu: #!/bin/sh GUEST_NAME= HOST_PORT= GUEST_IPADDR= GUEST_PORT= if [ "$1" = "$GUEST_NAME" ]; then if [ "$2" = start ]; then iptables -t nat -A PREROUTING -p tcp --dport "$HOST_PORT" \ -j DNAT --to "$GUEST_IPADDR:$GUEST_PORT" iptables ...


8

The optimal configuration is (usually) as follows: On the host, set elevator=deadline Use virtio and only virtio use raw LVs whenever possible. Qcow2 gives overhead. Files on a FS also have overhead in the VM use the elevator=noop both in host and VM, use noatime,nodiratime in fstab wherever possible Make sure the virtio drivers are up to date, especially ...


7

run virsh dumpxml name_of_vm > name_of_vm.xml Undefine the old vm to prevent an error because of an duplicate UUID. virsh undefine name-of-vm Edit the xml file then import it. virsh define name_of_vm.xml Of course you will have to stop and start the vm for the changes to take effect virsh destroy name_of_vm virsh start name_of_vm


7

I would recommend powering everything down when you power cycle the array. That way you are completely sure that everything is flushed correctly. The additional outage time sucks, but when it comes to downing the storage array I don't screw around with shortcuts.


7

Deleting a file does not actually delete the file, it reduces the number of names pointing to an inode. If both the number of names and the number of open file descriptors to the file reach 0, the data gets deleted. So if you delete a file that's still open by some application, that application can still happily use that file. Only when the last file ...


7

What's the conventional wisdom regarding LXC and RHEL-like systems today? Personally, I find the current setup somewhat lacking. LXC seems more at the forefront -- certainly more maintained. How are you implementing them? In terms of offering it as a virtualization option I am not. I find the current technological setup lacking. No username ...


6

This issue was caused by the way libvirt uses apparmor. The default behavior is to provide some protection for the host against the guest by restricting which files the virtualization process on the host is allowed to access. libvirt knows that the virtualization process (kvm in this case) needs the disk image in order to operate properly, so it creates an ...


6

I figured out a way of setting up port redirection on the fly when the guest is using user-mode networking, and blogged about it here: http://blog.adamspiers.org/2012/01/23/port-redirection-from-kvm-host-to-guest/ You can see the details there, but for convenience, here is the solution I figured out: virsh qemu-monitor-command --hmp sles11 'hostfwd_add ...


6

Looking at the output of "help": virsh # help autostart NAME autostart - autostart a domain SYNOPSIS autostart <domain> [--disable] DESCRIPTION Configure a domain to be automatically started at boot. OPTIONS [--domain] <string> domain name, id or uuid --disable disable autostarting This requires that you ...


6

I recommend using libvirt for managing your KVM virtual machines. It makes the whole thing much easier than with just plain QEMU/KVM and provides also nice CPU, IO and network statistics. You will like tools such as virt-top and virt-manager which work on top of the libvirt framework. To collect the virtual machine interface statistics from a script, you ...


6

According to the manual of virsh this is: virsh destroy _domain-id_ virsh undefine _domain-id_ virsh vol-delete --pool vg0 _domain-id_.img And it further says: "Undefine (destroy) the configuration for an inactive domain. Since the domain is not running the domain name or UUID must be used as the domain-id."


6

Check out the 'USB passthrough | Using Libvirt' section of this page from the Edubuntu wiki. More info here and here. If you don't ever plan to hot plug/unplug the usb drive while the guest is running you could also try adding a section like <disk type='block' device='disk'> <driver name='qemu' type='raw'/> <source ...


6

Your domain may be shut down. Run virsh list --all to see all domains.


6

Kids, don't try this at home: Libvirt should have rejected the creation of a domain with a space in its name, so someone did something strange to create the domain to begin with. To recover from this is going to require some hand-editing of files you aren't normally supposed to touch manually. So this is what I would do: Stop libvirtd (your VMs will ...


5

Why not simply set the guest to use br0? Instead of configuring it with a "network", you can configure it with a "bridge" and attach the VM to br0. example: <interface type='bridge'> <source bridge='br0'/> <mac address='00:16:3e:1a:b3:4a'/> </interface> This way the guest will get an IP from the external net and can contact the ...


5

Ugh... this is so NOT the suggested way of doing things, but what should work would be: turn on IP forwarding in host assign real IP to host assign real IP to a loopback interface on guest assign IPs on a private subnet between host and guest setup NAT on host to DNAT incoming connections to the private IP of the guest setup NAT on host to SNAT outgoing ...


5

If libvirt doesn't reload VM settings on start/stop, virsh edit command may help. And please write entire XML file and libvirt version Hmm... everything seems OK. Try adding <boot dev='hd'/> <boot dev='cdrom'/> <bootmenu enable='yes'/> to <os> section and look if cdrom appears in boot menu. Also try removing all <boot> records ...


5

I will give very rough idea/explanation. In OP situation, besides measuring within the VM, the host should be look at too. In this case, we can assume the following are correct In all the test, the host I/O(disk) bandwidth is not max out. As VM("monitoring") I/O increases with more CPUs allocated to it. If host I/O was already max out, there should be no ...


4

As reported in libvirtd official site there is basically two open source web interface for administering and manage libvirtd+KVM : AbiCloud oVirt There is also other alternatives for administering and managing KVM through web interface, you can find a list at this address . Maybe the best choice is RED HAT Enterprise Virtualization.


4

Cloud.com Cloudstack runs on Ubuntu 10.04. Obviously Eucalyptus too. I know you don't want cloud features, but you can just ignore them if you want. Perfectly viable as plain hypervisor management, so long as you have an external management box. As you've noticed, other tools like Karesansui and oVirt are packaged only for RHEL/Centos Convirture is ...


4

To change many machines you can use this: virsh shutdown old-name Wait for above to finish and run: virsh dumpxml old-name > old-name.xml virsh undefine old-name Wait for above to finish and run: sed -i 's/<name>old-name<\/name>/<name>new-name<\/name>/g' old-name.xml virsh define old-name.xml Run this one-by-one for each ...


4

I ran into this one a time ago. But there seem to be no way to setup the bridge on an alias interface, like eth0:1. Use the real interface eth0. auto eth0 iface eth0 inet static auto br0 iface br0 inet static bridge_ports eth0 address 192.168.0.10 netmask 255.255.255.0 gateway 192.168.0.1 broadcast 192.168.0.255 bridge_stp off ...


4

If you get the response: virsh autostart domainname "cannot set autostart for transient domain" then virsh shutdown domainname virsh define xmlfile virsh start domainname virsh autostart domainname In my experience on Ubuntu 12.04, this only happens if a virsh undefine has been run. Domains created with virsh create usually ...


4

Having an open file descriptor and having a directory entry are different, somewhat related things. As long as KVM has the qcow2 files open they still exist on the disk in the same blocks they did before. On Linux you can recover the files from /proc/[pid]/fd/[file descriptor] using the method described in this SuperUser question.


4

Use virtio for disks and network. for the mountpoint where you keep the images and the isos, use the noatime and nodiratime options use the deadline scheduler on the host use spice/qxl for video for proper video performance



Only top voted, non community-wiki answers of a minimum length are eligible