Tag Info

Hot answers tagged

13

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'/> ...


11

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


10

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 ...


7

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 ...


7

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

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 ...


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

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 ...


5

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 ...


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 ...


4

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 ...


4

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."


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

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 ...


4

run virsh dumpxml name_of_vm > name_of_vm.xml 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


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

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

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

When you delete a file that has an open file descriptor, it's not actually deleted until the file descriptor is closed. You can probably find that file using lsof | grep deleted command. Try this if you want to undelete the file: http://www.serverwatch.com/tutorials/article.php/3822816/Recovering-Deleted-Files-With-lsof.htm


4

This is very simple to do. Normally, you would use bridging on the host, the bridge acting as a virtual switch for the VMs and the physical NICs to plug into: network -> Host NIC -> BRIDGE <- VM With VLANs this gets a bit more complicated: network (trunk port) -> Host NIC -> Tagged IF -> BRIDGE <- VM All of this is managed in ifcfg scripts on a ...


4

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 ...


3

You can use a virtual tablet instead of the virtual mouse, and then you won't have to press Ctrl_L & Alt_L. The virtual tablet also improves the mouse tracking by using absolute coordinates instead of relative motion deltas. To use the virtual tablet, first shutdown your vm. Using virt-manager, select the virtual machine, then select View -> Details, ...


3

You have to go to QEMU Monitor and run: change vnc display,options Where display is <host>:<display_number> or unix:<path> or none. Options are options for display. See: http://wiki.qemu.org/download/qemu-doc.html#sec_005finvocation E.g. To change the port to 5905 and accept VNC connections for any host: change vnc :5 If you are ...


3

libvirt only provides the autostart function. If this is important for you, I would set up an init script that starts VMs in a certain order. The algorithm would be virsh start VM1; wait for service to come up (check with ping/snmp/telnet to relevant ports); virsh start VM2 and so on


3

libvirt provides the possibility to use hooks for specific system management: At present, there are three hook scripts that can be called: /etc/libvirt/hooks/daemon Executed when the libvirt daemon is started, stopped, or reloads its configuration /etc/libvirt/hooks/qemu Executed when a QEMU guest is started, stopped, or migrated ...


3

You can use ebtables for this assuming you are assigning a mac to every VM on the host node. http://ebtables.sourceforge.net/ This in simple terms locks it down by mac address and will only allow the VM's to use IP's specifically assigned to them.


3

Try these: Archipel Karesansui oVirt Archipel's look-and-feel looks the best among the others (imho). As Archipel and oVirt both use libvirt as a backend their features are supposed to be pretty much equal; it's the UI layout that differs mostly. Though I haven't checked them both so it is merely a guess.


3

Figured this out in the end. The trick is to ignore all the KVM networking nonsense. Create a bridge with brctl and then tell the KVM guest to use that as a bridge device. <interface type='bridge'> <mac address='00:a0:01:00:00:03'/> <source bridge='virbr0'/> <model type='e1000'/> </interface> And it works..


3

The only way to add command-line switches that libvirt doesn't support yet is to create a wrapper script and change your VM's configuration to use it instead. For example, # cat >/usr/local/bin/qemu-snapshot <<'END' #!/bin/sh exec /usr/bin/qemu "$@" -snapshot END # chmod +x /usr/local/bin/qemu-snapshot # virsh -c qemu:///system edit my_vm change ...



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