Skip to content

Instantly share code, notes, and snippets.

@drucko
Forked from frimik/gist:4730558
Created July 29, 2014 17:24
Show Gist options
  • Save drucko/d514d5c39fabf0b18834 to your computer and use it in GitHub Desktop.
Save drucko/d514d5c39fabf0b18834 to your computer and use it in GitHub Desktop.

TheForeman + Libvirt notes

Foreman+KVM on the same physical host

Set up a bridge

  • virsh iface-bridge eth0 br0
  • If you had NM_CONTROLLED=no in there, re-add it to both ifcfg files because virsh probably just removed it for you.
  • Turn off STP by adding STP=off to the ifcfg-br0 file.

Configure libvirt

  • /etc/libvirt/qemu.conf:
vnc_listen = "0.0.0.0"
  • /etc/libvirt/
TODO: Add info for remote access

Iptables

  • /etc/sysconfig/iptables:
-A INPUT -p tcp -m state --state NEW -m tcp --dport 5900:5950 -j ACCEPT

ws_proxy.rb

Creating storage pool

RHEL Virtualization Administration Guide

libvirt.org/Storage.html

  • Create /tmp/kvmpool.xml
<pool type="fs">
<name>kvmpool</name>
<source>
<device path="/dev/vg_ruby/kvmpool"/>
</source>
<target>
<path>/var/lib/libvirt/images</path>
</target>
</pool>
lvcreate -A y -L 500G -n kvmpool vg_ruby
virsh pool-define /tmp/kvmpool.xml
virsh pool-autostart kvmpool
virsh pool-start kvmpool

Localhost libvirt access requires socket permissions:

  • vim /etc/polkit-1/localauthority/50-local.d/50-se.tmtowtdi-libvirt-local-access.pkla:
[Allow foreman libvirt management permissions]
Identity=unix-user:foreman
Action=org.libvirt.unix.manage
ResultAny=yes
ResultInactive=yes
ResultActive=yes

Other options include ssh

Adding Compute Resource to Foreman

  • Localhost: qemu+unix:///system?socket=/var/run/libvirt/libvirt-sock
  • Remote: qemu+tcp://<hostname>/system or qemu+ssh://...

novnc

Firefox-specific novnc configuration

If you're using Firefox and your Foreman is using SSL you have to enable network.websocket.allowInsecureFromHTTPS. theforeman.org

Keymap issues

An example issue I hit when using swedish keyboard on the client computer is that I cannot type the '/' character. Will try adding keymap to the guest XML config later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment