User:Pavlix/Virtualization

From Gentoo Wiki
Jump to:navigation Jump to:search
CODE
euse -E spice
euse -p app-emulation/qemu -E usbredir
euse -p app-emulation/libvirt -E virt-network qemu

LVM

The following snippet lets you do the simple thing of reusing your volume group called vg as a storage pool for virtualization guests.

CODE
virsh pool-destroy default
virsh pool-undefine default
virsh pool-define-as default logical --target /dev/vg --source-name vg
virsh pool-autostart default
virsh pool-start default

Networking

The following snippt lets you reuse your already configured bridge as the default network for virtualization tools.

CODE
net-destroy default
net-undefine default
echo '<network><name>default</name><forward mode="bridge"/><bridge name="br0"/></network>' | virsh net-define /dev/stdin
virsh net-autostart default
virsh net-start default

Qemu

It looks like the default ownership/permissions for libvirt/qemu paths won't work when using virt-install to install a Fedora guest.

CODE
chown -R qemu:kvm /var/lib/libvirt/qemu

This is how it looked like without...

CODE
# virt-install --name fedora21 --memory 1024 --disk pool=vg,size=8 --location http://redhat.download.fedoraproject.org/pub/fedora/linux/releases/21/Server/x86_64/os/                      
WARNING  No 'console' seen in --extra-args, a 'console=ttyS0' kernel argument is likely required to see text install output from the guest.
Starting install...
Retrieving file vmlinuz...                                                                                                                                                      |  11 MB     00:02 ... 
Retrieving file initrd.img...                                                                                                                                                   |  83 MB     00:17 ... 
Allocating 'fedora21-2'                                                                                                                                                         | 8.0 GB     00:00     
ERROR    internal error: process exited while connecting to monitor: 2015-03-10T13:39:34.297547Z qemu-system-x86_64: -chardev socket,id=charchannel0,path=/var/lib/libvirt/qemu/channel/target/fedora21.org.qemu.guest_agent.0,server,nowait: Failed to bind socket: Permission denied
2015-03-10T13:39:34.297572Z qemu-system-x86_64: -chardev socket,id=charchannel0,path=/var/lib/libvirt/qemu/channel/target/fedora21.org.qemu.guest_agent.0,server,nowait: chardev: opening backend "socket" failed
Domain installation does not appear to have been successful.
If it was, you can restart your domain by running:
  virsh --connect qemu:///system start fedora21
otherwise, please restart your installation.

Install guest OS using virt-install

Install Fedora 22 Alpha:

root #virt-install --name fedora22a --memory 1024 --graphics spice --disk pool=vg,size=8 --location http://redhat.download.fedoraproject.org/pub/fedora/linux/releases/test/22_Alpha/Server/x86_64/os/