summaryrefslogtreecommitdiffstats
path: root/src/os-plugins/plugins/xen/XX_xen.sh
blob: 7dddeee0a5f2327a4ef6092ecd3f2cee9dbd7892 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# Copyright (c) 2010 - RZ Uni Freiburg
# Copyright (c) 2010 - OpenSLX GmbH
#
# This program/file is free software distributed under the GPL version 2.
# See http://openslx.org/COPYING
#
# If you have any feedback please consult http://openslx.org/feedback and
# send your feedback to feedback@openslx.org
#
# General information about OpenSLX can be found at http://openslx.org
#
# stage3 part of 'xen' plugin - the runlevel script
#
# script is included from init via the "." load function - thus it has all
# variables and functions available

# include default directories
. /etc/openslx.conf

CONFFILE=/initramfs/plugin-conf/xen.conf
PLUGINCONFDIR=/mnt/${OPENSLX_DEFAULT_CONFDIR}/plugins/xen
PLUGINDIR=/mnt/${OPENSLX_DEFAULT_DIR}/plugin-repo/xen
VIRTDIR=/mnt/${OPENSLX_DEFAULT_VIRTDIR}/xen

# check if the configuration file is available
if [ -e ${CONFFILE} ]; then

  # load needed variables
  . ${CONFFILE}

  # Test if this plugin is activated... more or less useless with the
  # new plugin system
  if [ $xen_active -ne 0 2>/dev/null ]; then

    [ $DEBUGLEVEL -gt 0 ] && echo "executing the 'xen' os-plugin ...";

    # load general configuration
    . /etc/initramfs-setup

      # get source of xen image server (get type, server and path)
    if strinstr "/" "${xen_imagesrc}" ; then
      vbimgprot=$(uri_token ${xen_imagesrc} prot)
      vbimgserv=$(uri_token ${xen_imagesrc} server)
      vbimgpath="$(uri_token ${xen_imagesrc} path)"
    fi
    if [ -n "${vbimgserv}" ] ; then
      # directory where qemu images are expected in
      mnttarget=${VIRTDIR}
      # mount the xen image source readonly (ro)
      fsmount ${vbimgprot} ${vbimgserv} ${vbimgpath} ${mnttarget} ro
    else
      [ $DEBUGLEVEL -gt 1 ] && \
        error "  * Incomplete information in variable ${xen_imagesrc}." \
        nonfatal
    fi

    # copy virtualization include files to config dir
    testmkd ${PLUGINCONFDIR}
    testmkd /mnt/var/log/xen
    testmkd /mnt/var/run/xend
    testmkd /mnt/var/run/xenstored
    cp ${PLUGINDIR}/*.include ${PLUGINCONFDIR}
    # copy ${CONFFILE} to ${PLUGINCONFDIR} just in case
    cp ${CONFFILE} ${PLUGINCONFDIR}

    # activate init files
    # TODO: in xen-slx start
    # increase loop devices for loop images
    modprobe -q loop max_loop=64 >/tmp/xen.log 2>&1
    rllinker "xendomains" 14 8
    rllinker "xend" 13 9
  fi
fi