OpenNebula – Using SPICE for VM graphics

OpenNebula 4’s Sunstone GUI comes with NoVNC so you can open VNC connections against your VM if you configure the graphics section. NoVNC is awesome and offers secure websocket connections. However, I sometimes have problems with VNC’s mouse pointer position (it’s not a problem with OpenNebula or NoVNC just a qemu/vnc issue) and the trick about using tablet usb pointer shown in this discussion solves it.

If you want a different way to connect to your KVM guests you can try SPICE. If you’re curious about using SPICE in CentOS/RHEL please read Timothy Lee’s howto which is a great guide and helped me to understand how to use remote-viewer and what packages should I need.

Ok hands on. In the OpenNebula VM template I just set:

  • GRAPHICS=[KEYMAP=”es”,TYPE=”SPICE”,LISTEN=”0.0.0.0″]

If you wish to specify a port in the graphics section you have the explanation In OpenNebula’s documentation. If no port is specified OpenNebula will use the VNC_BASE_PORT variable set in /etc/one/oned.conf ( 5900 ) + your VM’s id e.g my VM has ID 7 so the SPICE/VNC port will be 5907.

A Spice server connection opened by qemu-kvm will be listening in any address (0.0.0.0) but in order to connect from a remote host I need an iptables rule e.g:

  • iptables -I INPUT -m tcp -p tcp –dport 5907 -m state –state=NEW,ESTABLISHED,RELATED -j ACCEPT
  • service iptables save

From my Fedora desktop I have to install virt-viewer and spice-client:

  • yum install virt-viewer spice-client

And finally I open a spice connection with remote-viewer:

  • remote-viewer spice://haddock.macto.local:5907 &

A new window is shown. Enjoy!

Advertisements

OpenNebula 4 Beta – running a virtual machine

Today we’re going to run a virtual machine using the KVM hypervisor and an openvswitch based virtual network. I’ve recorded a screencast so you can follow the steps easily. I’m going to configure a virtual network using openvswitch and I’ll test connectivity pinging my router 192.168.1.1.

Before the screencast a few comments:

  • I’m going to add a rule in iptables allowing traffic for VNC connection using the following commands:
iptables -I INPUT -p tcp --dport 29876 -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
service iptables save
  • I’m using the ttylinux image from the OpenNebula market as it is small. I’m skipping the “Create image” step so image downloading time doesn’t affect the screencast.
  • The virtual machine template will run with 512 MB of RAM and it’ll use 50% of a CPU (maximum).
  • A virtual network called net0 is created with a fixed range (192.168.1.21,192.168.1.22,192.168.1.23) though just one IP address would be needed.
  • ttylinux image is ready for contextualization so an IP address from the net0 pool will be automatically assigned after adding a NIC to the template. My openvswitch bridge is named br0.

And finally here is the video: