XEN

Mit Installation des Xen-Kernels wird auch Xen installiert. Mit rcxend wird dann Xen gestartet. Allerdings kommt auf Rechnern mit mehreren Netzwerkkarten wenig Freude auf, da z.B. die Netzwerk Devices nicht vernünftig definiert werden. Die mit der openSuse11.0 mitgelieferten Netzwerk-Skripte sind für den Servereinsatz in unserem Umfeld nicht ausreichend.Unter der URL http://thepenguinpriest.com/linux/scripts/network-multinet.html kann man die Version 2 der Skripte herunterladen und installieren. Auf dieser Seite gibt es auch eine gute Einführung in die Problematik. Damit diese Netzwerk-Skripte auch unter openSuse11.0 funktionieren, müssen allerdings noch einige zusätzliche Skripte und Libraries installiert, sowie kleinere Änderungen an den Skripten vorgenommen werden.

In dem tar Archiv xenneu.tar sind alle Änderungen mit Ausnahme der /etc/sysconfig/xend zusammengefasst. Mit dem Befehl tar -xvPf xenneu.tar können diese Änderungen in ein aktuelles System übernommen werden. Nach Anpassen der /etc/sysconfig/xend solte das System dann funktionieren.

Die Änderungen im Einzelnen

/sbin/getcfg installieren (alte Suse 9.3?)

/lib64/libgetconfig* installieren (aus Suse10.2)

Die /etc/sysconfig/xend könnte so aussehen:

## Type: list()
## Default: ""
## Config:
#
# Space delimited list of network types, physical/virtual network
# devices,mac addresses and IP addresses to create bridges on using
# the following format:
#
# <network type>,<number of network type>,<network device>,<mac address>,<IP address/CIDR NetMask>,<dhcp server status>
#
# Where:
# <network type> = bridge|nat|route|hostonly|nohost|empty
# <number of network type> = The network number (0,1,2,etc.) of that type of
# network (i.e. xennat0, xenbr1, xenhost3, etc.)
# <network device> = The network interface the bridge will be
# attached to (i.e. eth0, veth2, etc.)
# If set to 'default' the interface used for the
# default gateway will be used
# <mac address> = The MAC address to assign to <network device>
# <IP address/CIDR Netmask> = The IP address and Subnet Mask to assign to
# <network device> format= 1.2.3.4/24
# <dhcp server status> = dhcp-on|dhcp-off (DHCP server on/off on that net)
#
# Network Definition Examples:
# bridged "bridge,0,default,,,dhcp-off"
# "bridge,1,eth1,,,dhcp-off"
# nat "nat,0,veth2,00:16:3E:01:00:03,172.23.0.1/16,dhcp-off"
# routed "route,0,veth2,00:16:3E:01:00:03,172.23.0.1/16,dhcp-off"
# hostonly "hostonly,0,veth3,00:16:3E:01:00:03,172.23.0.1/16,dhcp-off"
# nohost "nohost,0,eth1,,,dhcp-off"
# empty "empty,0,,,dhcp-off"
#
# Example: "bridge,0,eth0,,,dhcp-off nat,0,veth2,00:16:3E:01:00:03,172.23.0.1/16,dhcp-off hostonly,0,veth3,00:16:3E:01:00:03,172.23.0.1/16,dhcp-off empty,0,,,dhcp-off"
#
# The above example would create 4 networks the first being a bridged network
# (xenbr0), the second being a NATed network (xennat0), the third being a host
# only network (xenhost0) and the fourth being an empty network (xenempty0)
#
# Used by network-multinet v2.x only
#
#NETWORK_LIST="bridge,0,default,,,dhcp-off nat,0,veth2,00:16:3E:01:00:02,172.22.0.1/16,dhcp-off hostonly,0,veth3,00:16:3E:01:00:03,172.23.0.1/16,dhcp-off empty,0,,,dhcp-off"
NETWORK_LIST="bridge,0,eth0,,,dhcp-off bridge,1,eth1,,,dhcp-off"

## Type: string(eth0,eth1,eth2,eth3)
## Default: "eth0"
## Config:
#
# Network interface to use as the external interface for NATed
# and Routed networks
#
# If set to 'default" it will use the same interface used for the
# default route
#
NAT_EXTERNAL_INTERFACE=""

## Path: System/Virtualization
## Description:
## Type: string(xenbr)
## Default: "xenbr"
## Config:
#
# Name of bridge to create (xenbr0, xenbr1, etc.)
#
# Used by network-multinet v1.x only
#
BRIDGE_NAME="xenbr"

## Type: list()
## Default: "eth0"
## Config:
#
# Space delimited list of physical network
# devices to create traditional bridges on
#
# Used by network-multinet v1.x only
#
# Example: "eth0 eth1 eth2"
#
# The above example would create 3 traditional bridges
# xenbr0 on eth0, xenbr1 on eth1 and xenbr2 on eth2
#
BRIDGE_NETDEV_LIST=""

## Type: list()
## Default: ""
## Config:
#
# Space delimited list of virtual network devices,mac addresses
# and IP addresses to create local bridges on using the following format:
#
# <virtual network device>,<mac address>,<IP address/CIDR NetMask>,<nat|hostonly|route>,<dhcp-on|dhcp-off>
#
# Example: "veth2,00:16:3E:01:00:02,172.22.0.1/16,nat,dhcp-on veth3,00:16:3E:01:00:03,172.23.0.1/16,hostonly,dhcp-off"
#
# The above example would create 2 local bridged the first being a NATed network
# and the second being a host only network
#
# Used by network-multinet v1.x only
#
#LOCAL_BRIDGE_LIST="veth2,00:16:3E:01:00:02,172.22.0.1/16,nat,dhcp-off veth3,00:16:3E:01:00:03,172.23.0.1/16,hostonly,dhcp-off"
LOCAL_BRIDGE_LIST=""

## Type: list()
## Default: ""
## Config:
#
# Space delimited list of bridge numbers/NICs to
# create "no-host" bridges on.
#
# No-Host bridges are bridges that are connected to a
# physical interface but not to an interface in Domain0.
# VMs connected to them are bridged to the outside world
# but cannot communicate with Domain0
#
# Example: "eth1,4"
#
# The above example would create a single NO-Host bridge named xenbr4
# that would have the eth1 interface connected to it as a bridge port
#
# Used by network-multinet v1.x only
#
NOHOST_BRIDGE_LIST=""

## Type: string(eth
## Type: list()
## Default: ""
## Config:
#
# Space delimited list of bridge numbers to
# create empty bridges on.
#
# Example: "4 5"
#
# The above example would create two empty bridges named xenbr4 and xenbr5
#
# Used by network-multinet v1.x only
#
EMPTY_BRIDGE_LIST=""

## Type: string(128-249)
## Default: "128-249"
## Config:
#
# IP address range for the dhcp server. These should be the
# beginning and ending addresses from the last octet of the
# IP address
#
XEN_DHCP_RANGE="128-249"

## Type: string(10.0.0.1,10.0.0.2)
## Default: "gateway"
## Config:
#
# IP address(es) of DNS servers for the dhcp server to give out.
# If set to "gateway" then the IP address of the gateway will be
# set as the DNS server.
#
# Examples: "10.0.0.1,10.0.0.2"
# "gateway"
#
#
XEN_DHCP_DNS_SERVERS="131.220.xxx.xxx"

## Type: boolean
## Default: "false"
## Config:
#
# If set to true the xend-relocation script will enable/disable
# the vm migration feature of xend..
#
ENABLE_RELOCATION="true"

## Type: list()
## Default: "any"
## Config:
#
# Space delimited list of IP addresses/host names of machines
# that xen will accept vm migrations from. If set to 'any'
# xen will accept vm migrations from any host
#
# Example: "10.0.0.1 10.0.0.2" would allow relocation to/from thos IPs
# Example: "any" would allow reloaction to/from any host
#
RELOCATION_NODELIST="xxx.xxx.xxx.*"

## Type: boolean
## Default: "false"
## Config:
#
# If set to true the xend-relocation script will attempt to
# enable/disable vm migration on all relocation nodes listed
# in the RELOCATION_LIST variable.
#
# Note: Communication with the nodes is done via ssh so
# pre-distributed ssh keys is recommended.
#
MANAGE_ALL_RELOCATION_NODES="true"

## Type: integer
## Default: "8002"
## Config:
#
# The TCP port used by Xen for VM relocation
#
XEN_RELOCATION_PORT="8002"

In der Datei /etc/xen/xend-config.sxp muß die Zeile (network-script network-bridge) durch (network-script network-multinet) ersetzt werden, damit multinet2 aktiviert ist.

Virtuelle Block Devices

Weiterhin gibt es Fehler in den Skripten /etc/xen/scripts/block-* Das benutzte Programm readlink gibt einen Fehler zurück, wenn die Zieldatei direkt und nicht über einen Link erreicht wird. Dann bricht das Skript ab. Daher müssen z.B. die folgenden kleineren Veränderungen bei allen readlink Aufrufen vorgenommen werden. Die von uns genutzten Skripte finden sich hier.

find_sdev()
{
    unset dev
    for session in /sys/class/iscsi_session/session*; do
        if [ "$1" = "`cat $session/targetname`" ]; then
            dev=`readlink $session/device/target*/*:0:*/block* || true`
                if [ "$dev" = "" ]; then
                dev=`/bin/ls $session/device/target*/*:0:*/block*`
                fi;

            dev=${dev##*/}
            return
        fi
    done
}

Das Skript block-iscsi sucht das Programm iscsiadm fälschlicherweise in dem Verzeichnis /usr/sbin. Damit das Skript block-iscsi funktioniert, muß ein Softlink von /usr/sbin/iscsiadm nach /sbin/iscsiadm definiert werden.