Radagast

From Cnwiki

Jump to: navigation, search

Radagast is a virtualisation server, providing virtual machines for research and student projects. The server was purchased in September 2014 and has been named after Radagast the Brown, the character of the Lord of the Rings.

This page contains static information, i.e. guides and hardware documentation. For more dynamic content, i.e. currently deployed virtual machines and their network address allocations, please see Ressource assignment and deployed VMs on Radagast.

Contents

Hardware Characteristics

The server has the following characteristics:

• DELL PowerEdge R420

• Processor: 2xIntel(R) Xeon(R) CPU E5-2407 v2 @ 2.40GHz

• RAM: 8x4GB DDR3 DIMM, 1600MHz

• Storage: 2x 1,2TB HDD, hardware RAID1

• Network Adapter: 2x 1GB Ethernet

The server has three years of basic warranty provided by DELL, running from ~August 2014.

User information/guides

Provisioning of new virtual machines

Please contact rhj@eng.au.dk for approval of provisioning a new virtual machines, specifying: brief reason, #CPUs, RAM size, HDD size, network(NAT/bridged, public IP) and OS.

Remote access

SSH Key Setup instructions (User)

Administrator information/guides

This information is intended for those administrating the server.

Open issues

none

Procedures

Creating a new virtual machine

Follow this list, see below for details:

  1. Create folder in `/var/lib/libvirt/images/`
  2. Copy `buildcommand.sh` script or create new (Change MAC/IP and hostname)
  3. Run build command
  4. run `virsh autostart <hostname` to start VM when host boots
  5. run `virsh start <hostname` to start VM


In order to keep track of all the virtual machines they are all kept in a subfolder of /var/lib/libvirt/images/. The subfolders are to be named <name-for-vm>.<initials-of-requestor>.

~$ sudo su
# sudo mkdir /var/lib/libvirt/images/vm-name.requestor-initials
# cd /var/lib/libvirt/images/vm-name.requestor-initials

Building ubuntu images with vmbuilder

Construct a command according to the manual. See vmbuilder kvm ubuntu -h. Be aware of bug #1037607 when building 12.10 or newer (https://bugs.launchpad.net/ubuntu/+source/vm-builder/+bug/1037607). Put the the command in a shell script named build-command.sh for later reference. See vmbuilder examples or earlier build-command.sh scripts for inspiration.

Building any other images

This is left as an exercise ;) virtinst provided by libvirt might be a good guess.

Configuration and installation

The server has been setup with Ubuntu Server 14.04.1 LTS server.

Storage

The hard disks are running with RAID1(mirror) using the hardware controller.

They are partitioned as follows:

kidmose@radagast:~$ lsblk 
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0   1,1T  0 disk             2 hdds in HW RAID1
├─sda1   8:1    0  39,2M  0 part             Already present, left unchanged in case it serves some purpose, e.g. iDRAC. 
├─sda2   8:2    0     2G  0 part             -"-
├─sda3   8:3    0     1K  0 part             -"-
├─sda5   8:5    0  93,1G  0 part /           OS installation, including homes
├─sda6   8:6    0  29,8G  0 part [SWAP]      SWAP size equal to amount of memory
└─sda7   8:7    0 992,3G  0 part /var        Misc, including virtual machines

Network

See Overview and network address assignment for IP addresses and host names.

iDRAC for the physical server is configured on the primary network interface with MAC address C8:1F:66:CC:E0:ED. The MAC is registered with IT for the IP 10.29.1.27 and domainname radagast-idrac.netlab.eng.au.dk . For security reasons it is only available from AU network. https://radagast-idrac.netlab.eng.au.dk/.

Layer 2

Radagast is connected through Ethernet port J12.

Layer 3

NIC for guest domains

Guest domains have a dummy NIC observable from the host, named vnet*. Note that they appear with a "wrong" MAC address, which differs from what is configured and seen on the machine, on the wire and in virsh.

NAT for guest domains

When installing libvirtd a virtual bridge, used as the default network for all domains, is created with the name virbr0. By default DHCP is provided and NATed Internet access through the primary NIC(em1) is available to the guest domains. (See http://www.redhat.com/archives/libvir-list/2012-June/msg01330.html for an explanation)

Bridge for guest domains

For the guest to appear as connected directly to the remaining network infrastructure in the lab/building network bridging can be employed.

With vmbuilder the parameter --bridge br0 configures the domain for bridged access.

Configuring bridge

To set up the br0 do the following:

~$ sudo ifdown em1
~$ sudo cp /etc/network/interfaces /etc/network/interfaces.factory-defaults
~$ sudo chmod a-w /etc/network/interfaces
~$ editor /etc/network/interfaces

Change the contents /etc/network/interfaces to:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# # The primary network interface
# auto em1
# iface em1 inet dhcp

# Bridged network interface
auto br0
iface br0 inet dhcp
      bridge_ports em1
      bridge_stp off

and bring up the new bridge:

~$ sudo ifup br0
Bridge setup example

With the above configuration, two domains connected through a network bridge and one through NAT we can observe the following:

(em1: primary physical NIC, vnet1 and vnet2: virtual NIC bridged with em1, vnet2: virtual NIC with Internet access through NAT and em1)

~$ brctl show
bridge name	bridge id		STP enabled	interfaces
br0		8000.c81f66cce0eb	no		em1 
							vnet0
							vnet1
virbr0		8000.fe5400e87cf1	yes		vnet2

Software

Beyond ubuntu 14.04.1 LTS the following collection of software packages is used to provide the virtualisation services and easy management.

OpenSSH server

This provides secure, remote terminal access. The SSH server is only used for management.

Password login is disabled to enforce key-based authentication.

QEMU and KVM

QEMU and KVM is the hypervisor through which the virtual machines access the physical resources. It supports both full virtualisation and paravirtualisation.

Full virtualisation enables execution of any guest OS, as it emulates the hardware fully, enabling unmodified OSs to run, but at a price in performance. Paravirtualisation requires modifications to the OS which might not be possible(Windows?, OS X?), to allow better performance than full virtualisation.

libvirtd

Libvirtd is a daemon controlling the hypervisor, and serves as a common interface for managing different hypervisors with a common set of tools.

virsh

A shell for managing libvirtd domains, which is the term for virtual machine instances. Used for starting and stopping domains and for changing virtual machine hardware.

virsh examples

Virsh can be started and used as an interactive shell:

~$ virsh 
Welcome to virsh, the virtualization interactive terminal.

Type:  'help' for help with commands
       'quit' to quit

virsh # 

or passed a command to execute and exit:

~$ virsh list
 Id    Name                           State
----------------------------------------------------
 14    test-vm                        running
 16    test-vm2                       running
~$

Quick reference:

  • list - list running domains
  • list --all - list all domains, including stopped ones
  • edit test-vm - shows the vm configuration XML
  • start test-vm - start the domain named test-vm
  • shutdown test-vm
  • suspend test-vm
  • resume test-vm
  • help

ubuntu-vm-builder

A command line script for automated building of ubuntu images.

BUG: There is a bug in vmbuilder, causing all builds of ubuntu since 12.10 to fail(stderr: grep: /proc/cpuinfo: No such file or directory This kernel does not support a non-PAE CPU). This is fixed by adding the following parameter: --addpkg linux-image-generic. See https://bugs.launchpad.net/ubuntu/+source/vm-builder/+bug/1037607 for more details.

ubuntu-vm-builder examples

The simplest example that will produce an image to run with the setup is:

~$ sudo vmbuilder kvm ubuntu --libvirt qemu:///system 

A more complete example is:

~$vmbuilder kvm ubuntu \
--hostname test-vm \
--user myusername \
--pass mypassword \
--libvirt qemu:///system \
--addpkg openssh-server \ # for access
--addpkg linux-image-generic \ # to fix bug #1037607
--flavour virtual \
--suite trusty \
--cpus 2 \
--mem 4096 \
--swapsize=4096 \
--rootsize 81920

Bridge utils

A tool for configuring and monitoring network bridges on the host.

Installation

OpenSSH server

Default setup with the change that password login is disabled. See OpenSSH server installation for details.

Installed version:

~$ apt-cache policy openssh-server | grep Installed
Installed: 1:6.6p1-2ubuntu2

Virtualisation components

Based on instructions available at https://help.ubuntu.com/community/KVM and https://help.ubuntu.com/community/KVM/Installation (Accessed September 3rd 2014).

To install all the components:

~$ sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils

To interact with libvirtd the user must be in the libvirtd group:

~$ sudo adduser <username> libvirtd

Mail

Mail has been configured as described in this guide: http://linuxconfig.org/configuring-gmail-as-sendmail-email-relay . Account: netlab.eng.au@gmail.com . Ticket for fixing issue connecting to google SMTP: 117358 (Completed) . Ticket for getting access to internal SMTP server: 116961 (Ongoing) .

Monitoring

Refer to Radagast Monitoring and Maintenance#Monitoring

Location

The server is placed in the server room inside the laboratory (Edison 331) mounted on the middle rack.

Personal tools