Skip to content

Instantly share code, notes, and snippets.

@frimik
Last active December 7, 2016 06:59
Show Gist options
  • Save frimik/4730558 to your computer and use it in GitHub Desktop.
Save frimik/4730558 to your computer and use it in GitHub Desktop.
Foreman + Libvirt

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.

@frimik
Copy link
Author

frimik commented May 14, 2013

keymap issue is unresolved... and totally annoying.

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