The xen tools have been moved to the project of *os-xenapi* since
os-xenapi 0.3.0. We also did some refact work on these tools in
os-xenapi. This commit is to remove these tools from devstack. So
that os-xenapi will be the single place for xen tools.
Change-Id: I4fdbe6bce12dfedd0d1e975ab8dd624ee3740c11
| ... | ... |
@@ -1,173 +1,3 @@ |
| 1 |
-# Getting Started With XenServer and Devstack |
|
| 2 |
- |
|
| 3 |
-The purpose of the code in this directory it to help developers bootstrap a |
|
| 4 |
-XenServer 6.2 (older versions may also work) + OpenStack development |
|
| 5 |
-environment. This file gives some pointers on how to get started. |
|
| 6 |
- |
|
| 7 |
-Xenserver is a Type 1 hypervisor, so it is best installed on bare metal. The |
|
| 8 |
-OpenStack services are configured to run within a virtual machine (called OS |
|
| 9 |
-domU) on the XenServer host. The VM uses the XAPI toolstack to communicate with |
|
| 10 |
-the host over a network connection (see `MGT_BRIDGE_OR_NET_NAME`). |
|
| 11 |
- |
|
| 12 |
-The provided localrc helps to build a basic environment. |
|
| 13 |
- |
|
| 14 |
-## Introduction |
|
| 15 |
- |
|
| 16 |
-### Requirements |
|
| 17 |
- |
|
| 18 |
- - An internet-enabled network with a DHCP server on it |
|
| 19 |
- - XenServer box plugged in to the same network |
|
| 20 |
-This network will be used as the OpenStack management network. The VM Network |
|
| 21 |
-and the Public Network will not be connected to any physical interfaces, only |
|
| 22 |
-new virtual networks will be created by the `install_os_domU.sh` script. |
|
| 23 |
- |
|
| 24 |
-### Steps to follow |
|
| 25 |
- |
|
| 26 |
- - Install XenServer |
|
| 27 |
- - Download Devstack to XenServer |
|
| 28 |
- - Customise `localrc` |
|
| 29 |
- - Start `install_os_domU.sh` script |
|
| 30 |
- |
|
| 31 |
-### Brief explanation |
|
| 32 |
- |
|
| 33 |
-The `install_os_domU.sh` script will: |
|
| 34 |
- - Setup XenAPI plugins |
|
| 35 |
- - Create the named networks, if they don't exist |
|
| 36 |
- - Preseed-Netinstall an Ubuntu Virtual Machine (NOTE: you can save and reuse |
|
| 37 |
- it, see [Reuse the Ubuntu VM](#reuse-the-ubuntu-vm)), with 1 network |
|
| 38 |
- interface: |
|
| 39 |
- - `eth0` - Connected to `UBUNTU_INST_BRIDGE_OR_NET_NAME`, defaults to |
|
| 40 |
- `MGT_BRIDGE_OR_NET_NAME` |
|
| 41 |
- - After the Ubuntu install process finished, the network configuration is |
|
| 42 |
- modified to: |
|
| 43 |
- - `eth0` - Management interface, connected to `MGT_BRIDGE_OR_NET_NAME`. Xapi |
|
| 44 |
- must be accessible through this network. |
|
| 45 |
- - `eth1` - VM interface, connected to `VM_BRIDGE_OR_NET_NAME` |
|
| 46 |
- - `eth2` - Public interface, connected to `PUB_BRIDGE_OR_NET_NAME` |
|
| 47 |
- - Start devstack inside the created OpenStack VM |
|
| 48 |
- |
|
| 49 |
-## Step 1: Install Xenserver |
|
| 50 |
-Install XenServer on a clean box. You can download the latest XenServer for |
|
| 51 |
-free from: http://www.xenserver.org/ |
|
| 52 |
- |
|
| 53 |
-The XenServer IP configuration depends on your local network setup. If you are |
|
| 54 |
-using dhcp, make a reservation for XenServer, so its IP address won't change |
|
| 55 |
-over time. Make a note of the XenServer's IP address, as it has to be specified |
|
| 56 |
-in `localrc`. The other option is to manually specify the IP setup for the |
|
| 57 |
-XenServer box. Please make sure, that a gateway and a nameserver is configured, |
|
| 58 |
-as `install_os_domU.sh` will connect to github.com to get source-code snapshots. |
|
| 59 |
- |
|
| 60 |
-## Step 2: Download devstack |
|
| 61 |
-On your XenServer host, run the following commands as root: |
|
| 62 |
- |
|
| 63 |
- wget --no-check-certificate https://github.com/openstack-dev/devstack/zipball/master |
|
| 64 |
- unzip -o master -d ./devstack |
|
| 65 |
- cd devstack/*/ |
|
| 66 |
- |
|
| 67 |
-## Step 3: Configure your localrc inside the devstack directory |
|
| 68 |
-Devstack uses a localrc for user-specific configuration. Note that |
|
| 69 |
-the `XENAPI_PASSWORD` must be your dom0 root password. |
|
| 70 |
-Of course, use real passwords if this machine is exposed. |
|
| 71 |
- |
|
| 72 |
- cat > ./localrc <<EOF |
|
| 73 |
- # At the moment, we depend on github's snapshot function. |
|
| 74 |
- GIT_BASE="http://github.com" |
|
| 75 |
- |
|
| 76 |
- # Passwords |
|
| 77 |
- # NOTE: these need to be specified, otherwise devstack will try |
|
| 78 |
- # to prompt for these passwords, blocking the install process. |
|
| 79 |
- |
|
| 80 |
- DATABASE_PASSWORD=my_super_secret |
|
| 81 |
- ADMIN_PASSWORD=my_super_secret |
|
| 82 |
- SERVICE_PASSWORD=my_super_secret |
|
| 83 |
- RABBIT_PASSWORD=my_super_secret |
|
| 84 |
- SWIFT_HASH="66a3d6b56c1f479c8b4e70ab5c2000f5" |
|
| 85 |
- # This will be the password for the OpenStack VM (both stack and root users) |
|
| 86 |
- GUEST_PASSWORD=my_super_secret |
|
| 87 |
- |
|
| 88 |
- # XenAPI parameters |
|
| 89 |
- # NOTE: The following must be set to your XenServer root password! |
|
| 90 |
- |
|
| 91 |
- XENAPI_PASSWORD=my_xenserver_root_password |
|
| 92 |
- |
|
| 93 |
- XENAPI_CONNECTION_URL="http://address_of_your_xenserver" |
|
| 94 |
- VNCSERVER_PROXYCLIENT_ADDRESS=address_of_your_xenserver |
|
| 95 |
- |
|
| 96 |
- # Explicitly set virt driver |
|
| 97 |
- VIRT_DRIVER=xenserver |
|
| 98 |
- |
|
| 99 |
- # Explicitly enable multi-host for nova-network HA |
|
| 100 |
- MULTI_HOST=1 |
|
| 101 |
- |
|
| 102 |
- # Give extra time for boot |
|
| 103 |
- ACTIVE_TIMEOUT=45 |
|
| 104 |
- |
|
| 105 |
- EOF |
|
| 106 |
- |
|
| 107 |
-## Step 4: Run `./install_os_domU.sh` from the `tools/xen` directory |
|
| 108 |
- |
|
| 109 |
- cd tools/xen |
|
| 110 |
- ./install_os_domU.sh |
|
| 111 |
- |
|
| 112 |
-Once this script finishes executing, log into the VM (openstack domU) that it |
|
| 113 |
-installed and tail the run.sh.log file. You will need to wait until it run.sh |
|
| 114 |
-has finished executing. |
|
| 115 |
- |
|
| 116 |
-# Appendix |
|
| 117 |
- |
|
| 118 |
-This section contains useful information for running devstack in CI |
|
| 119 |
-environments / using ubuntu network mirrors. |
|
| 120 |
- |
|
| 121 |
-## Use a specific Ubuntu mirror for installation |
|
| 122 |
- |
|
| 123 |
-To speed up the Ubuntu installation, you can use a specific mirror. To specify |
|
| 124 |
-a mirror explicitly, include the following settings in your `localrc` file: |
|
| 125 |
- |
|
| 126 |
- UBUNTU_INST_HTTP_HOSTNAME="archive.ubuntu.com" |
|
| 127 |
- UBUNTU_INST_HTTP_DIRECTORY="/ubuntu" |
|
| 128 |
- |
|
| 129 |
-These variables set the `mirror/http/hostname` and `mirror/http/directory` |
|
| 130 |
-settings in the ubuntu preseed file. The minimal ubuntu VM will use the |
|
| 131 |
-specified parameters. |
|
| 132 |
- |
|
| 133 |
-## Use an http proxy to speed up Ubuntu installation |
|
| 134 |
- |
|
| 135 |
-To further speed up the Ubuntu VM and package installation, an internal http |
|
| 136 |
-proxy could be used. `squid-deb-proxy` has prooven to be stable. To use an http |
|
| 137 |
-proxy, specify: |
|
| 138 |
- |
|
| 139 |
- UBUNTU_INST_HTTP_PROXY="http://ubuntu-proxy.somedomain.com:8000" |
|
| 140 |
- |
|
| 141 |
-in your `localrc` file. |
|
| 142 |
- |
|
| 143 |
-## Reuse the Ubuntu VM |
|
| 144 |
- |
|
| 145 |
-Performing a minimal ubuntu installation could take a lot of time, depending on |
|
| 146 |
-your mirror/network speed. If you run `install_os_domU.sh` script on a clean |
|
| 147 |
-hypervisor, you can speed up the installation, by re-using the ubuntu vm from |
|
| 148 |
-a previous installation. |
|
| 149 |
- |
|
| 150 |
-### Export the Ubuntu VM to an XVA |
|
| 151 |
- |
|
| 152 |
-Given you have an nfs export `TEMPLATE_NFS_DIR`: |
|
| 153 |
- |
|
| 154 |
- TEMPLATE_FILENAME=devstack-jeos.xva |
|
| 155 |
- TEMPLATE_NAME=jeos_template_for_devstack |
|
| 156 |
- mountdir=$(mktemp -d) |
|
| 157 |
- mount -t nfs "$TEMPLATE_NFS_DIR" "$mountdir" |
|
| 158 |
- VM="$(xe template-list name-label="$TEMPLATE_NAME" --minimal)" |
|
| 159 |
- xe template-export template-uuid=$VM filename="$mountdir/$TEMPLATE_FILENAME" |
|
| 160 |
- umount "$mountdir" |
|
| 161 |
- rm -rf "$mountdir" |
|
| 162 |
- |
|
| 163 |
-### Import the Ubuntu VM |
|
| 164 |
- |
|
| 165 |
-Given you have an nfs export `TEMPLATE_NFS_DIR` where you exported the Ubuntu |
|
| 166 |
-VM as `TEMPLATE_FILENAME`: |
|
| 167 |
- |
|
| 168 |
- mountdir=$(mktemp -d) |
|
| 169 |
- mount -t nfs "$TEMPLATE_NFS_DIR" "$mountdir" |
|
| 170 |
- xe vm-import filename="$mountdir/$TEMPLATE_FILENAME" |
|
| 171 |
- umount "$mountdir" |
|
| 172 |
- rm -rf "$mountdir" |
|
| 1 |
+Note: XenServer relative tools have been moved to `os-xenapi`_ and be maintained there. |
|
| 173 | 2 |
|
| 3 |
+.. _os-xenapi: https://github.com/openstack/os-xenapi/ |
| 174 | 4 |
deleted file mode 100755 |
| ... | ... |
@@ -1,191 +0,0 @@ |
| 1 |
-#!/bin/bash |
|
| 2 |
- |
|
| 3 |
-# This script is run by install_os_domU.sh |
|
| 4 |
-# |
|
| 5 |
-# It modifies the ubuntu image created by install_os_domU.sh |
|
| 6 |
-# and previously moodified by prepare_guest_template.sh |
|
| 7 |
-# |
|
| 8 |
-# This script is responsible for: |
|
| 9 |
-# - pushing in the DevStack code |
|
| 10 |
-# - creating run.sh, to run the code on boot |
|
| 11 |
-# It does this by mounting the disk image of the VM. |
|
| 12 |
-# |
|
| 13 |
-# The resultant image is then templated and started |
|
| 14 |
-# by install_os_domU.sh |
|
| 15 |
- |
|
| 16 |
-# Exit on errors |
|
| 17 |
-set -o errexit |
|
| 18 |
-# Echo commands |
|
| 19 |
-set -o xtrace |
|
| 20 |
- |
|
| 21 |
-# This directory |
|
| 22 |
-TOP_DIR=$(cd $(dirname "$0") && pwd) |
|
| 23 |
- |
|
| 24 |
-# Include onexit commands |
|
| 25 |
-. $TOP_DIR/scripts/on_exit.sh |
|
| 26 |
- |
|
| 27 |
-# xapi functions |
|
| 28 |
-. $TOP_DIR/functions |
|
| 29 |
- |
|
| 30 |
-# Source params - override xenrc params in your localrc to suite your taste |
|
| 31 |
-source xenrc |
|
| 32 |
- |
|
| 33 |
-# |
|
| 34 |
-# Parameters |
|
| 35 |
-# |
|
| 36 |
-GUEST_NAME="$1" |
|
| 37 |
- |
|
| 38 |
-function _print_interface_config {
|
|
| 39 |
- local device_nr |
|
| 40 |
- local ip_address |
|
| 41 |
- local netmask |
|
| 42 |
- |
|
| 43 |
- device_nr="$1" |
|
| 44 |
- ip_address="$2" |
|
| 45 |
- netmask="$3" |
|
| 46 |
- |
|
| 47 |
- local device |
|
| 48 |
- |
|
| 49 |
- device="eth${device_nr}"
|
|
| 50 |
- |
|
| 51 |
- echo "auto $device" |
|
| 52 |
- if [ $ip_address == "dhcp" ]; then |
|
| 53 |
- echo "iface $device inet dhcp" |
|
| 54 |
- else |
|
| 55 |
- echo "iface $device inet static" |
|
| 56 |
- echo " address $ip_address" |
|
| 57 |
- echo " netmask $netmask" |
|
| 58 |
- fi |
|
| 59 |
- |
|
| 60 |
- # Turn off tx checksumming for better performance |
|
| 61 |
- echo " post-up ethtool -K $device tx off" |
|
| 62 |
-} |
|
| 63 |
- |
|
| 64 |
-function print_interfaces_config {
|
|
| 65 |
- echo "auto lo" |
|
| 66 |
- echo "iface lo inet loopback" |
|
| 67 |
- |
|
| 68 |
- _print_interface_config $PUB_DEV_NR $PUB_IP $PUB_NETMASK |
|
| 69 |
- _print_interface_config $VM_DEV_NR $VM_IP $VM_NETMASK |
|
| 70 |
- _print_interface_config $MGT_DEV_NR $MGT_IP $MGT_NETMASK |
|
| 71 |
-} |
|
| 72 |
- |
|
| 73 |
-# |
|
| 74 |
-# Mount the VDI |
|
| 75 |
-# |
|
| 76 |
-STAGING_DIR=$($TOP_DIR/scripts/manage-vdi open $GUEST_NAME 0 1 | grep -o "/tmp/tmp.[[:alnum:]]*") |
|
| 77 |
-add_on_exit "$TOP_DIR/scripts/manage-vdi close $GUEST_NAME 0 1" |
|
| 78 |
- |
|
| 79 |
-# Make sure we have a stage |
|
| 80 |
-if [ ! -d $STAGING_DIR/etc ]; then |
|
| 81 |
- echo "Stage is not properly set up!" |
|
| 82 |
- exit 1 |
|
| 83 |
-fi |
|
| 84 |
- |
|
| 85 |
-# Only support DHCP for now - don't support how different versions of Ubuntu handle resolv.conf |
|
| 86 |
-if [ "$MGT_IP" != "dhcp" ] && [ "$PUB_IP" != "dhcp" ]; then |
|
| 87 |
- echo "Configuration without DHCP not supported" |
|
| 88 |
- exit 1 |
|
| 89 |
-fi |
|
| 90 |
- |
|
| 91 |
-# Copy over devstack |
|
| 92 |
-rm -f /tmp/devstack.tar |
|
| 93 |
-cd $TOP_DIR/../../ |
|
| 94 |
-tar --exclude='stage' --exclude='xen/xvas' --exclude='xen/nova' -cvf /tmp/devstack.tar . |
|
| 95 |
-mkdir -p $STAGING_DIR/opt/stack/devstack |
|
| 96 |
-tar xf /tmp/devstack.tar -C $STAGING_DIR/opt/stack/devstack |
|
| 97 |
-cd $TOP_DIR |
|
| 98 |
- |
|
| 99 |
-# Create an systemd task for devstack |
|
| 100 |
-cat >$STAGING_DIR/etc/systemd/system/devstack.service << EOF |
|
| 101 |
-[Unit] |
|
| 102 |
-Description=Install OpenStack by DevStack |
|
| 103 |
- |
|
| 104 |
-[Service] |
|
| 105 |
-Type=oneshot |
|
| 106 |
-RemainAfterExit=yes |
|
| 107 |
-ExecStartPre=/bin/rm -f /opt/stack/runsh.succeeded |
|
| 108 |
-ExecStart=/bin/su -c "/opt/stack/run.sh" stack |
|
| 109 |
-StandardOutput=tty |
|
| 110 |
-StandardError=tty |
|
| 111 |
- |
|
| 112 |
-[Install] |
|
| 113 |
-WantedBy=multi-user.target |
|
| 114 |
- |
|
| 115 |
-EOF |
|
| 116 |
- |
|
| 117 |
-# enable this service |
|
| 118 |
-ln -s $STAGING_DIR/etc/systemd/system/devstack.service $STAGING_DIR/etc/systemd/system/multi-user.target.wants/devstack.service |
|
| 119 |
- |
|
| 120 |
-# Configure the hostname |
|
| 121 |
-echo $GUEST_NAME > $STAGING_DIR/etc/hostname |
|
| 122 |
- |
|
| 123 |
-# Hostname must resolve for rabbit |
|
| 124 |
-HOSTS_FILE_IP=$PUB_IP |
|
| 125 |
-if [ $MGT_IP != "dhcp" ]; then |
|
| 126 |
- HOSTS_FILE_IP=$MGT_IP |
|
| 127 |
-fi |
|
| 128 |
-cat <<EOF >$STAGING_DIR/etc/hosts |
|
| 129 |
-$HOSTS_FILE_IP $GUEST_NAME |
|
| 130 |
-127.0.0.1 localhost localhost.localdomain |
|
| 131 |
-EOF |
|
| 132 |
- |
|
| 133 |
-# Configure the network |
|
| 134 |
-print_interfaces_config > $STAGING_DIR/etc/network/interfaces |
|
| 135 |
- |
|
| 136 |
-# Gracefully cp only if source file/dir exists |
|
| 137 |
-function cp_it {
|
|
| 138 |
- if [ -e $1 ] || [ -d $1 ]; then |
|
| 139 |
- cp -pRL $1 $2 |
|
| 140 |
- fi |
|
| 141 |
-} |
|
| 142 |
- |
|
| 143 |
-# Copy over your ssh keys and env if desired |
|
| 144 |
-COPYENV=${COPYENV:-1}
|
|
| 145 |
-if [ "$COPYENV" = "1" ]; then |
|
| 146 |
- cp_it ~/.ssh $STAGING_DIR/opt/stack/.ssh |
|
| 147 |
- cp_it ~/.ssh/id_rsa.pub $STAGING_DIR/opt/stack/.ssh/authorized_keys |
|
| 148 |
- cp_it ~/.gitconfig $STAGING_DIR/opt/stack/.gitconfig |
|
| 149 |
- cp_it ~/.vimrc $STAGING_DIR/opt/stack/.vimrc |
|
| 150 |
- cp_it ~/.bashrc $STAGING_DIR/opt/stack/.bashrc |
|
| 151 |
-fi |
|
| 152 |
- |
|
| 153 |
-# Configure run.sh |
|
| 154 |
-cat <<EOF >$STAGING_DIR/opt/stack/run.sh |
|
| 155 |
-#!/bin/bash |
|
| 156 |
-set -eux |
|
| 157 |
-( |
|
| 158 |
- flock -n 9 || exit 1 |
|
| 159 |
- |
|
| 160 |
- sudo chown -R stack /opt/stack |
|
| 161 |
- |
|
| 162 |
- [ -e /opt/stack/runsh.succeeded ] && rm /opt/stack/runsh.succeeded |
|
| 163 |
- echo \$\$ >> /opt/stack/run_sh.pid |
|
| 164 |
- |
|
| 165 |
- cd /opt/stack/devstack |
|
| 166 |
- ./unstack.sh || true |
|
| 167 |
- ./stack.sh |
|
| 168 |
- |
|
| 169 |
- # Got to the end - success |
|
| 170 |
- touch /opt/stack/runsh.succeeded |
|
| 171 |
- |
|
| 172 |
- # Update /etc/issue |
|
| 173 |
- ( |
|
| 174 |
- echo "OpenStack VM - Installed by DevStack" |
|
| 175 |
- IPADDR=$(ip -4 address show eth0 | sed -n 's/.*inet \([0-9\.]\+\).*/\1/p') |
|
| 176 |
- echo " Management IP: $IPADDR" |
|
| 177 |
- echo -n " Devstack run: " |
|
| 178 |
- if [ -e /opt/stack/runsh.succeeded ]; then |
|
| 179 |
- echo "SUCCEEDED" |
|
| 180 |
- else |
|
| 181 |
- echo "FAILED" |
|
| 182 |
- fi |
|
| 183 |
- echo "" |
|
| 184 |
- ) > /opt/stack/issue |
|
| 185 |
- sudo cp /opt/stack/issue /etc/issue |
|
| 186 |
- |
|
| 187 |
- rm /opt/stack/run_sh.pid |
|
| 188 |
-) 9> /opt/stack/.runsh_lock |
|
| 189 |
-EOF |
|
| 190 |
- |
|
| 191 |
-chmod 755 $STAGING_DIR/opt/stack/run.sh |
| 192 | 1 |
deleted file mode 100644 |
| ... | ... |
@@ -1,14 +0,0 @@ |
| 1 |
-#!/bin/bash |
|
| 2 |
-set -eux |
|
| 3 |
- |
|
| 4 |
-# Need to set barrier=0 to avoid a Xen bug |
|
| 5 |
-# https://bugs.launchpad.net/ubuntu/+source/linux/+bug/824089 |
|
| 6 |
-sed -i -e 's/errors=/barrier=0,errors=/' /etc/fstab |
|
| 7 |
- |
|
| 8 |
-# Allow root to login with a password |
|
| 9 |
-sed -i -e 's/.*PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config |
|
| 10 |
- |
|
| 11 |
-# Install the XenServer tools so IP addresses are reported |
|
| 12 |
-wget --no-proxy @XS_TOOLS_URL@ -O /root/tools.deb |
|
| 13 |
-dpkg -i /root/tools.deb |
|
| 14 |
-rm /root/tools.deb |
| 15 | 1 |
deleted file mode 100644 |
| ... | ... |
@@ -1,471 +0,0 @@ |
| 1 |
-### Contents of the preconfiguration file (for squeeze) |
|
| 2 |
-### Localization |
|
| 3 |
-# Preseeding only locale sets language, country and locale. |
|
| 4 |
-d-i debian-installer/locale string en_US |
|
| 5 |
- |
|
| 6 |
-# The values can also be preseeded individually for greater flexibility. |
|
| 7 |
-#d-i debian-installer/language string en |
|
| 8 |
-#d-i debian-installer/country string NL |
|
| 9 |
-#d-i debian-installer/locale string en_GB.UTF-8 |
|
| 10 |
-# Optionally specify additional locales to be generated. |
|
| 11 |
-#d-i localechooser/supported-locales en_US.UTF-8, nl_NL.UTF-8 |
|
| 12 |
- |
|
| 13 |
-# Keyboard selection. |
|
| 14 |
-# Disable automatic (interactive) keymap detection. |
|
| 15 |
-d-i console-setup/ask_detect boolean false |
|
| 16 |
-#d-i keyboard-configuration/modelcode string pc105 |
|
| 17 |
-d-i keyboard-configuration/layoutcode string us |
|
| 18 |
-# To select a variant of the selected layout (if you leave this out, the |
|
| 19 |
-# basic form of the layout will be used): |
|
| 20 |
-#d-i keyboard-configuration/variantcode string dvorak |
|
| 21 |
- |
|
| 22 |
-### Network configuration |
|
| 23 |
-# Disable network configuration entirely. This is useful for cdrom |
|
| 24 |
-# installations on non-networked devices where the network questions, |
|
| 25 |
-# warning and long timeouts are a nuisance. |
|
| 26 |
-#d-i netcfg/enable boolean false |
|
| 27 |
- |
|
| 28 |
-# netcfg will choose an interface that has link if possible. This makes it |
|
| 29 |
-# skip displaying a list if there is more than one interface. |
|
| 30 |
-d-i netcfg/choose_interface select auto |
|
| 31 |
- |
|
| 32 |
-# To pick a particular interface instead: |
|
| 33 |
-#d-i netcfg/choose_interface select eth1 |
|
| 34 |
- |
|
| 35 |
-# If you have a slow dhcp server and the installer times out waiting for |
|
| 36 |
-# it, this might be useful. |
|
| 37 |
-d-i netcfg/dhcp_timeout string 120 |
|
| 38 |
- |
|
| 39 |
-# If you prefer to configure the network manually, uncomment this line and |
|
| 40 |
-# the static network configuration below. |
|
| 41 |
-#d-i netcfg/disable_autoconfig boolean true |
|
| 42 |
- |
|
| 43 |
-# If you want the preconfiguration file to work on systems both with and |
|
| 44 |
-# without a dhcp server, uncomment these lines and the static network |
|
| 45 |
-# configuration below. |
|
| 46 |
-#d-i netcfg/dhcp_failed note |
|
| 47 |
-#d-i netcfg/dhcp_options select Configure network manually |
|
| 48 |
- |
|
| 49 |
-# Static network configuration. |
|
| 50 |
-#d-i netcfg/get_nameservers string 192.168.1.1 |
|
| 51 |
-#d-i netcfg/get_ipaddress string 192.168.1.42 |
|
| 52 |
-#d-i netcfg/get_netmask string 255.255.255.0 |
|
| 53 |
-#d-i netcfg/get_gateway string 192.168.1.1 |
|
| 54 |
-#d-i netcfg/confirm_static boolean true |
|
| 55 |
- |
|
| 56 |
-# Any hostname and domain names assigned from dhcp take precedence over |
|
| 57 |
-# values set here. However, setting the values still prevents the questions |
|
| 58 |
-# from being shown, even if values come from dhcp. |
|
| 59 |
-d-i netcfg/get_hostname string stack |
|
| 60 |
-d-i netcfg/get_domain string stackpass |
|
| 61 |
- |
|
| 62 |
-# Disable that annoying WEP key dialog. |
|
| 63 |
-d-i netcfg/wireless_wep string |
|
| 64 |
-# The wacky dhcp hostname that some ISPs use as a password of sorts. |
|
| 65 |
-#d-i netcfg/dhcp_hostname string radish |
|
| 66 |
- |
|
| 67 |
-# If non-free firmware is needed for the network or other hardware, you can |
|
| 68 |
-# configure the installer to always try to load it, without prompting. Or |
|
| 69 |
-# change to false to disable asking. |
|
| 70 |
-#d-i hw-detect/load_firmware boolean true |
|
| 71 |
- |
|
| 72 |
-### Network console |
|
| 73 |
-# Use the following settings if you wish to make use of the network-console |
|
| 74 |
-# component for remote installation over SSH. This only makes sense if you |
|
| 75 |
-# intend to perform the remainder of the installation manually. |
|
| 76 |
-#d-i anna/choose_modules string network-console |
|
| 77 |
-#d-i network-console/password password r00tme |
|
| 78 |
-#d-i network-console/password-again password r00tme |
|
| 79 |
- |
|
| 80 |
-### Mirror settings |
|
| 81 |
-# If you select ftp, the mirror/country string does not need to be set. |
|
| 82 |
-#d-i mirror/protocol string ftp |
|
| 83 |
-d-i mirror/country string manual |
|
| 84 |
-d-i mirror/http/hostname string archive.ubuntu.com |
|
| 85 |
-d-i mirror/http/directory string /ubuntu |
|
| 86 |
-d-i mirror/http/proxy string |
|
| 87 |
- |
|
| 88 |
-# Alternatively: by default, the installer uses CC.archive.ubuntu.com where |
|
| 89 |
-# CC is the ISO-3166-2 code for the selected country. You can preseed this |
|
| 90 |
-# so that it does so without asking. |
|
| 91 |
-#d-i mirror/http/mirror select CC.archive.ubuntu.com |
|
| 92 |
- |
|
| 93 |
-# Suite to install. |
|
| 94 |
-#d-i mirror/suite string squeeze |
|
| 95 |
-# Suite to use for loading installer components (optional). |
|
| 96 |
-#d-i mirror/udeb/suite string squeeze |
|
| 97 |
-# Components to use for loading installer components (optional). |
|
| 98 |
-#d-i mirror/udeb/components multiselect main, restricted |
|
| 99 |
- |
|
| 100 |
-### Clock and time zone setup |
|
| 101 |
-# Controls whether or not the hardware clock is set to UTC. |
|
| 102 |
-d-i clock-setup/utc boolean true |
|
| 103 |
- |
|
| 104 |
-# You may set this to any valid setting for $TZ; see the contents of |
|
| 105 |
-# /usr/share/zoneinfo/ for valid values. |
|
| 106 |
-d-i time/zone string US/Pacific |
|
| 107 |
- |
|
| 108 |
-# Controls whether to use NTP to set the clock during the install |
|
| 109 |
-d-i clock-setup/ntp boolean true |
|
| 110 |
-# NTP server to use. The default is almost always fine here. |
|
| 111 |
-d-i clock-setup/ntp-server string 0.us.pool.ntp.org |
|
| 112 |
- |
|
| 113 |
-### Partitioning |
|
| 114 |
-## Partitioning example |
|
| 115 |
-# If the system has free space you can choose to only partition that space. |
|
| 116 |
-# This is only honoured if partman-auto/method (below) is not set. |
|
| 117 |
-# Alternatives: custom, some_device, some_device_crypto, some_device_lvm. |
|
| 118 |
-#d-i partman-auto/init_automatically_partition select biggest_free |
|
| 119 |
- |
|
| 120 |
-# Alternatively, you may specify a disk to partition. If the system has only |
|
| 121 |
-# one disk the installer will default to using that, but otherwise the device |
|
| 122 |
-# name must be given in traditional, non-devfs format (so e.g. /dev/hda or |
|
| 123 |
-# /dev/sda, and not e.g. /dev/discs/disc0/disc). |
|
| 124 |
-# For example, to use the first SCSI/SATA hard disk: |
|
| 125 |
-#d-i partman-auto/disk string /dev/sda |
|
| 126 |
-# In addition, you'll need to specify the method to use. |
|
| 127 |
-# The presently available methods are: |
|
| 128 |
-# - regular: use the usual partition types for your architecture |
|
| 129 |
-# - lvm: use LVM to partition the disk |
|
| 130 |
-# - crypto: use LVM within an encrypted partition |
|
| 131 |
-d-i partman-auto/method string regular |
|
| 132 |
- |
|
| 133 |
-# If one of the disks that are going to be automatically partitioned |
|
| 134 |
-# contains an old LVM configuration, the user will normally receive a |
|
| 135 |
-# warning. This can be preseeded away... |
|
| 136 |
-d-i partman-lvm/device_remove_lvm boolean true |
|
| 137 |
-# The same applies to pre-existing software RAID array: |
|
| 138 |
-d-i partman-md/device_remove_md boolean true |
|
| 139 |
-# And the same goes for the confirmation to write the lvm partitions. |
|
| 140 |
-d-i partman-lvm/confirm boolean true |
|
| 141 |
- |
|
| 142 |
-# For LVM partitioning, you can select how much of the volume group to use |
|
| 143 |
-# for logical volumes. |
|
| 144 |
-#d-i partman-auto-lvm/guided_size string max |
|
| 145 |
-#d-i partman-auto-lvm/guided_size string 10GB |
|
| 146 |
-#d-i partman-auto-lvm/guided_size string 50% |
|
| 147 |
- |
|
| 148 |
-# You can choose one of the three predefined partitioning recipes: |
|
| 149 |
-# - atomic: all files in one partition |
|
| 150 |
-# - home: separate /home partition |
|
| 151 |
-# - multi: separate /home, /usr, /var, and /tmp partitions |
|
| 152 |
-d-i partman-auto/choose_recipe select atomic |
|
| 153 |
- |
|
| 154 |
-# Or provide a recipe of your own... |
|
| 155 |
-# If you have a way to get a recipe file into the d-i environment, you can |
|
| 156 |
-# just point at it. |
|
| 157 |
-#d-i partman-auto/expert_recipe_file string /hd-media/recipe |
|
| 158 |
- |
|
| 159 |
-# If not, you can put an entire recipe into the preconfiguration file in one |
|
| 160 |
-# (logical) line. This example creates a small /boot partition, suitable |
|
| 161 |
-# swap, and uses the rest of the space for the root partition: |
|
| 162 |
-#d-i partman-auto/expert_recipe string \ |
|
| 163 |
-# boot-root :: \ |
|
| 164 |
-# 40 50 100 ext3 \ |
|
| 165 |
-# $primary{ } $bootable{ } \
|
|
| 166 |
-# method{ format } format{ } \
|
|
| 167 |
-# use_filesystem{ } filesystem{ ext3 } \
|
|
| 168 |
-# mountpoint{ /boot } \
|
|
| 169 |
-# . \ |
|
| 170 |
-# 500 10000 1000000000 ext3 \ |
|
| 171 |
-# method{ format } format{ } \
|
|
| 172 |
-# use_filesystem{ } filesystem{ ext3 } \
|
|
| 173 |
-# mountpoint{ / } \
|
|
| 174 |
-# . \ |
|
| 175 |
-# 64 512 300% linux-swap \ |
|
| 176 |
-# method{ swap } format{ } \
|
|
| 177 |
-# . |
|
| 178 |
- |
|
| 179 |
-# If you just want to change the default filesystem from ext3 to something |
|
| 180 |
-# else, you can do that without providing a full recipe. |
|
| 181 |
-d-i partman/default_filesystem string ext3 |
|
| 182 |
- |
|
| 183 |
-# The full recipe format is documented in the file partman-auto-recipe.txt |
|
| 184 |
-# included in the 'debian-installer' package or available from D-I source |
|
| 185 |
-# repository. This also documents how to specify settings such as file |
|
| 186 |
-# system labels, volume group names and which physical devices to include |
|
| 187 |
-# in a volume group. |
|
| 188 |
- |
|
| 189 |
-# This makes partman automatically partition without confirmation, provided |
|
| 190 |
-# that you told it what to do using one of the methods above. |
|
| 191 |
-d-i partman-partitioning/confirm_write_new_label boolean true |
|
| 192 |
-d-i partman/choose_partition select finish |
|
| 193 |
-d-i partman/confirm boolean true |
|
| 194 |
-d-i partman/confirm_nooverwrite boolean true |
|
| 195 |
- |
|
| 196 |
-## Partitioning using RAID |
|
| 197 |
-# The method should be set to "raid". |
|
| 198 |
-#d-i partman-auto/method string raid |
|
| 199 |
-# Specify the disks to be partitioned. They will all get the same layout, |
|
| 200 |
-# so this will only work if the disks are the same size. |
|
| 201 |
-#d-i partman-auto/disk string /dev/sda /dev/sdb |
|
| 202 |
- |
|
| 203 |
-# Next you need to specify the physical partitions that will be used. |
|
| 204 |
-#d-i partman-auto/expert_recipe string \ |
|
| 205 |
-# multiraid :: \ |
|
| 206 |
-# 1000 5000 4000 raid \ |
|
| 207 |
-# $primary{ } method{ raid } \
|
|
| 208 |
-# . \ |
|
| 209 |
-# 64 512 300% raid \ |
|
| 210 |
-# method{ raid } \
|
|
| 211 |
-# . \ |
|
| 212 |
-# 500 10000 1000000000 raid \ |
|
| 213 |
-# method{ raid } \
|
|
| 214 |
-# . |
|
| 215 |
- |
|
| 216 |
-# Last you need to specify how the previously defined partitions will be |
|
| 217 |
-# used in the RAID setup. Remember to use the correct partition numbers |
|
| 218 |
-# for logical partitions. RAID levels 0, 1, 5, 6 and 10 are supported; |
|
| 219 |
-# devices are separated using "#". |
|
| 220 |
-# Parameters are: |
|
| 221 |
-# <raidtype> <devcount> <sparecount> <fstype> <mountpoint> \ |
|
| 222 |
-# <devices> <sparedevices> |
|
| 223 |
- |
|
| 224 |
-#d-i partman-auto-raid/recipe string \ |
|
| 225 |
-# 1 2 0 ext3 / \ |
|
| 226 |
-# /dev/sda1#/dev/sdb1 \ |
|
| 227 |
-# . \ |
|
| 228 |
-# 1 2 0 swap - \ |
|
| 229 |
-# /dev/sda5#/dev/sdb5 \ |
|
| 230 |
-# . \ |
|
| 231 |
-# 0 2 0 ext3 /home \ |
|
| 232 |
-# /dev/sda6#/dev/sdb6 \ |
|
| 233 |
-# . |
|
| 234 |
- |
|
| 235 |
-# For additional information see the file partman-auto-raid-recipe.txt |
|
| 236 |
-# included in the 'debian-installer' package or available from D-I source |
|
| 237 |
-# repository. |
|
| 238 |
- |
|
| 239 |
-# This makes partman automatically partition without confirmation. |
|
| 240 |
-d-i partman-md/confirm boolean true |
|
| 241 |
-d-i partman-partitioning/confirm_write_new_label boolean true |
|
| 242 |
-d-i partman/choose_partition select finish |
|
| 243 |
-d-i partman/confirm boolean true |
|
| 244 |
-d-i partman/confirm_nooverwrite boolean true |
|
| 245 |
- |
|
| 246 |
-## Controlling how partitions are mounted |
|
| 247 |
-# The default is to mount by UUID, but you can also choose "traditional" to |
|
| 248 |
-# use traditional device names, or "label" to try filesystem labels before |
|
| 249 |
-# falling back to UUIDs. |
|
| 250 |
-#d-i partman/mount_style select uuid |
|
| 251 |
- |
|
| 252 |
-### Base system installation |
|
| 253 |
-# Configure APT to not install recommended packages by default. Use of this |
|
| 254 |
-# option can result in an incomplete system and should only be used by very |
|
| 255 |
-# experienced users. |
|
| 256 |
-#d-i base-installer/install-recommends boolean false |
|
| 257 |
- |
|
| 258 |
-# The kernel image (meta) package to be installed; "none" can be used if no |
|
| 259 |
-# kernel is to be installed. |
|
| 260 |
-d-i base-installer/kernel/image string linux-virtual |
|
| 261 |
- |
|
| 262 |
-### Account setup |
|
| 263 |
-# Skip creation of a root account (normal user account will be able to |
|
| 264 |
-# use sudo). The default is false; preseed this to true if you want to set |
|
| 265 |
-# a root password. |
|
| 266 |
-d-i passwd/root-login boolean true |
|
| 267 |
-# Alternatively, to skip creation of a normal user account. |
|
| 268 |
-d-i passwd/make-user boolean false |
|
| 269 |
- |
|
| 270 |
-# Root password, either in clear text |
|
| 271 |
-d-i passwd/root-password password stackpass |
|
| 272 |
-d-i passwd/root-password-again password stackpass |
|
| 273 |
-# or encrypted using an MD5 hash. |
|
| 274 |
-#d-i passwd/root-password-crypted password [MD5 hash] |
|
| 275 |
- |
|
| 276 |
-# To create a normal user account. |
|
| 277 |
-#d-i passwd/user-fullname string Ubuntu User |
|
| 278 |
-#d-i passwd/username string ubuntu |
|
| 279 |
-# Normal user's password, either in clear text |
|
| 280 |
-#d-i passwd/user-password password insecure |
|
| 281 |
-#d-i passwd/user-password-again password insecure |
|
| 282 |
-# or encrypted using an MD5 hash. |
|
| 283 |
-#d-i passwd/user-password-crypted password [MD5 hash] |
|
| 284 |
-# Create the first user with the specified UID instead of the default. |
|
| 285 |
-#d-i passwd/user-uid string 1010 |
|
| 286 |
-# The installer will warn about weak passwords. If you are sure you know |
|
| 287 |
-# what you're doing and want to override it, uncomment this. |
|
| 288 |
-d-i user-setup/allow-password-weak boolean true |
|
| 289 |
- |
|
| 290 |
-# The user account will be added to some standard initial groups. To |
|
| 291 |
-# override that, use this. |
|
| 292 |
-#d-i passwd/user-default-groups string audio cdrom video |
|
| 293 |
- |
|
| 294 |
-# Set to true if you want to encrypt the first user's home directory. |
|
| 295 |
-d-i user-setup/encrypt-home boolean false |
|
| 296 |
- |
|
| 297 |
-### Apt setup |
|
| 298 |
-# You can choose to install restricted and universe software, or to install |
|
| 299 |
-# software from the backports repository. |
|
| 300 |
-d-i apt-setup/restricted boolean true |
|
| 301 |
-d-i apt-setup/universe boolean true |
|
| 302 |
-d-i apt-setup/backports boolean true |
|
| 303 |
-# Uncomment this if you don't want to use a network mirror. |
|
| 304 |
-#d-i apt-setup/use_mirror boolean false |
|
| 305 |
-# Select which update services to use; define the mirrors to be used. |
|
| 306 |
-# Values shown below are the normal defaults. |
|
| 307 |
-#d-i apt-setup/services-select multiselect security |
|
| 308 |
-#d-i apt-setup/security_host string security.ubuntu.com |
|
| 309 |
-#d-i apt-setup/security_path string /ubuntu |
|
| 310 |
- |
|
| 311 |
-# Additional repositories, local[0-9] available |
|
| 312 |
-#d-i apt-setup/local0/repository string \ |
|
| 313 |
-# http://local.server/ubuntu squeeze main |
|
| 314 |
-#d-i apt-setup/local0/comment string local server |
|
| 315 |
-# Enable deb-src lines |
|
| 316 |
-#d-i apt-setup/local0/source boolean true |
|
| 317 |
-# URL to the public key of the local repository; you must provide a key or |
|
| 318 |
-# apt will complain about the unauthenticated repository and so the |
|
| 319 |
-# sources.list line will be left commented out |
|
| 320 |
-#d-i apt-setup/local0/key string http://local.server/key |
|
| 321 |
- |
|
| 322 |
-# By default the installer requires that repositories be authenticated |
|
| 323 |
-# using a known gpg key. This setting can be used to disable that |
|
| 324 |
-# authentication. Warning: Insecure, not recommended. |
|
| 325 |
-#d-i debian-installer/allow_unauthenticated boolean true |
|
| 326 |
- |
|
| 327 |
-### Package selection |
|
| 328 |
-#tasksel tasksel/first multiselect ubuntu-desktop |
|
| 329 |
-#tasksel tasksel/first multiselect lamp-server, print-server |
|
| 330 |
-#tasksel tasksel/first multiselect kubuntu-desktop |
|
| 331 |
-tasksel tasksel/first multiselect openssh-server |
|
| 332 |
- |
|
| 333 |
-# Individual additional packages to install |
|
| 334 |
-d-i pkgsel/include string cracklib-runtime curl wget ssh openssh-server tcpdump ethtool git sudo python-netaddr coreutils |
|
| 335 |
- |
|
| 336 |
-# Whether to upgrade packages after debootstrap. |
|
| 337 |
-# Allowed values: none, safe-upgrade, full-upgrade |
|
| 338 |
-d-i pkgsel/upgrade select safe-upgrade |
|
| 339 |
- |
|
| 340 |
-# Language pack selection |
|
| 341 |
-#d-i pkgsel/language-packs multiselect de, en, zh |
|
| 342 |
- |
|
| 343 |
-# Policy for applying updates. May be "none" (no automatic updates), |
|
| 344 |
-# "unattended-upgrades" (install security updates automatically), or |
|
| 345 |
-# "landscape" (manage system with Landscape). |
|
| 346 |
-d-i pkgsel/update-policy select unattended-upgrades |
|
| 347 |
- |
|
| 348 |
-# Some versions of the installer can report back on what software you have |
|
| 349 |
-# installed, and what software you use. The default is not to report back, |
|
| 350 |
-# but sending reports helps the project determine what software is most |
|
| 351 |
-# popular and include it on CDs. |
|
| 352 |
-#popularity-contest popularity-contest/participate boolean false |
|
| 353 |
- |
|
| 354 |
-# By default, the system's locate database will be updated after the |
|
| 355 |
-# installer has finished installing most packages. This may take a while, so |
|
| 356 |
-# if you don't want it, you can set this to "false" to turn it off. |
|
| 357 |
-d-i pkgsel/updatedb boolean false |
|
| 358 |
- |
|
| 359 |
-### Boot loader installation |
|
| 360 |
-# Grub is the default boot loader (for x86). If you want lilo installed |
|
| 361 |
-# instead, uncomment this: |
|
| 362 |
-#d-i grub-installer/skip boolean true |
|
| 363 |
-# To also skip installing lilo, and install no bootloader, uncomment this |
|
| 364 |
-# too: |
|
| 365 |
-#d-i lilo-installer/skip boolean true |
|
| 366 |
- |
|
| 367 |
-# With a few exceptions for unusual partitioning setups, GRUB 2 is now the |
|
| 368 |
-# default. If you need GRUB Legacy for some particular reason, then |
|
| 369 |
-# uncomment this: |
|
| 370 |
-d-i grub-installer/grub2_instead_of_grub_legacy boolean false |
|
| 371 |
- |
|
| 372 |
-# This is fairly safe to set, it makes grub install automatically to the MBR |
|
| 373 |
-# if no other operating system is detected on the machine. |
|
| 374 |
-d-i grub-installer/only_debian boolean true |
|
| 375 |
- |
|
| 376 |
-# This one makes grub-installer install to the MBR if it also finds some other |
|
| 377 |
-# OS, which is less safe as it might not be able to boot that other OS. |
|
| 378 |
-d-i grub-installer/with_other_os boolean true |
|
| 379 |
- |
|
| 380 |
-# Alternatively, if you want to install to a location other than the mbr, |
|
| 381 |
-# uncomment and edit these lines: |
|
| 382 |
-#d-i grub-installer/only_debian boolean false |
|
| 383 |
-#d-i grub-installer/with_other_os boolean false |
|
| 384 |
-#d-i grub-installer/bootdev string (hd0,0) |
|
| 385 |
-# To install grub to multiple disks: |
|
| 386 |
-#d-i grub-installer/bootdev string (hd0,0) (hd1,0) (hd2,0) |
|
| 387 |
- |
|
| 388 |
-# Optional password for grub, either in clear text |
|
| 389 |
-#d-i grub-installer/password password r00tme |
|
| 390 |
-#d-i grub-installer/password-again password r00tme |
|
| 391 |
-# or encrypted using an MD5 hash, see grub-md5-crypt(8). |
|
| 392 |
-#d-i grub-installer/password-crypted password [MD5 hash] |
|
| 393 |
- |
|
| 394 |
-# Use the following option to add additional boot parameters for the |
|
| 395 |
-# installed system (if supported by the bootloader installer). |
|
| 396 |
-# Note: options passed to the installer will be added automatically. |
|
| 397 |
-#d-i debian-installer/add-kernel-opts string nousb |
|
| 398 |
- |
|
| 399 |
-### Finishing up the installation |
|
| 400 |
-# During installations from serial console, the regular virtual consoles |
|
| 401 |
-# (VT1-VT6) are normally disabled in /etc/inittab. Uncomment the next |
|
| 402 |
-# line to prevent this. |
|
| 403 |
-d-i finish-install/keep-consoles boolean true |
|
| 404 |
- |
|
| 405 |
-# Avoid that last message about the install being complete. |
|
| 406 |
-d-i finish-install/reboot_in_progress note |
|
| 407 |
- |
|
| 408 |
-# This will prevent the installer from ejecting the CD during the reboot, |
|
| 409 |
-# which is useful in some situations. |
|
| 410 |
-#d-i cdrom-detect/eject boolean false |
|
| 411 |
- |
|
| 412 |
-# This is how to make the installer shutdown when finished, but not |
|
| 413 |
-# reboot into the installed system. |
|
| 414 |
-#d-i debian-installer/exit/halt boolean true |
|
| 415 |
-# This will power off the machine instead of just halting it. |
|
| 416 |
-#d-i debian-installer/exit/poweroff boolean true |
|
| 417 |
- |
|
| 418 |
-### X configuration |
|
| 419 |
-# X can detect the right driver for some cards, but if you're preseeding, |
|
| 420 |
-# you override whatever it chooses. Still, vesa will work most places. |
|
| 421 |
-#xserver-xorg xserver-xorg/config/device/driver select vesa |
|
| 422 |
- |
|
| 423 |
-# A caveat with mouse autodetection is that if it fails, X will retry it |
|
| 424 |
-# over and over. So if it's preseeded to be done, there is a possibility of |
|
| 425 |
-# an infinite loop if the mouse is not autodetected. |
|
| 426 |
-#xserver-xorg xserver-xorg/autodetect_mouse boolean true |
|
| 427 |
- |
|
| 428 |
-# Monitor autodetection is recommended. |
|
| 429 |
-xserver-xorg xserver-xorg/autodetect_monitor boolean true |
|
| 430 |
-# Uncomment if you have an LCD display. |
|
| 431 |
-#xserver-xorg xserver-xorg/config/monitor/lcd boolean true |
|
| 432 |
-# X has three configuration paths for the monitor. Here's how to preseed |
|
| 433 |
-# the "medium" path, which is always available. The "simple" path may not |
|
| 434 |
-# be available, and the "advanced" path asks too many questions. |
|
| 435 |
-xserver-xorg xserver-xorg/config/monitor/selection-method \ |
|
| 436 |
- select medium |
|
| 437 |
-xserver-xorg xserver-xorg/config/monitor/mode-list \ |
|
| 438 |
- select 1024x768 @ 60 Hz |
|
| 439 |
- |
|
| 440 |
-### Preseeding other packages |
|
| 441 |
-# Depending on what software you choose to install, or if things go wrong |
|
| 442 |
-# during the installation process, it's possible that other questions may |
|
| 443 |
-# be asked. You can preseed those too, of course. To get a list of every |
|
| 444 |
-# possible question that could be asked during an install, do an |
|
| 445 |
-# installation, and then run these commands: |
|
| 446 |
-# debconf-get-selections --installer > file |
|
| 447 |
-# debconf-get-selections >> file |
|
| 448 |
- |
|
| 449 |
- |
|
| 450 |
-#### Advanced options |
|
| 451 |
-### Running custom commands during the installation |
|
| 452 |
-# d-i preseeding is inherently not secure. Nothing in the installer checks |
|
| 453 |
-# for attempts at buffer overflows or other exploits of the values of a |
|
| 454 |
-# preconfiguration file like this one. Only use preconfiguration files from |
|
| 455 |
-# trusted locations! To drive that home, and because it's generally useful, |
|
| 456 |
-# here's a way to run any shell command you'd like inside the installer, |
|
| 457 |
-# automatically. |
|
| 458 |
- |
|
| 459 |
-# This first command is run as early as possible, just after |
|
| 460 |
-# preseeding is read. |
|
| 461 |
-#d-i preseed/early_command string anna-install some-udeb |
|
| 462 |
-# This command is run immediately before the partitioner starts. It may be |
|
| 463 |
-# useful to apply dynamic partitioner preseeding that depends on the state |
|
| 464 |
-# of the disks (which may not be visible when preseed/early_command runs). |
|
| 465 |
-#d-i partman/early_command \ |
|
| 466 |
-# string debconf-set partman-auto/disk "$(list-devices disk | head -n1)" |
|
| 467 |
-# This command is run just before the install finishes, but when there is |
|
| 468 |
-# still a usable /target directory. You can chroot to /target and use it |
|
| 469 |
-# directly, or use the apt-install and in-target commands to easily install |
|
| 470 |
-# packages and run commands in the target system. |
|
| 471 |
-d-i preseed/late_command string |
| 472 | 1 |
deleted file mode 100644 |
| ... | ... |
@@ -1,341 +0,0 @@ |
| 1 |
-#!/bin/bash |
|
| 2 |
- |
|
| 3 |
-function die_with_error {
|
|
| 4 |
- local err_msg |
|
| 5 |
- |
|
| 6 |
- err_msg="$1" |
|
| 7 |
- |
|
| 8 |
- echo "$err_msg" >&2 |
|
| 9 |
- exit 1 |
|
| 10 |
-} |
|
| 11 |
- |
|
| 12 |
-function xapi_plugin_location {
|
|
| 13 |
- for PLUGIN_DIR in "/etc/xapi.d/plugins/" "/usr/lib/xcp/plugins/" "/usr/lib/xapi/plugins" "/usr/lib64/xapi/plugins"; do |
|
| 14 |
- if [ -d $PLUGIN_DIR ]; then |
|
| 15 |
- echo $PLUGIN_DIR |
|
| 16 |
- return 0 |
|
| 17 |
- fi |
|
| 18 |
- done |
|
| 19 |
- return 1 |
|
| 20 |
-} |
|
| 21 |
- |
|
| 22 |
-function create_directory_for_kernels {
|
|
| 23 |
- if [ -d "/boot/guest" ]; then |
|
| 24 |
- echo "INFO: /boot/guest directory already exists, using that" >&2 |
|
| 25 |
- else |
|
| 26 |
- local local_path |
|
| 27 |
- local_path="$(get_local_sr_path)/os-guest-kernels" |
|
| 28 |
- mkdir -p $local_path |
|
| 29 |
- ln -s $local_path /boot/guest |
|
| 30 |
- fi |
|
| 31 |
-} |
|
| 32 |
- |
|
| 33 |
-function create_directory_for_images {
|
|
| 34 |
- if [ -d "/images" ]; then |
|
| 35 |
- echo "INFO: /images directory already exists, using that" >&2 |
|
| 36 |
- else |
|
| 37 |
- local local_path |
|
| 38 |
- local_path="$(get_local_sr_path)/os-images" |
|
| 39 |
- mkdir -p $local_path |
|
| 40 |
- ln -s $local_path /images |
|
| 41 |
- fi |
|
| 42 |
-} |
|
| 43 |
- |
|
| 44 |
-function get_local_sr {
|
|
| 45 |
- xe pool-list params=default-SR minimal=true |
|
| 46 |
-} |
|
| 47 |
- |
|
| 48 |
-function get_local_sr_path {
|
|
| 49 |
- pbd_path="/var/run/sr-mount/$(get_local_sr)" |
|
| 50 |
- pbd_device_config_path=`xe pbd-list sr-uuid=$(get_local_sr) params=device-config | grep " path: "` |
|
| 51 |
- if [ -n "$pbd_device_config_path" ]; then |
|
| 52 |
- pbd_uuid=`xe pbd-list sr-uuid=$(get_local_sr) minimal=true` |
|
| 53 |
- pbd_path=`xe pbd-param-get uuid=$pbd_uuid param-name=device-config param-key=path || echo ""` |
|
| 54 |
- fi |
|
| 55 |
- echo $pbd_path |
|
| 56 |
-} |
|
| 57 |
- |
|
| 58 |
-function find_ip_by_name {
|
|
| 59 |
- local guest_name="$1" |
|
| 60 |
- local interface="$2" |
|
| 61 |
- |
|
| 62 |
- local period=10 |
|
| 63 |
- local max_tries=10 |
|
| 64 |
- local i=0 |
|
| 65 |
- |
|
| 66 |
- while true; do |
|
| 67 |
- if [ $i -ge $max_tries ]; then |
|
| 68 |
- echo "Timeout: ip address for interface $interface of $guest_name" |
|
| 69 |
- exit 11 |
|
| 70 |
- fi |
|
| 71 |
- |
|
| 72 |
- ipaddress=$(xe vm-list --minimal \ |
|
| 73 |
- name-label=$guest_name \ |
|
| 74 |
- params=networks | sed -ne "s,^.*${interface}/ip: \([0-9.]*\).*\$,\1,p")
|
|
| 75 |
- |
|
| 76 |
- if [ -z "$ipaddress" ]; then |
|
| 77 |
- sleep $period |
|
| 78 |
- i=$((i+1)) |
|
| 79 |
- else |
|
| 80 |
- echo $ipaddress |
|
| 81 |
- break |
|
| 82 |
- fi |
|
| 83 |
- done |
|
| 84 |
-} |
|
| 85 |
- |
|
| 86 |
-function _vm_uuid {
|
|
| 87 |
- local vm_name_label |
|
| 88 |
- |
|
| 89 |
- vm_name_label="$1" |
|
| 90 |
- |
|
| 91 |
- xe vm-list name-label="$vm_name_label" --minimal |
|
| 92 |
-} |
|
| 93 |
- |
|
| 94 |
-function _create_new_network {
|
|
| 95 |
- local name_label |
|
| 96 |
- name_label=$1 |
|
| 97 |
- |
|
| 98 |
- xe network-create name-label="$name_label" |
|
| 99 |
-} |
|
| 100 |
- |
|
| 101 |
-function _multiple_networks_with_name {
|
|
| 102 |
- local name_label |
|
| 103 |
- name_label=$1 |
|
| 104 |
- |
|
| 105 |
- # A comma indicates multiple matches |
|
| 106 |
- xe network-list name-label="$name_label" --minimal | grep -q "," |
|
| 107 |
-} |
|
| 108 |
- |
|
| 109 |
-function _network_exists {
|
|
| 110 |
- local name_label |
|
| 111 |
- name_label=$1 |
|
| 112 |
- |
|
| 113 |
- ! [ -z "$(xe network-list name-label="$name_label" --minimal)" ] |
|
| 114 |
-} |
|
| 115 |
- |
|
| 116 |
-function _bridge_exists {
|
|
| 117 |
- local bridge |
|
| 118 |
- bridge=$1 |
|
| 119 |
- |
|
| 120 |
- ! [ -z "$(xe network-list bridge="$bridge" --minimal)" ] |
|
| 121 |
-} |
|
| 122 |
- |
|
| 123 |
-function _network_uuid {
|
|
| 124 |
- local bridge_or_net_name |
|
| 125 |
- bridge_or_net_name=$1 |
|
| 126 |
- |
|
| 127 |
- if _bridge_exists "$bridge_or_net_name"; then |
|
| 128 |
- xe network-list bridge="$bridge_or_net_name" --minimal |
|
| 129 |
- else |
|
| 130 |
- xe network-list name-label="$bridge_or_net_name" --minimal |
|
| 131 |
- fi |
|
| 132 |
-} |
|
| 133 |
- |
|
| 134 |
-function add_interface {
|
|
| 135 |
- local vm_name_label |
|
| 136 |
- local bridge_or_network_name |
|
| 137 |
- |
|
| 138 |
- vm_name_label="$1" |
|
| 139 |
- bridge_or_network_name="$2" |
|
| 140 |
- device_number="$3" |
|
| 141 |
- |
|
| 142 |
- local vm |
|
| 143 |
- local net |
|
| 144 |
- |
|
| 145 |
- vm=$(_vm_uuid "$vm_name_label") |
|
| 146 |
- net=$(_network_uuid "$bridge_or_network_name") |
|
| 147 |
- xe vif-create network-uuid=$net vm-uuid=$vm device=$device_number |
|
| 148 |
-} |
|
| 149 |
- |
|
| 150 |
-function setup_network {
|
|
| 151 |
- local bridge_or_net_name |
|
| 152 |
- bridge_or_net_name=$1 |
|
| 153 |
- |
|
| 154 |
- if ! _bridge_exists "$bridge_or_net_name"; then |
|
| 155 |
- if _network_exists "$bridge_or_net_name"; then |
|
| 156 |
- if _multiple_networks_with_name "$bridge_or_net_name"; then |
|
| 157 |
- cat >&2 << EOF |
|
| 158 |
-ERROR: Multiple networks found matching name-label to "$bridge_or_net_name" |
|
| 159 |
-please review your XenServer network configuration / localrc file. |
|
| 160 |
-EOF |
|
| 161 |
- exit 1 |
|
| 162 |
- fi |
|
| 163 |
- else |
|
| 164 |
- _create_new_network "$bridge_or_net_name" |
|
| 165 |
- fi |
|
| 166 |
- fi |
|
| 167 |
-} |
|
| 168 |
- |
|
| 169 |
-function bridge_for {
|
|
| 170 |
- local bridge_or_net_name |
|
| 171 |
- bridge_or_net_name=$1 |
|
| 172 |
- |
|
| 173 |
- if _bridge_exists "$bridge_or_net_name"; then |
|
| 174 |
- echo "$bridge_or_net_name" |
|
| 175 |
- else |
|
| 176 |
- xe network-list name-label="$bridge_or_net_name" params=bridge --minimal |
|
| 177 |
- fi |
|
| 178 |
-} |
|
| 179 |
- |
|
| 180 |
-function xenapi_ip_on {
|
|
| 181 |
- local bridge_or_net_name |
|
| 182 |
- bridge_or_net_name=$1 |
|
| 183 |
- |
|
| 184 |
- ip -4 addr show $(bridge_for "$bridge_or_net_name") |\ |
|
| 185 |
- awk '/inet/{split($2, ip, "/"); print ip[1];}'
|
|
| 186 |
-} |
|
| 187 |
- |
|
| 188 |
-function xenapi_is_listening_on {
|
|
| 189 |
- local bridge_or_net_name |
|
| 190 |
- bridge_or_net_name=$1 |
|
| 191 |
- |
|
| 192 |
- ! [ -z $(xenapi_ip_on "$bridge_or_net_name") ] |
|
| 193 |
-} |
|
| 194 |
- |
|
| 195 |
-function parameter_is_specified {
|
|
| 196 |
- local parameter_name |
|
| 197 |
- parameter_name=$1 |
|
| 198 |
- |
|
| 199 |
- compgen -v | grep "$parameter_name" |
|
| 200 |
-} |
|
| 201 |
- |
|
| 202 |
-function append_kernel_cmdline {
|
|
| 203 |
- local vm_name_label |
|
| 204 |
- local kernel_args |
|
| 205 |
- |
|
| 206 |
- vm_name_label="$1" |
|
| 207 |
- kernel_args="$2" |
|
| 208 |
- |
|
| 209 |
- local vm |
|
| 210 |
- local pv_args |
|
| 211 |
- |
|
| 212 |
- vm=$(_vm_uuid "$vm_name_label") |
|
| 213 |
- pv_args=$(xe vm-param-get param-name=PV-args uuid=$vm) |
|
| 214 |
- xe vm-param-set PV-args="$pv_args $kernel_args" uuid=$vm |
|
| 215 |
-} |
|
| 216 |
- |
|
| 217 |
-function destroy_all_vifs_of {
|
|
| 218 |
- local vm_name_label |
|
| 219 |
- |
|
| 220 |
- vm_name_label="$1" |
|
| 221 |
- |
|
| 222 |
- local vm |
|
| 223 |
- |
|
| 224 |
- vm=$(_vm_uuid "$vm_name_label") |
|
| 225 |
- IFS=, |
|
| 226 |
- for vif in $(xe vif-list vm-uuid=$vm --minimal); do |
|
| 227 |
- xe vif-destroy uuid="$vif" |
|
| 228 |
- done |
|
| 229 |
- unset IFS |
|
| 230 |
-} |
|
| 231 |
- |
|
| 232 |
-function have_multiple_hosts {
|
|
| 233 |
- xe host-list --minimal | grep -q "," |
|
| 234 |
-} |
|
| 235 |
- |
|
| 236 |
-function attach_network {
|
|
| 237 |
- local bridge_or_net_name |
|
| 238 |
- |
|
| 239 |
- bridge_or_net_name="$1" |
|
| 240 |
- |
|
| 241 |
- local net |
|
| 242 |
- local host |
|
| 243 |
- |
|
| 244 |
- net=$(_network_uuid "$bridge_or_net_name") |
|
| 245 |
- host=$(xe host-list --minimal) |
|
| 246 |
- |
|
| 247 |
- xe network-attach uuid=$net host-uuid=$host |
|
| 248 |
-} |
|
| 249 |
- |
|
| 250 |
-function set_vm_memory {
|
|
| 251 |
- local vm_name_label |
|
| 252 |
- local memory |
|
| 253 |
- |
|
| 254 |
- vm_name_label="$1" |
|
| 255 |
- memory="$2" |
|
| 256 |
- |
|
| 257 |
- local vm |
|
| 258 |
- |
|
| 259 |
- vm=$(_vm_uuid "$vm_name_label") |
|
| 260 |
- |
|
| 261 |
- xe vm-memory-limits-set \ |
|
| 262 |
- static-min=${memory}MiB \
|
|
| 263 |
- static-max=${memory}MiB \
|
|
| 264 |
- dynamic-min=${memory}MiB \
|
|
| 265 |
- dynamic-max=${memory}MiB \
|
|
| 266 |
- uuid=$vm |
|
| 267 |
-} |
|
| 268 |
- |
|
| 269 |
-function max_vcpus {
|
|
| 270 |
- local vm_name_label |
|
| 271 |
- |
|
| 272 |
- vm_name_label="$1" |
|
| 273 |
- |
|
| 274 |
- local vm |
|
| 275 |
- local host |
|
| 276 |
- local cpu_count |
|
| 277 |
- |
|
| 278 |
- host=$(xe host-list --minimal) |
|
| 279 |
- vm=$(_vm_uuid "$vm_name_label") |
|
| 280 |
- |
|
| 281 |
- cpu_count=$(xe host-param-get \ |
|
| 282 |
- param-name=cpu_info \ |
|
| 283 |
- uuid=$host | |
|
| 284 |
- sed -e 's/^.*cpu_count: \([0-9]*\);.*$/\1/g') |
|
| 285 |
- |
|
| 286 |
- if [ -z "$cpu_count" ]; then |
|
| 287 |
- # get dom0's vcpu count |
|
| 288 |
- cpu_count=$(cat /proc/cpuinfo | grep processor | wc -l) |
|
| 289 |
- fi |
|
| 290 |
- |
|
| 291 |
- # Assert cpu_count is not empty |
|
| 292 |
- [ -n "$cpu_count" ] |
|
| 293 |
- |
|
| 294 |
- # Assert ithas a numeric nonzero value |
|
| 295 |
- expr "$cpu_count" + 0 |
|
| 296 |
- |
|
| 297 |
- # 8 VCPUs should be enough for devstack VM; avoid using too |
|
| 298 |
- # many VCPUs: |
|
| 299 |
- # 1. too many VCPUs may trigger a kernel bug which result VM |
|
| 300 |
- # not able to boot: |
|
| 301 |
- # https://kernel.googlesource.com/pub/scm/linux/kernel/git/wsa/linux/+/e2e004acc7cbe3c531e752a270a74e95cde3ea48 |
|
| 302 |
- # 2. The remaining CPUs can be used for other purpose: |
|
| 303 |
- # e.g. boot test VMs. |
|
| 304 |
- MAX_VCPUS=8 |
|
| 305 |
- if [ $cpu_count -ge $MAX_VCPUS ]; then |
|
| 306 |
- cpu_count=$MAX_VCPUS |
|
| 307 |
- fi |
|
| 308 |
- |
|
| 309 |
- xe vm-param-set uuid=$vm VCPUs-max=$cpu_count |
|
| 310 |
- xe vm-param-set uuid=$vm VCPUs-at-startup=$cpu_count |
|
| 311 |
-} |
|
| 312 |
- |
|
| 313 |
-function get_domid {
|
|
| 314 |
- local vm_name_label |
|
| 315 |
- |
|
| 316 |
- vm_name_label="$1" |
|
| 317 |
- |
|
| 318 |
- xe vm-list name-label="$vm_name_label" params=dom-id minimal=true |
|
| 319 |
-} |
|
| 320 |
- |
|
| 321 |
-function install_conntrack_tools {
|
|
| 322 |
- local xs_host |
|
| 323 |
- local xs_ver_major |
|
| 324 |
- local centos_ver |
|
| 325 |
- local conntrack_conf |
|
| 326 |
- xs_host=$(xe host-list --minimal) |
|
| 327 |
- xs_ver_major=$(xe host-param-get uuid=$xs_host param-name=software-version param-key=product_version_text_short | cut -d'.' -f 1) |
|
| 328 |
- if [ $xs_ver_major -gt 6 ]; then |
|
| 329 |
- # Only support conntrack-tools in Dom0 with XS7.0 and above |
|
| 330 |
- if [ ! -f /usr/sbin/conntrackd ]; then |
|
| 331 |
- sed -i s/#baseurl=/baseurl=/g /etc/yum.repos.d/CentOS-Base.repo |
|
| 332 |
- centos_ver=$(yum version nogroups |grep Installed | cut -d' ' -f 2 | cut -d'/' -f 1 | cut -d'-' -f 1) |
|
| 333 |
- yum install -y --enablerepo=base --releasever=$centos_ver conntrack-tools |
|
| 334 |
- # Backup conntrackd.conf after install conntrack-tools, use the one with statistic mode |
|
| 335 |
- mv /etc/conntrackd/conntrackd.conf /etc/conntrackd/conntrackd.conf.back |
|
| 336 |
- conntrack_conf=$(find /usr/share/doc -name conntrackd.conf |grep stats) |
|
| 337 |
- cp $conntrack_conf /etc/conntrackd/conntrackd.conf |
|
| 338 |
- fi |
|
| 339 |
- service conntrackd restart |
|
| 340 |
- fi |
|
| 341 |
-} |
| 342 | 1 |
deleted file mode 100755 |
| ... | ... |
@@ -1,418 +0,0 @@ |
| 1 |
-#!/bin/bash |
|
| 2 |
- |
|
| 3 |
-# This script must be run on a XenServer or XCP machine |
|
| 4 |
-# |
|
| 5 |
-# It creates a DomU VM that runs OpenStack services |
|
| 6 |
-# |
|
| 7 |
-# For more details see: README.md |
|
| 8 |
- |
|
| 9 |
-set -o errexit |
|
| 10 |
-set -o nounset |
|
| 11 |
-set -o xtrace |
|
| 12 |
- |
|
| 13 |
-export LC_ALL=C |
|
| 14 |
- |
|
| 15 |
-# This directory |
|
| 16 |
-THIS_DIR=$(cd $(dirname "$0") && pwd) |
|
| 17 |
- |
|
| 18 |
-# Include onexit commands |
|
| 19 |
-. $THIS_DIR/scripts/on_exit.sh |
|
| 20 |
- |
|
| 21 |
-# xapi functions |
|
| 22 |
-. $THIS_DIR/functions |
|
| 23 |
- |
|
| 24 |
-# |
|
| 25 |
-# Get Settings |
|
| 26 |
-# |
|
| 27 |
-TOP_DIR=$(cd $THIS_DIR/../../ && pwd) |
|
| 28 |
-source $TOP_DIR/inc/meta-config |
|
| 29 |
-rm -f $TOP_DIR/.localrc.auto |
|
| 30 |
-extract_localrc_section $TOP_DIR/local.conf $TOP_DIR/localrc $TOP_DIR/.localrc.auto |
|
| 31 |
- |
|
| 32 |
-# Source params - override xenrc params in your localrc to suit your taste |
|
| 33 |
-source $THIS_DIR/xenrc |
|
| 34 |
- |
|
| 35 |
-xe_min() |
|
| 36 |
-{
|
|
| 37 |
- local cmd="$1" |
|
| 38 |
- shift |
|
| 39 |
- xe "$cmd" --minimal "$@" |
|
| 40 |
-} |
|
| 41 |
- |
|
| 42 |
-# |
|
| 43 |
-# Prepare Dom0 |
|
| 44 |
-# including installing XenAPI plugins |
|
| 45 |
-# |
|
| 46 |
- |
|
| 47 |
-cd $THIS_DIR |
|
| 48 |
- |
|
| 49 |
-# Die if multiple hosts listed |
|
| 50 |
-if have_multiple_hosts; then |
|
| 51 |
- cat >&2 << EOF |
|
| 52 |
-ERROR: multiple hosts found. This might mean that the XenServer is a member |
|
| 53 |
-of a pool - Exiting. |
|
| 54 |
-EOF |
|
| 55 |
- exit 1 |
|
| 56 |
-fi |
|
| 57 |
- |
|
| 58 |
-# |
|
| 59 |
-# Configure Networking |
|
| 60 |
-# |
|
| 61 |
- |
|
| 62 |
-MGT_NETWORK=`xe pif-list management=true params=network-uuid minimal=true` |
|
| 63 |
-MGT_BRIDGE_OR_NET_NAME=`xe network-list uuid=$MGT_NETWORK params=bridge minimal=true` |
|
| 64 |
- |
|
| 65 |
-setup_network "$VM_BRIDGE_OR_NET_NAME" |
|
| 66 |
-setup_network "$MGT_BRIDGE_OR_NET_NAME" |
|
| 67 |
-setup_network "$PUB_BRIDGE_OR_NET_NAME" |
|
| 68 |
- |
|
| 69 |
-if parameter_is_specified "FLAT_NETWORK_BRIDGE"; then |
|
| 70 |
- if [ "$(bridge_for "$VM_BRIDGE_OR_NET_NAME")" != "$(bridge_for "$FLAT_NETWORK_BRIDGE")" ]; then |
|
| 71 |
- cat >&2 << EOF |
|
| 72 |
-ERROR: FLAT_NETWORK_BRIDGE is specified in localrc file, and either no network |
|
| 73 |
-found on XenServer by searching for networks by that value as name-label or |
|
| 74 |
-bridge name or the network found does not match the network specified by |
|
| 75 |
-VM_BRIDGE_OR_NET_NAME. Please check your localrc file. |
|
| 76 |
-EOF |
|
| 77 |
- exit 1 |
|
| 78 |
- fi |
|
| 79 |
-fi |
|
| 80 |
- |
|
| 81 |
-if ! xenapi_is_listening_on "$MGT_BRIDGE_OR_NET_NAME"; then |
|
| 82 |
- cat >&2 << EOF |
|
| 83 |
-ERROR: XenAPI does not have an assigned IP address on the management network. |
|
| 84 |
-please review your XenServer network configuration / localrc file. |
|
| 85 |
-EOF |
|
| 86 |
- exit 1 |
|
| 87 |
-fi |
|
| 88 |
- |
|
| 89 |
-HOST_IP=$(xenapi_ip_on "$MGT_BRIDGE_OR_NET_NAME") |
|
| 90 |
- |
|
| 91 |
-# Set up ip forwarding, but skip on xcp-xapi |
|
| 92 |
-if [ -a /etc/sysconfig/network ]; then |
|
| 93 |
- if ! grep -q "FORWARD_IPV4=YES" /etc/sysconfig/network; then |
|
| 94 |
- # FIXME: This doesn't work on reboot! |
|
| 95 |
- echo "FORWARD_IPV4=YES" >> /etc/sysconfig/network |
|
| 96 |
- fi |
|
| 97 |
-fi |
|
| 98 |
-# Also, enable ip forwarding in rc.local, since the above trick isn't working |
|
| 99 |
-if ! grep -q "echo 1 >/proc/sys/net/ipv4/ip_forward" /etc/rc.local; then |
|
| 100 |
- echo "echo 1 >/proc/sys/net/ipv4/ip_forward" >> /etc/rc.local |
|
| 101 |
-fi |
|
| 102 |
-# Enable ip forwarding at runtime as well |
|
| 103 |
-echo 1 > /proc/sys/net/ipv4/ip_forward |
|
| 104 |
- |
|
| 105 |
- |
|
| 106 |
-# |
|
| 107 |
-# Shutdown previous runs |
|
| 108 |
-# |
|
| 109 |
- |
|
| 110 |
-DO_SHUTDOWN=${DO_SHUTDOWN:-1}
|
|
| 111 |
-CLEAN_TEMPLATES=${CLEAN_TEMPLATES:-false}
|
|
| 112 |
-if [ "$DO_SHUTDOWN" = "1" ]; then |
|
| 113 |
- # Shutdown all domU's that created previously |
|
| 114 |
- clean_templates_arg="" |
|
| 115 |
- if $CLEAN_TEMPLATES; then |
|
| 116 |
- clean_templates_arg="--remove-templates" |
|
| 117 |
- fi |
|
| 118 |
- ./scripts/uninstall-os-vpx.sh $clean_templates_arg |
|
| 119 |
- |
|
| 120 |
- # Destroy any instances that were launched |
|
| 121 |
- for uuid in `xe vm-list | grep -1 instance | grep uuid | sed "s/.*\: //g"`; do |
|
| 122 |
- echo "Shutting down nova instance $uuid" |
|
| 123 |
- xe vm-uninstall uuid=$uuid force=true |
|
| 124 |
- done |
|
| 125 |
- |
|
| 126 |
- # Destroy orphaned vdis |
|
| 127 |
- for uuid in `xe vdi-list | grep -1 Glance | grep uuid | sed "s/.*\: //g"`; do |
|
| 128 |
- xe vdi-destroy uuid=$uuid |
|
| 129 |
- done |
|
| 130 |
-fi |
|
| 131 |
- |
|
| 132 |
- |
|
| 133 |
-# |
|
| 134 |
-# Create Ubuntu VM template |
|
| 135 |
-# and/or create VM from template |
|
| 136 |
-# |
|
| 137 |
- |
|
| 138 |
-GUEST_NAME=${GUEST_NAME:-"DevStackOSDomU"}
|
|
| 139 |
-TNAME="jeos_template_for_devstack" |
|
| 140 |
-SNAME_TEMPLATE="jeos_snapshot_for_devstack" |
|
| 141 |
-SNAME_FIRST_BOOT="before_first_boot" |
|
| 142 |
- |
|
| 143 |
-function wait_for_VM_to_halt {
|
|
| 144 |
- set +x |
|
| 145 |
- echo "Waiting for the VM to halt. Progress in-VM can be checked with XenCenter or xl console:" |
|
| 146 |
- mgmt_ip=$(echo $XENAPI_CONNECTION_URL | tr -d -c '1234567890.') |
|
| 147 |
- domid=$(get_domid "$GUEST_NAME") |
|
| 148 |
- echo "ssh root@$mgmt_ip \"xl console $domid\"" |
|
| 149 |
- while true; do |
|
| 150 |
- state=$(xe_min vm-list name-label="$GUEST_NAME" power-state=halted) |
|
| 151 |
- if [ -n "$state" ]; then |
|
| 152 |
- break |
|
| 153 |
- else |
|
| 154 |
- echo -n "." |
|
| 155 |
- sleep 20 |
|
| 156 |
- fi |
|
| 157 |
- done |
|
| 158 |
- set -x |
|
| 159 |
-} |
|
| 160 |
- |
|
| 161 |
-templateuuid=$(xe template-list name-label="$TNAME") |
|
| 162 |
-if [ -z "$templateuuid" ]; then |
|
| 163 |
- # |
|
| 164 |
- # Install Ubuntu over network |
|
| 165 |
- # |
|
| 166 |
- UBUNTU_INST_BRIDGE_OR_NET_NAME=${UBUNTU_INST_BRIDGE_OR_NET_NAME:-"$MGT_BRIDGE_OR_NET_NAME"}
|
|
| 167 |
- |
|
| 168 |
- # always update the preseed file, incase we have a newer one |
|
| 169 |
- PRESEED_URL=${PRESEED_URL:-""}
|
|
| 170 |
- if [ -z "$PRESEED_URL" ]; then |
|
| 171 |
- PRESEED_URL="${HOST_IP}/devstackubuntupreseed.cfg"
|
|
| 172 |
- |
|
| 173 |
- HTTP_SERVER_LOCATION="/opt/xensource/www" |
|
| 174 |
- if [ ! -e $HTTP_SERVER_LOCATION ]; then |
|
| 175 |
- HTTP_SERVER_LOCATION="/var/www/html" |
|
| 176 |
- mkdir -p $HTTP_SERVER_LOCATION |
|
| 177 |
- fi |
|
| 178 |
- |
|
| 179 |
- # Copy the tools DEB to the XS web server |
|
| 180 |
- XS_TOOLS_URL="https://github.com/downloads/citrix-openstack/warehouse/xe-guest-utilities_5.6.100-651_amd64.deb" |
|
| 181 |
- ISO_DIR="/opt/xensource/packages/iso" |
|
| 182 |
- if [ -e "$ISO_DIR" ]; then |
|
| 183 |
- TOOLS_ISO=$(ls -1 $ISO_DIR/*-tools-*.iso | head -1) |
|
| 184 |
- TMP_DIR=/tmp/temp.$RANDOM |
|
| 185 |
- mkdir -p $TMP_DIR |
|
| 186 |
- mount -o loop $TOOLS_ISO $TMP_DIR |
|
| 187 |
- # the target deb package maybe *amd64.deb or *all.deb, |
|
| 188 |
- # so use *amd64.deb by default. If it doesn't exist, |
|
| 189 |
- # then use *all.deb. |
|
| 190 |
- DEB_FILE=$(ls $TMP_DIR/Linux/*amd64.deb || ls $TMP_DIR/Linux/*all.deb) |
|
| 191 |
- cp $DEB_FILE $HTTP_SERVER_LOCATION |
|
| 192 |
- umount $TMP_DIR |
|
| 193 |
- rmdir $TMP_DIR |
|
| 194 |
- XS_TOOLS_URL=${HOST_IP}/$(basename $DEB_FILE)
|
|
| 195 |
- fi |
|
| 196 |
- |
|
| 197 |
- cp -f $THIS_DIR/devstackubuntupreseed.cfg $HTTP_SERVER_LOCATION |
|
| 198 |
- cp -f $THIS_DIR/devstackubuntu_latecommand.sh $HTTP_SERVER_LOCATION/latecommand.sh |
|
| 199 |
- |
|
| 200 |
- sed \ |
|
| 201 |
- -e "s,\(d-i mirror/http/hostname string\).*,\1 $UBUNTU_INST_HTTP_HOSTNAME,g" \ |
|
| 202 |
- -e "s,\(d-i mirror/http/directory string\).*,\1 $UBUNTU_INST_HTTP_DIRECTORY,g" \ |
|
| 203 |
- -e "s,\(d-i mirror/http/proxy string\).*,\1 $UBUNTU_INST_HTTP_PROXY,g" \ |
|
| 204 |
- -e "s,\(d-i passwd/root-password password\).*,\1 $GUEST_PASSWORD,g" \ |
|
| 205 |
- -e "s,\(d-i passwd/root-password-again password\).*,\1 $GUEST_PASSWORD,g" \ |
|
| 206 |
- -e "s,\(d-i preseed/late_command string\).*,\1 in-target mkdir -p /tmp; in-target wget --no-proxy ${HOST_IP}/latecommand.sh -O /root/latecommand.sh; in-target bash /root/latecommand.sh,g" \
|
|
| 207 |
- -i "${HTTP_SERVER_LOCATION}/devstackubuntupreseed.cfg"
|
|
| 208 |
- |
|
| 209 |
- sed \ |
|
| 210 |
- -e "s,@XS_TOOLS_URL@,$XS_TOOLS_URL,g" \ |
|
| 211 |
- -i "${HTTP_SERVER_LOCATION}/latecommand.sh"
|
|
| 212 |
- fi |
|
| 213 |
- |
|
| 214 |
- # Update the template |
|
| 215 |
- $THIS_DIR/scripts/install_ubuntu_template.sh $PRESEED_URL |
|
| 216 |
- |
|
| 217 |
- # create a new VM from the given template with eth0 attached to the given |
|
| 218 |
- # network |
|
| 219 |
- $THIS_DIR/scripts/install-os-vpx.sh \ |
|
| 220 |
- -t "$UBUNTU_INST_TEMPLATE_NAME" \ |
|
| 221 |
- -n "$UBUNTU_INST_BRIDGE_OR_NET_NAME" \ |
|
| 222 |
- -l "$GUEST_NAME" |
|
| 223 |
- |
|
| 224 |
- set_vm_memory "$GUEST_NAME" "1024" |
|
| 225 |
- |
|
| 226 |
- xe vm-start vm="$GUEST_NAME" |
|
| 227 |
- |
|
| 228 |
- # wait for install to finish |
|
| 229 |
- wait_for_VM_to_halt |
|
| 230 |
- |
|
| 231 |
- # set VM to restart after a reboot |
|
| 232 |
- vm_uuid=$(xe_min vm-list name-label="$GUEST_NAME") |
|
| 233 |
- xe vm-param-set actions-after-reboot=Restart uuid="$vm_uuid" |
|
| 234 |
- |
|
| 235 |
- # Make template from VM |
|
| 236 |
- snuuid=$(xe vm-snapshot vm="$GUEST_NAME" new-name-label="$SNAME_TEMPLATE") |
|
| 237 |
- xe snapshot-clone uuid=$snuuid new-name-label="$TNAME" |
|
| 238 |
-else |
|
| 239 |
- # |
|
| 240 |
- # Template already installed, create VM from template |
|
| 241 |
- # |
|
| 242 |
- vm_uuid=$(xe vm-install template="$TNAME" new-name-label="$GUEST_NAME") |
|
| 243 |
-fi |
|
| 244 |
- |
|
| 245 |
-if [ -n "${EXIT_AFTER_JEOS_INSTALLATION:-}" ]; then
|
|
| 246 |
- echo "User requested to quit after JEOS installation" |
|
| 247 |
- exit 0 |
|
| 248 |
-fi |
|
| 249 |
- |
|
| 250 |
-# |
|
| 251 |
-# Prepare VM for DevStack |
|
| 252 |
-# |
|
| 253 |
-xe vm-param-set other-config:os-vpx=true uuid="$vm_uuid" |
|
| 254 |
- |
|
| 255 |
-# Install XenServer tools, and other such things |
|
| 256 |
-$THIS_DIR/prepare_guest_template.sh "$GUEST_NAME" |
|
| 257 |
- |
|
| 258 |
-# Set virtual machine parameters |
|
| 259 |
-set_vm_memory "$GUEST_NAME" "$OSDOMU_MEM_MB" |
|
| 260 |
- |
|
| 261 |
-# Max out VCPU count for better performance |
|
| 262 |
-max_vcpus "$GUEST_NAME" |
|
| 263 |
- |
|
| 264 |
-# Wipe out all network cards |
|
| 265 |
-destroy_all_vifs_of "$GUEST_NAME" |
|
| 266 |
- |
|
| 267 |
-# Add only one interface to prepare the guest template |
|
| 268 |
-add_interface "$GUEST_NAME" "$MGT_BRIDGE_OR_NET_NAME" "0" |
|
| 269 |
- |
|
| 270 |
-# start the VM to run the prepare steps |
|
| 271 |
-xe vm-start vm="$GUEST_NAME" |
|
| 272 |
- |
|
| 273 |
-# Wait for prep script to finish and shutdown system |
|
| 274 |
-wait_for_VM_to_halt |
|
| 275 |
- |
|
| 276 |
-## Setup network cards |
|
| 277 |
-# Wipe out all |
|
| 278 |
-destroy_all_vifs_of "$GUEST_NAME" |
|
| 279 |
-# Tenant network |
|
| 280 |
-add_interface "$GUEST_NAME" "$VM_BRIDGE_OR_NET_NAME" "$VM_DEV_NR" |
|
| 281 |
-# Management network |
|
| 282 |
-add_interface "$GUEST_NAME" "$MGT_BRIDGE_OR_NET_NAME" "$MGT_DEV_NR" |
|
| 283 |
-# Public network |
|
| 284 |
-add_interface "$GUEST_NAME" "$PUB_BRIDGE_OR_NET_NAME" "$PUB_DEV_NR" |
|
| 285 |
- |
|
| 286 |
-# |
|
| 287 |
-# Inject DevStack inside VM disk |
|
| 288 |
-# |
|
| 289 |
-$THIS_DIR/build_xva.sh "$GUEST_NAME" |
|
| 290 |
- |
|
| 291 |
-FLAT_NETWORK_BRIDGE="${FLAT_NETWORK_BRIDGE:-$(bridge_for "$VM_BRIDGE_OR_NET_NAME")}"
|
|
| 292 |
-append_kernel_cmdline "$GUEST_NAME" "flat_network_bridge=${FLAT_NETWORK_BRIDGE}"
|
|
| 293 |
- |
|
| 294 |
-# Add a separate xvdb, if it was requested |
|
| 295 |
-if [[ "0" != "$XEN_XVDB_SIZE_GB" ]]; then |
|
| 296 |
- vm=$(xe vm-list name-label="$GUEST_NAME" --minimal) |
|
| 297 |
- |
|
| 298 |
- # Add a new disk |
|
| 299 |
- localsr=$(get_local_sr) |
|
| 300 |
- extra_vdi=$(xe vdi-create \ |
|
| 301 |
- name-label=xvdb-added-by-devstack \ |
|
| 302 |
- virtual-size="${XEN_XVDB_SIZE_GB}GiB" \
|
|
| 303 |
- sr-uuid=$localsr type=user) |
|
| 304 |
- xe vbd-create vm-uuid=$vm vdi-uuid=$extra_vdi device=1 |
|
| 305 |
-fi |
|
| 306 |
- |
|
| 307 |
-# create a snapshot before the first boot |
|
| 308 |
-# to allow a quick re-run with the same settings |
|
| 309 |
-xe vm-snapshot vm="$GUEST_NAME" new-name-label="$SNAME_FIRST_BOOT" |
|
| 310 |
- |
|
| 311 |
-# |
|
| 312 |
-# Run DevStack VM |
|
| 313 |
-# |
|
| 314 |
-xe vm-start vm="$GUEST_NAME" |
|
| 315 |
- |
|
| 316 |
-function ssh_no_check {
|
|
| 317 |
- ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no "$@" |
|
| 318 |
-} |
|
| 319 |
- |
|
| 320 |
-# Get hold of the Management IP of OpenStack VM |
|
| 321 |
-OS_VM_MANAGEMENT_ADDRESS=$MGT_IP |
|
| 322 |
-if [ $OS_VM_MANAGEMENT_ADDRESS == "dhcp" ]; then |
|
| 323 |
- OS_VM_MANAGEMENT_ADDRESS=$(find_ip_by_name $GUEST_NAME $MGT_DEV_NR) |
|
| 324 |
-fi |
|
| 325 |
- |
|
| 326 |
-# Get hold of the Service IP of OpenStack VM |
|
| 327 |
-if [ $HOST_IP_IFACE == "eth${MGT_DEV_NR}" ]; then
|
|
| 328 |
- OS_VM_SERVICES_ADDRESS=$MGT_IP |
|
| 329 |
- if [ $MGT_IP == "dhcp" ]; then |
|
| 330 |
- OS_VM_SERVICES_ADDRESS=$(find_ip_by_name $GUEST_NAME $MGT_DEV_NR) |
|
| 331 |
- fi |
|
| 332 |
-else |
|
| 333 |
- OS_VM_SERVICES_ADDRESS=$PUB_IP |
|
| 334 |
- if [ $PUB_IP == "dhcp" ]; then |
|
| 335 |
- OS_VM_SERVICES_ADDRESS=$(find_ip_by_name $GUEST_NAME $PUB_DEV_NR) |
|
| 336 |
- fi |
|
| 337 |
-fi |
|
| 338 |
- |
|
| 339 |
-# Create an ssh-keypair, and set it up for dom0 user |
|
| 340 |
-rm -f /root/dom0key /root/dom0key.pub |
|
| 341 |
-ssh-keygen -f /root/dom0key -P "" -C "dom0" |
|
| 342 |
-DOMID=$(get_domid "$GUEST_NAME") |
|
| 343 |
- |
|
| 344 |
-xenstore-write /local/domain/$DOMID/authorized_keys/$DOMZERO_USER "$(cat /root/dom0key.pub)" |
|
| 345 |
-xenstore-chmod -u /local/domain/$DOMID/authorized_keys/$DOMZERO_USER r$DOMID |
|
| 346 |
- |
|
| 347 |
-function run_on_appliance {
|
|
| 348 |
- ssh \ |
|
| 349 |
- -i /root/dom0key \ |
|
| 350 |
- -o UserKnownHostsFile=/dev/null \ |
|
| 351 |
- -o StrictHostKeyChecking=no \ |
|
| 352 |
- -o BatchMode=yes \ |
|
| 353 |
- "$DOMZERO_USER@$OS_VM_MANAGEMENT_ADDRESS" "$@" |
|
| 354 |
-} |
|
| 355 |
- |
|
| 356 |
-# Wait until we can log in to the appliance |
|
| 357 |
-while ! run_on_appliance true; do |
|
| 358 |
- sleep 1 |
|
| 359 |
-done |
|
| 360 |
- |
|
| 361 |
-# Remove authenticated_keys updater cronjob |
|
| 362 |
-echo "" | run_on_appliance crontab - |
|
| 363 |
- |
|
| 364 |
-# Generate a passwordless ssh key for domzero user |
|
| 365 |
-echo "ssh-keygen -f /home/$DOMZERO_USER/.ssh/id_rsa -C $DOMZERO_USER@appliance -N \"\" -q" | run_on_appliance |
|
| 366 |
- |
|
| 367 |
-# Authenticate that user to dom0 |
|
| 368 |
-run_on_appliance cat /home/$DOMZERO_USER/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys |
|
| 369 |
- |
|
| 370 |
-# If we have copied our ssh credentials, use ssh to monitor while the installation runs |
|
| 371 |
-WAIT_TILL_LAUNCH=${WAIT_TILL_LAUNCH:-1}
|
|
| 372 |
-COPYENV=${COPYENV:-1}
|
|
| 373 |
-if [ "$WAIT_TILL_LAUNCH" = "1" ] && [ -e ~/.ssh/id_rsa.pub ] && [ "$COPYENV" = "1" ]; then |
|
| 374 |
- set +x |
|
| 375 |
- |
|
| 376 |
- echo "VM Launched - Waiting for run.sh" |
|
| 377 |
- while ! ssh_no_check -q stack@$OS_VM_MANAGEMENT_ADDRESS "test -e /opt/stack/run_sh.pid"; do |
|
| 378 |
- sleep 10 |
|
| 379 |
- done |
|
| 380 |
- echo -n "devstack service is running, waiting for stack.sh to start logging..." |
|
| 381 |
- |
|
| 382 |
- pid=`ssh_no_check -q stack@$OS_VM_MANAGEMENT_ADDRESS "cat /opt/stack/run_sh.pid"` |
|
| 383 |
- if [ -n "$SCREEN_LOGDIR" ]; then |
|
| 384 |
- while ! ssh_no_check -q stack@$OS_VM_MANAGEMENT_ADDRESS "test -e ${SCREEN_LOGDIR}/stack.log"; do
|
|
| 385 |
- sleep 10 |
|
| 386 |
- done |
|
| 387 |
- |
|
| 388 |
- ssh_no_check -q stack@$OS_VM_MANAGEMENT_ADDRESS "tail --pid $pid -n +1 -f ${SCREEN_LOGDIR}/stack.log"
|
|
| 389 |
- else |
|
| 390 |
- echo -n "SCREEN_LOGDIR not set; just waiting for process $pid to finish" |
|
| 391 |
- ssh_no_check -q stack@$OS_VM_MANAGEMENT_ADDRESS "wait $pid" |
|
| 392 |
- fi |
|
| 393 |
- |
|
| 394 |
- set -x |
|
| 395 |
- # Fail if devstack did not succeed |
|
| 396 |
- ssh_no_check -q stack@$OS_VM_MANAGEMENT_ADDRESS 'test -e /opt/stack/runsh.succeeded' |
|
| 397 |
- |
|
| 398 |
- set +x |
|
| 399 |
- echo "################################################################################" |
|
| 400 |
- echo "" |
|
| 401 |
- echo "All Finished!" |
|
| 402 |
- echo "You can visit the OpenStack Dashboard" |
|
| 403 |
- echo "at http://$OS_VM_SERVICES_ADDRESS, and contact other services at the usual ports." |
|
| 404 |
-else |
|
| 405 |
- set +x |
|
| 406 |
- echo "################################################################################" |
|
| 407 |
- echo "" |
|
| 408 |
- echo "All Finished!" |
|
| 409 |
- echo "Now, you can monitor the progress of the stack.sh installation by " |
|
| 410 |
- echo "looking at the console of your domU / checking the log files." |
|
| 411 |
- echo "" |
|
| 412 |
- echo "ssh into your domU now: 'ssh stack@$OS_VM_MANAGEMENT_ADDRESS' using your password" |
|
| 413 |
- echo "and then do: 'sudo systemctl status devstack' to check if devstack is still running." |
|
| 414 |
- echo "Check that /opt/stack/runsh.succeeded exists" |
|
| 415 |
- echo "" |
|
| 416 |
- echo "When devstack completes, you can visit the OpenStack Dashboard" |
|
| 417 |
- echo "at http://$OS_VM_SERVICES_ADDRESS, and contact other services at the usual ports." |
|
| 418 |
-fi |
| 419 | 1 |
deleted file mode 100644 |
| ... | ... |
@@ -1,92 +0,0 @@ |
| 1 |
-#!/bin/bash |
|
| 2 |
- |
|
| 3 |
-test ! -e "$LIST_OF_ACTIONS" && {
|
|
| 4 |
- echo "Mocking is not set up properly." |
|
| 5 |
- echo "LIST_OF_ACTIONS should point to an existing file." |
|
| 6 |
- exit 1 |
|
| 7 |
-} |
|
| 8 |
- |
|
| 9 |
-test ! -e "$LIST_OF_DIRECTORIES" && {
|
|
| 10 |
- echo "Mocking is not set up properly." |
|
| 11 |
- echo "LIST_OF_DIRECTORIES should point to an existing file." |
|
| 12 |
- exit 1 |
|
| 13 |
-} |
|
| 14 |
- |
|
| 15 |
-test ! -e "$XE_RESPONSE" && {
|
|
| 16 |
- echo "Mocking is not set up properly." |
|
| 17 |
- echo "XE_RESPONSE should point to an existing file." |
|
| 18 |
- exit 1 |
|
| 19 |
-} |
|
| 20 |
- |
|
| 21 |
-test ! -e "$XE_CALLS" && {
|
|
| 22 |
- echo "Mocking is not set up properly." |
|
| 23 |
- echo "XE_CALLS should point to an existing file." |
|
| 24 |
- exit 1 |
|
| 25 |
-} |
|
| 26 |
- |
|
| 27 |
-function mktemp {
|
|
| 28 |
- if test "${1:-}" = "-d";
|
|
| 29 |
- then |
|
| 30 |
- echo "tempdir" |
|
| 31 |
- else |
|
| 32 |
- echo "tempfile" |
|
| 33 |
- fi |
|
| 34 |
-} |
|
| 35 |
- |
|
| 36 |
-function wget {
|
|
| 37 |
- if [[ $@ =~ "failurl" ]]; then |
|
| 38 |
- return 1 |
|
| 39 |
- fi |
|
| 40 |
- echo "wget $@" >> $LIST_OF_ACTIONS |
|
| 41 |
-} |
|
| 42 |
- |
|
| 43 |
-function mkdir {
|
|
| 44 |
- if test "${1:-}" = "-p";
|
|
| 45 |
- then |
|
| 46 |
- echo "$2" >> $LIST_OF_DIRECTORIES |
|
| 47 |
- fi |
|
| 48 |
-} |
|
| 49 |
- |
|
| 50 |
-function unzip {
|
|
| 51 |
- echo "Random rubbish from unzip" |
|
| 52 |
- echo "unzip $@" >> $LIST_OF_ACTIONS |
|
| 53 |
-} |
|
| 54 |
- |
|
| 55 |
-function rm {
|
|
| 56 |
- echo "rm $@" >> $LIST_OF_ACTIONS |
|
| 57 |
-} |
|
| 58 |
- |
|
| 59 |
-function ln {
|
|
| 60 |
- echo "ln $@" >> $LIST_OF_ACTIONS |
|
| 61 |
-} |
|
| 62 |
- |
|
| 63 |
-function [ {
|
|
| 64 |
- if test "${1:-}" = "-d";
|
|
| 65 |
- then |
|
| 66 |
- echo "[ $@" >> $LIST_OF_ACTIONS |
|
| 67 |
- for directory in $(cat $LIST_OF_DIRECTORIES) |
|
| 68 |
- do |
|
| 69 |
- if test "$directory" = "$2" |
|
| 70 |
- then |
|
| 71 |
- return 0 |
|
| 72 |
- fi |
|
| 73 |
- done |
|
| 74 |
- return 1 |
|
| 75 |
- fi |
|
| 76 |
- echo "Mock test does not implement the requested function: ${1:-}"
|
|
| 77 |
- exit 1 |
|
| 78 |
-} |
|
| 79 |
- |
|
| 80 |
-function die_with_error {
|
|
| 81 |
- echo "$1" >> $DEAD_MESSAGES |
|
| 82 |
-} |
|
| 83 |
- |
|
| 84 |
-function xe {
|
|
| 85 |
- cat $XE_RESPONSE |
|
| 86 |
- {
|
|
| 87 |
- for i in $(seq "$#") |
|
| 88 |
- do |
|
| 89 |
- eval "echo \"\$$i\"" |
|
| 90 |
- done |
|
| 91 |
- } >> $XE_CALLS |
|
| 92 |
-} |
| 93 | 1 |
deleted file mode 100755 |
| ... | ... |
@@ -1,123 +0,0 @@ |
| 1 |
-#!/bin/bash |
|
| 2 |
- |
|
| 3 |
-# This script is run on an Ubuntu VM. |
|
| 4 |
-# This script is inserted into the VM by prepare_guest_template.sh |
|
| 5 |
-# and is run when that VM boots. |
|
| 6 |
-# It customizes a fresh Ubuntu install, so it is ready |
|
| 7 |
-# to run stack.sh |
|
| 8 |
-# |
|
| 9 |
-# This includes installing the XenServer tools, |
|
| 10 |
-# creating the user called "stack", |
|
| 11 |
-# and shuts down the VM to signal the script has completed |
|
| 12 |
- |
|
| 13 |
-set -o errexit |
|
| 14 |
-set -o nounset |
|
| 15 |
-set -o xtrace |
|
| 16 |
- |
|
| 17 |
-# Configurable nuggets |
|
| 18 |
-GUEST_PASSWORD="$1" |
|
| 19 |
-STACK_USER="$2" |
|
| 20 |
-DOMZERO_USER="$3" |
|
| 21 |
- |
|
| 22 |
- |
|
| 23 |
-function setup_domzero_user {
|
|
| 24 |
- local username |
|
| 25 |
- |
|
| 26 |
- username="$1" |
|
| 27 |
- |
|
| 28 |
- local key_updater_script |
|
| 29 |
- local sudoers_file |
|
| 30 |
- key_updater_script="/home/$username/update_authorized_keys.sh" |
|
| 31 |
- sudoers_file="/etc/sudoers.d/allow_$username" |
|
| 32 |
- |
|
| 33 |
- # Create user |
|
| 34 |
- adduser --disabled-password --quiet "$username" --gecos "$username" |
|
| 35 |
- |
|
| 36 |
- # Give passwordless sudo |
|
| 37 |
- cat > $sudoers_file << EOF |
|
| 38 |
- $username ALL = NOPASSWD: ALL |
|
| 39 |
-EOF |
|
| 40 |
- chmod 0440 $sudoers_file |
|
| 41 |
- |
|
| 42 |
- # A script to populate this user's authenticated_keys from xenstore |
|
| 43 |
- cat > $key_updater_script << EOF |
|
| 44 |
-#!/bin/bash |
|
| 45 |
-set -eux |
|
| 46 |
- |
|
| 47 |
-DOMID=\$(sudo xenstore-read domid) |
|
| 48 |
-sudo xenstore-exists /local/domain/\$DOMID/authorized_keys/$username |
|
| 49 |
-sudo xenstore-read /local/domain/\$DOMID/authorized_keys/$username > /home/$username/xenstore_value |
|
| 50 |
-cat /home/$username/xenstore_value > /home/$username/.ssh/authorized_keys |
|
| 51 |
-EOF |
|
| 52 |
- |
|
| 53 |
- # Give the key updater to the user |
|
| 54 |
- chown $username:$username $key_updater_script |
|
| 55 |
- chmod 0700 $key_updater_script |
|
| 56 |
- |
|
| 57 |
- # Setup the .ssh folder |
|
| 58 |
- mkdir -p /home/$username/.ssh |
|
| 59 |
- chown $username:$username /home/$username/.ssh |
|
| 60 |
- chmod 0700 /home/$username/.ssh |
|
| 61 |
- touch /home/$username/.ssh/authorized_keys |
|
| 62 |
- chown $username:$username /home/$username/.ssh/authorized_keys |
|
| 63 |
- chmod 0600 /home/$username/.ssh/authorized_keys |
|
| 64 |
- |
|
| 65 |
- # Setup the key updater as a cron job |
|
| 66 |
- crontab -u $username - << EOF |
|
| 67 |
-* * * * * $key_updater_script |
|
| 68 |
-EOF |
|
| 69 |
- |
|
| 70 |
-} |
|
| 71 |
- |
|
| 72 |
-# Make a small cracklib dictionary, so that passwd still works, but we don't |
|
| 73 |
-# have the big dictionary. |
|
| 74 |
-mkdir -p /usr/share/cracklib |
|
| 75 |
-echo a | cracklib-packer |
|
| 76 |
- |
|
| 77 |
-# Make /etc/shadow, and set the root password |
|
| 78 |
-pwconv |
|
| 79 |
-echo "root:$GUEST_PASSWORD" | chpasswd |
|
| 80 |
- |
|
| 81 |
-# Put the VPX into UTC. |
|
| 82 |
-rm -f /etc/localtime |
|
| 83 |
- |
|
| 84 |
-# Add stack user |
|
| 85 |
-groupadd libvirtd |
|
| 86 |
-useradd $STACK_USER -s /bin/bash -d /opt/stack -G libvirtd |
|
| 87 |
-echo $STACK_USER:$GUEST_PASSWORD | chpasswd |
|
| 88 |
-echo "$STACK_USER ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers |
|
| 89 |
- |
|
| 90 |
-setup_domzero_user "$DOMZERO_USER" |
|
| 91 |
- |
|
| 92 |
-# Add an udev rule, so that new block devices could be written by stack user |
|
| 93 |
-cat > /etc/udev/rules.d/50-openstack-blockdev.rules << EOF |
|
| 94 |
-KERNEL=="xvd[b-z]", GROUP="$STACK_USER", MODE="0660" |
|
| 95 |
-EOF |
|
| 96 |
- |
|
| 97 |
-# Give ownership of /opt/stack to stack user |
|
| 98 |
-chown -R $STACK_USER /opt/stack |
|
| 99 |
- |
|
| 100 |
-function setup_vimrc {
|
|
| 101 |
- if [ ! -e $1 ]; then |
|
| 102 |
- # Simple but usable vimrc |
|
| 103 |
- cat > $1 <<EOF |
|
| 104 |
-se ts=4 |
|
| 105 |
-se expandtab |
|
| 106 |
-se shiftwidth=4 |
|
| 107 |
-EOF |
|
| 108 |
- fi |
|
| 109 |
-} |
|
| 110 |
- |
|
| 111 |
-# Setup simple .vimrcs |
|
| 112 |
-setup_vimrc /root/.vimrc |
|
| 113 |
-setup_vimrc /opt/stack/.vimrc |
|
| 114 |
- |
|
| 115 |
-# remove self from local.rc |
|
| 116 |
-# so this script is not run again |
|
| 117 |
-rm -rf /etc/rc.local |
|
| 118 |
- |
|
| 119 |
-# Restore rc.local file |
|
| 120 |
-cp /etc/rc.local.preparebackup /etc/rc.local |
|
| 121 |
- |
|
| 122 |
-# shutdown to notify we are done |
|
| 123 |
-shutdown -h now |
| 124 | 1 |
deleted file mode 100755 |
| ... | ... |
@@ -1,94 +0,0 @@ |
| 1 |
-#!/bin/bash |
|
| 2 |
- |
|
| 3 |
-# This script is run by install_os_domU.sh |
|
| 4 |
-# |
|
| 5 |
-# Parameters: |
|
| 6 |
-# - $GUEST_NAME - hostname for the DomU VM |
|
| 7 |
-# |
|
| 8 |
-# It modifies the ubuntu image created by install_os_domU.sh |
|
| 9 |
-# |
|
| 10 |
-# This script is responsible for cusomtizing the fresh ubuntu |
|
| 11 |
-# image so on boot it runs the prepare_guest.sh script |
|
| 12 |
-# that modifies the VM so it is ready to run stack.sh. |
|
| 13 |
-# It does this by mounting the disk image of the VM. |
|
| 14 |
-# |
|
| 15 |
-# The resultant image is started by install_os_domU.sh, |
|
| 16 |
-# and once the VM has shutdown, build_xva.sh is run |
|
| 17 |
- |
|
| 18 |
-set -o errexit |
|
| 19 |
-set -o nounset |
|
| 20 |
-set -o xtrace |
|
| 21 |
- |
|
| 22 |
-# This directory |
|
| 23 |
-TOP_DIR=$(cd $(dirname "$0") && pwd) |
|
| 24 |
- |
|
| 25 |
-# Include onexit commands |
|
| 26 |
-. $TOP_DIR/scripts/on_exit.sh |
|
| 27 |
- |
|
| 28 |
-# xapi functions |
|
| 29 |
-. $TOP_DIR/functions |
|
| 30 |
- |
|
| 31 |
-# Source params - override xenrc params in your localrc to suite your taste |
|
| 32 |
-source xenrc |
|
| 33 |
- |
|
| 34 |
-# |
|
| 35 |
-# Parameters |
|
| 36 |
-# |
|
| 37 |
-GUEST_NAME="$1" |
|
| 38 |
- |
|
| 39 |
-# Mount the VDI |
|
| 40 |
-STAGING_DIR=$($TOP_DIR/scripts/manage-vdi open $GUEST_NAME 0 1 | grep -o "/tmp/tmp.[[:alnum:]]*") |
|
| 41 |
-add_on_exit "$TOP_DIR/scripts/manage-vdi close $GUEST_NAME 0 1" |
|
| 42 |
- |
|
| 43 |
-# Make sure we have a stage |
|
| 44 |
-if [ ! -d $STAGING_DIR/etc ]; then |
|
| 45 |
- echo "Stage is not properly set up!" |
|
| 46 |
- exit 1 |
|
| 47 |
-fi |
|
| 48 |
- |
|
| 49 |
-# Copy prepare_guest.sh to VM |
|
| 50 |
-mkdir -p $STAGING_DIR/opt/stack/ |
|
| 51 |
-cp $TOP_DIR/prepare_guest.sh $STAGING_DIR/opt/stack/prepare_guest.sh |
|
| 52 |
- |
|
| 53 |
-# backup rc.local |
|
| 54 |
-cp $STAGING_DIR/etc/rc.local $STAGING_DIR/etc/rc.local.preparebackup |
|
| 55 |
- |
|
| 56 |
-# run prepare_guest.sh on boot |
|
| 57 |
-cat <<EOF >$STAGING_DIR/etc/rc.local |
|
| 58 |
-#!/bin/sh -e |
|
| 59 |
-bash /opt/stack/prepare_guest.sh \\ |
|
| 60 |
- "$GUEST_PASSWORD" "$STACK_USER" "$DOMZERO_USER" \\ |
|
| 61 |
- > /opt/stack/prepare_guest.log 2>&1 |
|
| 62 |
-EOF |
|
| 63 |
- |
|
| 64 |
-# Update ubuntu repositories |
|
| 65 |
-cat > $STAGING_DIR/etc/apt/sources.list << EOF |
|
| 66 |
-deb http://${UBUNTU_INST_HTTP_HOSTNAME}${UBUNTU_INST_HTTP_DIRECTORY} ${UBUNTU_INST_RELEASE} main restricted
|
|
| 67 |
-deb-src http://${UBUNTU_INST_HTTP_HOSTNAME}${UBUNTU_INST_HTTP_DIRECTORY} ${UBUNTU_INST_RELEASE} main restricted
|
|
| 68 |
-deb http://${UBUNTU_INST_HTTP_HOSTNAME}${UBUNTU_INST_HTTP_DIRECTORY} ${UBUNTU_INST_RELEASE}-updates main restricted
|
|
| 69 |
-deb-src http://${UBUNTU_INST_HTTP_HOSTNAME}${UBUNTU_INST_HTTP_DIRECTORY} ${UBUNTU_INST_RELEASE}-updates main restricted
|
|
| 70 |
-deb http://${UBUNTU_INST_HTTP_HOSTNAME}${UBUNTU_INST_HTTP_DIRECTORY} ${UBUNTU_INST_RELEASE} universe
|
|
| 71 |
-deb-src http://${UBUNTU_INST_HTTP_HOSTNAME}${UBUNTU_INST_HTTP_DIRECTORY} ${UBUNTU_INST_RELEASE} universe
|
|
| 72 |
-deb http://${UBUNTU_INST_HTTP_HOSTNAME}${UBUNTU_INST_HTTP_DIRECTORY} ${UBUNTU_INST_RELEASE}-updates universe
|
|
| 73 |
-deb-src http://${UBUNTU_INST_HTTP_HOSTNAME}${UBUNTU_INST_HTTP_DIRECTORY} ${UBUNTU_INST_RELEASE}-updates universe
|
|
| 74 |
-deb http://${UBUNTU_INST_HTTP_HOSTNAME}${UBUNTU_INST_HTTP_DIRECTORY} ${UBUNTU_INST_RELEASE} multiverse
|
|
| 75 |
-deb-src http://${UBUNTU_INST_HTTP_HOSTNAME}${UBUNTU_INST_HTTP_DIRECTORY} ${UBUNTU_INST_RELEASE} multiverse
|
|
| 76 |
-deb http://${UBUNTU_INST_HTTP_HOSTNAME}${UBUNTU_INST_HTTP_DIRECTORY} ${UBUNTU_INST_RELEASE}-updates multiverse
|
|
| 77 |
-deb-src http://${UBUNTU_INST_HTTP_HOSTNAME}${UBUNTU_INST_HTTP_DIRECTORY} ${UBUNTU_INST_RELEASE}-updates multiverse
|
|
| 78 |
-deb http://${UBUNTU_INST_HTTP_HOSTNAME}${UBUNTU_INST_HTTP_DIRECTORY} ${UBUNTU_INST_RELEASE}-backports main restricted universe multiverse
|
|
| 79 |
-deb-src http://${UBUNTU_INST_HTTP_HOSTNAME}${UBUNTU_INST_HTTP_DIRECTORY} ${UBUNTU_INST_RELEASE}-backports main restricted universe multiverse
|
|
| 80 |
- |
|
| 81 |
-deb http://security.ubuntu.com/ubuntu ${UBUNTU_INST_RELEASE}-security main restricted
|
|
| 82 |
-deb-src http://security.ubuntu.com/ubuntu ${UBUNTU_INST_RELEASE}-security main restricted
|
|
| 83 |
-deb http://security.ubuntu.com/ubuntu ${UBUNTU_INST_RELEASE}-security universe
|
|
| 84 |
-deb-src http://security.ubuntu.com/ubuntu ${UBUNTU_INST_RELEASE}-security universe
|
|
| 85 |
-deb http://security.ubuntu.com/ubuntu ${UBUNTU_INST_RELEASE}-security multiverse
|
|
| 86 |
-deb-src http://security.ubuntu.com/ubuntu ${UBUNTU_INST_RELEASE}-security multiverse
|
|
| 87 |
-EOF |
|
| 88 |
- |
|
| 89 |
-rm -f $STAGING_DIR/etc/apt/apt.conf |
|
| 90 |
-if [ -n "$UBUNTU_INST_HTTP_PROXY" ]; then |
|
| 91 |
- cat > $STAGING_DIR/etc/apt/apt.conf << EOF |
|
| 92 |
-Acquire::http::Proxy "$UBUNTU_INST_HTTP_PROXY"; |
|
| 93 |
-EOF |
|
| 94 |
-fi |
| 95 | 1 |
deleted file mode 100755 |
| ... | ... |
@@ -1,135 +0,0 @@ |
| 1 |
-#!/bin/bash |
|
| 2 |
-# |
|
| 3 |
-# Copyright (c) 2011 Citrix Systems, Inc. |
|
| 4 |
-# Copyright 2011 OpenStack Foundation |
|
| 5 |
-# All Rights Reserved. |
|
| 6 |
-# |
|
| 7 |
-# Licensed under the Apache License, Version 2.0 (the "License"); you may |
|
| 8 |
-# not use this file except in compliance with the License. You may obtain |
|
| 9 |
-# a copy of the License at |
|
| 10 |
-# |
|
| 11 |
-# http://www.apache.org/licenses/LICENSE-2.0 |
|
| 12 |
-# |
|
| 13 |
-# Unless required by applicable law or agreed to in writing, software |
|
| 14 |
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
|
| 15 |
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
|
| 16 |
-# License for the specific language governing permissions and limitations |
|
| 17 |
-# under the License. |
|
| 18 |
-# |
|
| 19 |
- |
|
| 20 |
-set -eux |
|
| 21 |
- |
|
| 22 |
-BRIDGE= |
|
| 23 |
-NAME_LABEL= |
|
| 24 |
-TEMPLATE_NAME= |
|
| 25 |
- |
|
| 26 |
-usage() |
|
| 27 |
-{
|
|
| 28 |
-cat << EOF |
|
| 29 |
- |
|
| 30 |
- Usage: $0 -t TEMPLATE_NW_INSTALL -l NAME_LABEL [-n BRIDGE] |
|
| 31 |
- |
|
| 32 |
- Install a VM from a template |
|
| 33 |
- |
|
| 34 |
- OPTIONS: |
|
| 35 |
- |
|
| 36 |
- -h Shows this message. |
|
| 37 |
- -t template VM template to use |
|
| 38 |
- -l name Specifies the name label for the VM. |
|
| 39 |
- -n bridge The bridge/network to use for eth0. Defaults to xenbr0 |
|
| 40 |
-EOF |
|
| 41 |
-} |
|
| 42 |
- |
|
| 43 |
-get_params() |
|
| 44 |
-{
|
|
| 45 |
- while getopts "hbn:r:l:t:" OPTION; do |
|
| 46 |
- case $OPTION in |
|
| 47 |
- h) usage |
|
| 48 |
- exit 1 |
|
| 49 |
- ;; |
|
| 50 |
- n) |
|
| 51 |
- BRIDGE=$OPTARG |
|
| 52 |
- ;; |
|
| 53 |
- l) |
|
| 54 |
- NAME_LABEL=$OPTARG |
|
| 55 |
- ;; |
|
| 56 |
- t) |
|
| 57 |
- TEMPLATE_NAME=$OPTARG |
|
| 58 |
- ;; |
|
| 59 |
- ?) |
|
| 60 |
- usage |
|
| 61 |
- exit |
|
| 62 |
- ;; |
|
| 63 |
- esac |
|
| 64 |
- done |
|
| 65 |
- if [[ -z $BRIDGE ]]; then |
|
| 66 |
- BRIDGE=xenbr0 |
|
| 67 |
- fi |
|
| 68 |
- |
|
| 69 |
- if [[ -z $TEMPLATE_NAME ]]; then |
|
| 70 |
- echo "Please specify a template name" >&2 |
|
| 71 |
- exit 1 |
|
| 72 |
- fi |
|
| 73 |
- |
|
| 74 |
- if [[ -z $NAME_LABEL ]]; then |
|
| 75 |
- echo "Please specify a name-label for the new VM" >&2 |
|
| 76 |
- exit 1 |
|
| 77 |
- fi |
|
| 78 |
-} |
|
| 79 |
- |
|
| 80 |
- |
|
| 81 |
-xe_min() |
|
| 82 |
-{
|
|
| 83 |
- local cmd="$1" |
|
| 84 |
- shift |
|
| 85 |
- xe "$cmd" --minimal "$@" |
|
| 86 |
-} |
|
| 87 |
- |
|
| 88 |
- |
|
| 89 |
-find_network() |
|
| 90 |
-{
|
|
| 91 |
- result=$(xe_min network-list bridge="$1") |
|
| 92 |
- if [ "$result" = "" ]; then |
|
| 93 |
- result=$(xe_min network-list name-label="$1") |
|
| 94 |
- fi |
|
| 95 |
- echo "$result" |
|
| 96 |
-} |
|
| 97 |
- |
|
| 98 |
- |
|
| 99 |
-create_vif() |
|
| 100 |
-{
|
|
| 101 |
- local v="$1" |
|
| 102 |
- echo "Installing VM interface on [$BRIDGE]" |
|
| 103 |
- local out_network_uuid |
|
| 104 |
- out_network_uuid=$(find_network "$BRIDGE") |
|
| 105 |
- xe vif-create vm-uuid="$v" network-uuid="$out_network_uuid" device="0" |
|
| 106 |
-} |
|
| 107 |
- |
|
| 108 |
- |
|
| 109 |
- |
|
| 110 |
-# Make the VM auto-start on server boot. |
|
| 111 |
-set_auto_start() |
|
| 112 |
-{
|
|
| 113 |
- local v="$1" |
|
| 114 |
- xe vm-param-set uuid="$v" other-config:auto_poweron=true |
|
| 115 |
-} |
|
| 116 |
- |
|
| 117 |
- |
|
| 118 |
-destroy_vifs() |
|
| 119 |
-{
|
|
| 120 |
- local v="$1" |
|
| 121 |
- IFS=, |
|
| 122 |
- for vif in $(xe_min vif-list vm-uuid="$v"); do |
|
| 123 |
- xe vif-destroy uuid="$vif" |
|
| 124 |
- done |
|
| 125 |
- unset IFS |
|
| 126 |
-} |
|
| 127 |
- |
|
| 128 |
- |
|
| 129 |
-get_params "$@" |
|
| 130 |
- |
|
| 131 |
-vm_uuid=$(xe_min vm-install template="$TEMPLATE_NAME" new-name-label="$NAME_LABEL") |
|
| 132 |
-destroy_vifs "$vm_uuid" |
|
| 133 |
-set_auto_start "$vm_uuid" |
|
| 134 |
-create_vif "$vm_uuid" |
|
| 135 |
-xe vm-param-set actions-after-reboot=Destroy uuid="$vm_uuid" |
| 136 | 1 |
deleted file mode 100755 |
| ... | ... |
@@ -1,84 +0,0 @@ |
| 1 |
-#!/bin/bash |
|
| 2 |
-# |
|
| 3 |
-# This creates an Ubuntu Server 32bit or 64bit template |
|
| 4 |
-# on Xenserver 5.6.x, 6.0.x and 6.1.x |
|
| 5 |
-# The template does a net install only |
|
| 6 |
-# |
|
| 7 |
-# Based on a script by: David Markey <david.markey@citrix.com> |
|
| 8 |
-# |
|
| 9 |
- |
|
| 10 |
-set -o errexit |
|
| 11 |
-set -o nounset |
|
| 12 |
-set -o xtrace |
|
| 13 |
- |
|
| 14 |
-# This directory |
|
| 15 |
-BASE_DIR=$(cd $(dirname "$0") && pwd) |
|
| 16 |
- |
|
| 17 |
-# For default setings see xenrc |
|
| 18 |
-source $BASE_DIR/../xenrc |
|
| 19 |
- |
|
| 20 |
-# Get the params |
|
| 21 |
-preseed_url=$1 |
|
| 22 |
- |
|
| 23 |
-# Delete template or skip template creation as required |
|
| 24 |
-previous_template=$(xe template-list name-label="$UBUNTU_INST_TEMPLATE_NAME" \ |
|
| 25 |
- params=uuid --minimal) |
|
| 26 |
-if [ -n "$previous_template" ]; then |
|
| 27 |
- if $CLEAN_TEMPLATES; then |
|
| 28 |
- xe template-param-clear param-name=other-config uuid=$previous_template |
|
| 29 |
- xe template-uninstall template-uuid=$previous_template force=true |
|
| 30 |
- else |
|
| 31 |
- echo "Template $UBUNTU_INST_TEMPLATE_NAME already present" |
|
| 32 |
- exit 0 |
|
| 33 |
- fi |
|
| 34 |
-fi |
|
| 35 |
- |
|
| 36 |
-# Get built-in template |
|
| 37 |
-builtin_name="Debian Squeeze 6.0 (32-bit)" |
|
| 38 |
-builtin_uuid=$(xe template-list name-label="$builtin_name" --minimal) |
|
| 39 |
-if [[ -z $builtin_uuid ]]; then |
|
| 40 |
- echo "Can't find the Debian Squeeze 32bit template on your XenServer." |
|
| 41 |
- exit 1 |
|
| 42 |
-fi |
|
| 43 |
- |
|
| 44 |
-# Clone built-in template to create new template |
|
| 45 |
-new_uuid=$(xe vm-clone uuid=$builtin_uuid \ |
|
| 46 |
- new-name-label="$UBUNTU_INST_TEMPLATE_NAME") |
|
| 47 |
-disk_size=$(($OSDOMU_VDI_GB * 1024 * 1024 * 1024)) |
|
| 48 |
- |
|
| 49 |
-# Some of these settings can be found in example preseed files |
|
| 50 |
-# however these need to be answered before the netinstall |
|
| 51 |
-# is ready to fetch the preseed file, and as such must be here |
|
| 52 |
-# to get a fully automated install |
|
| 53 |
-pvargs="quiet console=hvc0 partman/default_filesystem=ext3 \ |
|
| 54 |
-console-setup/ask_detect=false locale=${UBUNTU_INST_LOCALE} \
|
|
| 55 |
-keyboard-configuration/layoutcode=${UBUNTU_INST_KEYBOARD} \
|
|
| 56 |
-netcfg/choose_interface=eth0 \ |
|
| 57 |
-netcfg/get_hostname=os netcfg/get_domain=os auto \ |
|
| 58 |
-url=${preseed_url}"
|
|
| 59 |
- |
|
| 60 |
-if [ "$UBUNTU_INST_IP" != "dhcp" ]; then |
|
| 61 |
- netcfgargs="netcfg/disable_autoconfig=true \ |
|
| 62 |
-netcfg/get_nameservers=${UBUNTU_INST_NAMESERVERS} \
|
|
| 63 |
-netcfg/get_ipaddress=${UBUNTU_INST_IP} \
|
|
| 64 |
-netcfg/get_netmask=${UBUNTU_INST_NETMASK} \
|
|
| 65 |
-netcfg/get_gateway=${UBUNTU_INST_GATEWAY} \
|
|
| 66 |
-netcfg/confirm_static=true" |
|
| 67 |
- pvargs="${pvargs} ${netcfgargs}"
|
|
| 68 |
-fi |
|
| 69 |
- |
|
| 70 |
-xe template-param-set uuid=$new_uuid \ |
|
| 71 |
- other-config:install-methods=http \ |
|
| 72 |
- other-config:install-repository="http://${UBUNTU_INST_HTTP_HOSTNAME}${UBUNTU_INST_HTTP_DIRECTORY}" \
|
|
| 73 |
- PV-args="$pvargs" \ |
|
| 74 |
- other-config:debian-release="$UBUNTU_INST_RELEASE" \ |
|
| 75 |
- other-config:default_template=true \ |
|
| 76 |
- other-config:disks='<provision><disk device="0" size="'$disk_size'" sr="" bootable="true" type="system"/></provision>' \ |
|
| 77 |
- other-config:install-arch="$UBUNTU_INST_ARCH" |
|
| 78 |
- |
|
| 79 |
-if ! [ -z "$UBUNTU_INST_HTTP_PROXY" ]; then |
|
| 80 |
- xe template-param-set uuid=$new_uuid \ |
|
| 81 |
- other-config:install-proxy="$UBUNTU_INST_HTTP_PROXY" |
|
| 82 |
-fi |
|
| 83 |
- |
|
| 84 |
-echo "Ubuntu template installed uuid:$new_uuid" |
| 85 | 1 |
deleted file mode 100755 |
| ... | ... |
@@ -1,96 +0,0 @@ |
| 1 |
-#!/bin/bash |
|
| 2 |
- |
|
| 3 |
-set -eux |
|
| 4 |
- |
|
| 5 |
-action="$1" |
|
| 6 |
-vm="$2" |
|
| 7 |
-device="${3-0}"
|
|
| 8 |
-part="${4-}"
|
|
| 9 |
- |
|
| 10 |
-function xe_min() {
|
|
| 11 |
- local cmd="$1" |
|
| 12 |
- shift |
|
| 13 |
- xe "$cmd" --minimal "$@" |
|
| 14 |
-} |
|
| 15 |
- |
|
| 16 |
-function run_udev_settle() {
|
|
| 17 |
- which_udev=$(which udevsettle) || true |
|
| 18 |
- if [ -n "$which_udev" ]; then |
|
| 19 |
- udevsettle |
|
| 20 |
- else |
|
| 21 |
- udevadm settle |
|
| 22 |
- fi |
|
| 23 |
-} |
|
| 24 |
- |
|
| 25 |
-vm_uuid=$(xe_min vm-list name-label="$vm") |
|
| 26 |
-vdi_uuid=$(xe_min vbd-list params=vdi-uuid vm-uuid="$vm_uuid" \ |
|
| 27 |
- userdevice="$device") |
|
| 28 |
- |
|
| 29 |
-dom0_uuid=$(xe_min vm-list is-control-domain=true) |
|
| 30 |
- |
|
| 31 |
-function get_mount_device() {
|
|
| 32 |
- vbd_uuid=$1 |
|
| 33 |
- |
|
| 34 |
- dev=$(xe_min vbd-list params=device uuid="$vbd_uuid") |
|
| 35 |
- if [[ "$dev" =~ "sm/" || "$dev" =~ "blktap-2/" ]]; then |
|
| 36 |
- DEBIAN_FRONTEND=noninteractive \ |
|
| 37 |
- apt-get --option "Dpkg::Options::=--force-confold" --assume-yes \ |
|
| 38 |
- install kpartx &> /dev/null || true |
|
| 39 |
- mapping=$(kpartx -av "/dev/$dev" | sed -ne 's,^add map \([a-z0-9\-]*\).*$,\1,p' | sed -ne "s,^\(.*${part}\)\$,\1,p")
|
|
| 40 |
- if [ -z "$mapping" ]; then |
|
| 41 |
- echo "Failed to find mapping" |
|
| 42 |
- exit -1 |
|
| 43 |
- fi |
|
| 44 |
- |
|
| 45 |
- local device="/dev/mapper/${mapping}"
|
|
| 46 |
- for (( i = 0; i < 5; i++ )) ; do |
|
| 47 |
- if [ -b $device ] ; then |
|
| 48 |
- echo $device |
|
| 49 |
- return |
|
| 50 |
- fi |
|
| 51 |
- sleep 1 |
|
| 52 |
- done |
|
| 53 |
- echo "ERROR: timed out waiting for dev-mapper" |
|
| 54 |
- exit 1 |
|
| 55 |
- else |
|
| 56 |
- echo "/dev/$dev$part" |
|
| 57 |
- fi |
|
| 58 |
-} |
|
| 59 |
- |
|
| 60 |
-function clean_dev_mappings() {
|
|
| 61 |
- dev=$(xe_min vbd-list params=device uuid="$vbd_uuid") |
|
| 62 |
- if [[ "$dev" =~ "sm/" || "$dev" =~ "blktap-2/" ]]; then |
|
| 63 |
- kpartx -dv "/dev/$dev" |
|
| 64 |
- fi |
|
| 65 |
-} |
|
| 66 |
- |
|
| 67 |
-function open_vdi() {
|
|
| 68 |
- vbd_uuid=$(xe vbd-create vm-uuid="$dom0_uuid" vdi-uuid="$vdi_uuid" \ |
|
| 69 |
- device=autodetect) |
|
| 70 |
- mp=$(mktemp -d) |
|
| 71 |
- xe vbd-plug uuid="$vbd_uuid" |
|
| 72 |
- |
|
| 73 |
- run_udev_settle |
|
| 74 |
- |
|
| 75 |
- mount_device=$(get_mount_device "$vbd_uuid") |
|
| 76 |
- mount "$mount_device" "$mp" |
|
| 77 |
- echo "Your vdi is mounted at $mp" |
|
| 78 |
-} |
|
| 79 |
- |
|
| 80 |
-function close_vdi() {
|
|
| 81 |
- vbd_uuid=$(xe_min vbd-list vm-uuid="$dom0_uuid" vdi-uuid="$vdi_uuid") |
|
| 82 |
- mount_device=$(get_mount_device "$vbd_uuid") |
|
| 83 |
- run_udev_settle |
|
| 84 |
- umount "$mount_device" |
|
| 85 |
- |
|
| 86 |
- clean_dev_mappings |
|
| 87 |
- |
|
| 88 |
- xe vbd-unplug uuid=$vbd_uuid |
|
| 89 |
- xe vbd-destroy uuid=$vbd_uuid |
|
| 90 |
-} |
|
| 91 |
- |
|
| 92 |
-if [ "$action" == "open" ]; then |
|
| 93 |
- open_vdi |
|
| 94 |
-elif [ "$action" == "close" ]; then |
|
| 95 |
- close_vdi |
|
| 96 |
-fi |
| 97 | 1 |
deleted file mode 100755 |
| ... | ... |
@@ -1,24 +0,0 @@ |
| 1 |
-#!/bin/bash |
|
| 2 |
- |
|
| 3 |
-set -e |
|
| 4 |
-set -o xtrace |
|
| 5 |
- |
|
| 6 |
-if [ -z "${on_exit_hooks:-}" ]; then
|
|
| 7 |
- on_exit_hooks=() |
|
| 8 |
-fi |
|
| 9 |
- |
|
| 10 |
-on_exit() |
|
| 11 |
-{
|
|
| 12 |
- for i in $(seq $((${#on_exit_hooks[*]} - 1)) -1 0); do
|
|
| 13 |
- eval "${on_exit_hooks[$i]}"
|
|
| 14 |
- done |
|
| 15 |
-} |
|
| 16 |
- |
|
| 17 |
-add_on_exit() |
|
| 18 |
-{
|
|
| 19 |
- local n=${#on_exit_hooks[*]}
|
|
| 20 |
- on_exit_hooks[$n]="$*" |
|
| 21 |
- if [[ $n -eq 0 ]]; then |
|
| 22 |
- trap on_exit EXIT |
|
| 23 |
- fi |
|
| 24 |
-} |
| 25 | 1 |
deleted file mode 100755 |
| ... | ... |
@@ -1,88 +0,0 @@ |
| 1 |
-#!/bin/bash |
|
| 2 |
-# |
|
| 3 |
-# Copyright (c) 2011 Citrix Systems, Inc. |
|
| 4 |
-# Copyright 2011 OpenStack Foundation |
|
| 5 |
-# All Rights Reserved. |
|
| 6 |
-# |
|
| 7 |
-# Licensed under the Apache License, Version 2.0 (the "License"); you may |
|
| 8 |
-# not use this file except in compliance with the License. You may obtain |
|
| 9 |
-# a copy of the License at |
|
| 10 |
-# |
|
| 11 |
-# http://www.apache.org/licenses/LICENSE-2.0 |
|
| 12 |
-# |
|
| 13 |
-# Unless required by applicable law or agreed to in writing, software |
|
| 14 |
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
|
| 15 |
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
|
| 16 |
-# License for the specific language governing permissions and limitations |
|
| 17 |
-# under the License. |
|
| 18 |
-# |
|
| 19 |
- |
|
| 20 |
-set -ex |
|
| 21 |
- |
|
| 22 |
-# By default, don't remove the templates |
|
| 23 |
-REMOVE_TEMPLATES=${REMOVE_TEMPLATES:-"false"}
|
|
| 24 |
-if [ "$1" = "--remove-templates" ]; then |
|
| 25 |
- REMOVE_TEMPLATES=true |
|
| 26 |
-fi |
|
| 27 |
- |
|
| 28 |
-xe_min() |
|
| 29 |
-{
|
|
| 30 |
- local cmd="$1" |
|
| 31 |
- shift |
|
| 32 |
- xe "$cmd" --minimal "$@" |
|
| 33 |
-} |
|
| 34 |
- |
|
| 35 |
-destroy_vdi() |
|
| 36 |
-{
|
|
| 37 |
- local vbd_uuid="$1" |
|
| 38 |
- local type |
|
| 39 |
- type=$(xe_min vbd-list uuid=$vbd_uuid params=type) |
|
| 40 |
- local dev |
|
| 41 |
- dev=$(xe_min vbd-list uuid=$vbd_uuid params=userdevice) |
|
| 42 |
- local vdi_uuid |
|
| 43 |
- vdi_uuid=$(xe_min vbd-list uuid=$vbd_uuid params=vdi-uuid) |
|
| 44 |
- |
|
| 45 |
- if [ "$type" == 'Disk' ] && [ "$dev" != 'xvda' ] && [ "$dev" != '0' ]; then |
|
| 46 |
- xe vdi-destroy uuid=$vdi_uuid |
|
| 47 |
- fi |
|
| 48 |
-} |
|
| 49 |
- |
|
| 50 |
-uninstall() |
|
| 51 |
-{
|
|
| 52 |
- local vm_uuid="$1" |
|
| 53 |
- local power_state |
|
| 54 |
- power_state=$(xe_min vm-list uuid=$vm_uuid params=power-state) |
|
| 55 |
- |
|
| 56 |
- if [ "$power_state" != "halted" ]; then |
|
| 57 |
- xe vm-shutdown vm=$vm_uuid force=true |
|
| 58 |
- fi |
|
| 59 |
- |
|
| 60 |
- for v in $(xe_min vbd-list vm-uuid=$vm_uuid | sed -e 's/,/ /g'); do |
|
| 61 |
- destroy_vdi "$v" |
|
| 62 |
- done |
|
| 63 |
- |
|
| 64 |
- xe vm-uninstall vm=$vm_uuid force=true >/dev/null |
|
| 65 |
-} |
|
| 66 |
- |
|
| 67 |
-uninstall_template() |
|
| 68 |
-{
|
|
| 69 |
- local vm_uuid="$1" |
|
| 70 |
- |
|
| 71 |
- for v in $(xe_min vbd-list vm-uuid=$vm_uuid | sed -e 's/,/ /g'); do |
|
| 72 |
- destroy_vdi "$v" |
|
| 73 |
- done |
|
| 74 |
- |
|
| 75 |
- xe template-uninstall template-uuid=$vm_uuid force=true >/dev/null |
|
| 76 |
-} |
|
| 77 |
- |
|
| 78 |
-# remove the VMs and their disks |
|
| 79 |
-for u in $(xe_min vm-list other-config:os-vpx=true | sed -e 's/,/ /g'); do |
|
| 80 |
- uninstall "$u" |
|
| 81 |
-done |
|
| 82 |
- |
|
| 83 |
-# remove the templates |
|
| 84 |
-if [ "$REMOVE_TEMPLATES" == "true" ]; then |
|
| 85 |
- for u in $(xe_min template-list other-config:os-vpx=true | sed -e 's/,/ /g'); do |
|
| 86 |
- uninstall_template "$u" |
|
| 87 |
- done |
|
| 88 |
-fi |
| 89 | 1 |
deleted file mode 100755 |
| ... | ... |
@@ -1,205 +0,0 @@ |
| 1 |
-#!/bin/bash |
|
| 2 |
- |
|
| 3 |
-# Tests for functions. |
|
| 4 |
-# |
|
| 5 |
-# The tests are sourcing the mocks file to mock out various functions. The |
|
| 6 |
-# mocking-out always happens in a sub-shell, thus it does not have impact on |
|
| 7 |
-# the functions defined here. |
|
| 8 |
- |
|
| 9 |
-# To run the tests, please run: |
|
| 10 |
-# |
|
| 11 |
-# ./test_functions.sh run_tests |
|
| 12 |
-# |
|
| 13 |
-# To only print out the discovered test functions, run: |
|
| 14 |
-# |
|
| 15 |
-# ./test_functions.sh |
|
| 16 |
- |
|
| 17 |
-. functions |
|
| 18 |
- |
|
| 19 |
-# Setup |
|
| 20 |
-function before_each_test {
|
|
| 21 |
- LIST_OF_DIRECTORIES=$(mktemp) |
|
| 22 |
- truncate -s 0 $LIST_OF_DIRECTORIES |
|
| 23 |
- |
|
| 24 |
- LIST_OF_ACTIONS=$(mktemp) |
|
| 25 |
- truncate -s 0 $LIST_OF_ACTIONS |
|
| 26 |
- |
|
| 27 |
- XE_RESPONSE=$(mktemp) |
|
| 28 |
- truncate -s 0 $XE_RESPONSE |
|
| 29 |
- |
|
| 30 |
- XE_CALLS=$(mktemp) |
|
| 31 |
- truncate -s 0 $XE_CALLS |
|
| 32 |
- |
|
| 33 |
- DEAD_MESSAGES=$(mktemp) |
|
| 34 |
- truncate -s 0 $DEAD_MESSAGES |
|
| 35 |
-} |
|
| 36 |
- |
|
| 37 |
-# Teardown |
|
| 38 |
-function after_each_test {
|
|
| 39 |
- rm -f $LIST_OF_DIRECTORIES |
|
| 40 |
- rm -f $LIST_OF_ACTIONS |
|
| 41 |
- rm -f $XE_RESPONSE |
|
| 42 |
- rm -f $XE_CALLS |
|
| 43 |
-} |
|
| 44 |
- |
|
| 45 |
-# Helpers |
|
| 46 |
-function setup_xe_response {
|
|
| 47 |
- echo "$1" > $XE_RESPONSE |
|
| 48 |
-} |
|
| 49 |
- |
|
| 50 |
-function given_directory_exists {
|
|
| 51 |
- echo "$1" >> $LIST_OF_DIRECTORIES |
|
| 52 |
-} |
|
| 53 |
- |
|
| 54 |
-function assert_directory_exists {
|
|
| 55 |
- grep "$1" $LIST_OF_DIRECTORIES |
|
| 56 |
-} |
|
| 57 |
- |
|
| 58 |
-function assert_previous_command_failed {
|
|
| 59 |
- [ "$?" != "0" ] || exit 1 |
|
| 60 |
-} |
|
| 61 |
- |
|
| 62 |
-function assert_xe_min {
|
|
| 63 |
- grep -qe "^--minimal\$" $XE_CALLS |
|
| 64 |
-} |
|
| 65 |
- |
|
| 66 |
-function assert_xe_param {
|
|
| 67 |
- grep -qe "^$1\$" $XE_CALLS |
|
| 68 |
-} |
|
| 69 |
- |
|
| 70 |
-function assert_died_with {
|
|
| 71 |
- diff -u <(echo "$1") $DEAD_MESSAGES |
|
| 72 |
-} |
|
| 73 |
- |
|
| 74 |
-function mock_out {
|
|
| 75 |
- local FNNAME="$1" |
|
| 76 |
- local OUTPUT="$2" |
|
| 77 |
- |
|
| 78 |
- . <(cat << EOF |
|
| 79 |
-function $FNNAME {
|
|
| 80 |
- echo "$OUTPUT" |
|
| 81 |
-} |
|
| 82 |
-EOF |
|
| 83 |
-) |
|
| 84 |
-} |
|
| 85 |
- |
|
| 86 |
-function assert_symlink {
|
|
| 87 |
- grep -qe "^ln -s $2 $1\$" $LIST_OF_ACTIONS |
|
| 88 |
-} |
|
| 89 |
- |
|
| 90 |
-# Tests |
|
| 91 |
-function test_plugin_directory_on_xenserver {
|
|
| 92 |
- given_directory_exists "/etc/xapi.d/plugins/" |
|
| 93 |
- |
|
| 94 |
- PLUGDIR=$(. mocks && xapi_plugin_location) |
|
| 95 |
- |
|
| 96 |
- [ "/etc/xapi.d/plugins/" = "$PLUGDIR" ] |
|
| 97 |
-} |
|
| 98 |
- |
|
| 99 |
-function test_plugin_directory_on_xcp {
|
|
| 100 |
- given_directory_exists "/usr/lib/xcp/plugins/" |
|
| 101 |
- |
|
| 102 |
- PLUGDIR=$(. mocks && xapi_plugin_location) |
|
| 103 |
- |
|
| 104 |
- [ "/usr/lib/xcp/plugins/" = "$PLUGDIR" ] |
|
| 105 |
-} |
|
| 106 |
- |
|
| 107 |
-function test_no_plugin_directory_found {
|
|
| 108 |
- set +e |
|
| 109 |
- |
|
| 110 |
- local IGNORE |
|
| 111 |
- IGNORE=$(. mocks && xapi_plugin_location) |
|
| 112 |
- |
|
| 113 |
- assert_previous_command_failed |
|
| 114 |
- |
|
| 115 |
- grep "[ -d /etc/xapi.d/plugins/ ]" $LIST_OF_ACTIONS |
|
| 116 |
- grep "[ -d /usr/lib/xcp/plugins/ ]" $LIST_OF_ACTIONS |
|
| 117 |
-} |
|
| 118 |
- |
|
| 119 |
-function test_create_directory_for_kernels {
|
|
| 120 |
- ( |
|
| 121 |
- . mocks |
|
| 122 |
- mock_out get_local_sr_path /var/run/sr-mount/uuid1 |
|
| 123 |
- create_directory_for_kernels |
|
| 124 |
- ) |
|
| 125 |
- |
|
| 126 |
- assert_directory_exists "/var/run/sr-mount/uuid1/os-guest-kernels" |
|
| 127 |
- assert_symlink "/boot/guest" "/var/run/sr-mount/uuid1/os-guest-kernels" |
|
| 128 |
-} |
|
| 129 |
- |
|
| 130 |
-function test_create_directory_for_kernels_existing_dir {
|
|
| 131 |
- ( |
|
| 132 |
- . mocks |
|
| 133 |
- given_directory_exists "/boot/guest" |
|
| 134 |
- create_directory_for_kernels |
|
| 135 |
- ) |
|
| 136 |
- |
|
| 137 |
- diff -u $LIST_OF_ACTIONS - << EOF |
|
| 138 |
-[ -d /boot/guest ] |
|
| 139 |
-EOF |
|
| 140 |
-} |
|
| 141 |
- |
|
| 142 |
-function test_create_directory_for_images {
|
|
| 143 |
- ( |
|
| 144 |
- . mocks |
|
| 145 |
- mock_out get_local_sr_path /var/run/sr-mount/uuid1 |
|
| 146 |
- create_directory_for_images |
|
| 147 |
- ) |
|
| 148 |
- |
|
| 149 |
- assert_directory_exists "/var/run/sr-mount/uuid1/os-images" |
|
| 150 |
- assert_symlink "/images" "/var/run/sr-mount/uuid1/os-images" |
|
| 151 |
-} |
|
| 152 |
- |
|
| 153 |
-function test_create_directory_for_images_existing_dir {
|
|
| 154 |
- ( |
|
| 155 |
- . mocks |
|
| 156 |
- given_directory_exists "/images" |
|
| 157 |
- create_directory_for_images |
|
| 158 |
- ) |
|
| 159 |
- |
|
| 160 |
- diff -u $LIST_OF_ACTIONS - << EOF |
|
| 161 |
-[ -d /images ] |
|
| 162 |
-EOF |
|
| 163 |
-} |
|
| 164 |
- |
|
| 165 |
-function test_get_local_sr {
|
|
| 166 |
- setup_xe_response "uuid123" |
|
| 167 |
- |
|
| 168 |
- local RESULT |
|
| 169 |
- RESULT=$(. mocks && get_local_sr) |
|
| 170 |
- |
|
| 171 |
- [ "$RESULT" == "uuid123" ] |
|
| 172 |
- |
|
| 173 |
- assert_xe_param "pool-list" params=default-SR minimal=true |
|
| 174 |
-} |
|
| 175 |
- |
|
| 176 |
-function test_get_local_sr_path {
|
|
| 177 |
- local RESULT |
|
| 178 |
- RESULT=$(mock_out get_local_sr "uuid1" && get_local_sr_path) |
|
| 179 |
- |
|
| 180 |
- [ "/var/run/sr-mount/uuid1" == "$RESULT" ] |
|
| 181 |
-} |
|
| 182 |
- |
|
| 183 |
-# Test runner |
|
| 184 |
-[ "$1" = "" ] && {
|
|
| 185 |
- grep -e "^function *test_" $0 | cut -d" " -f2 |
|
| 186 |
-} |
|
| 187 |
- |
|
| 188 |
-[ "$1" = "run_tests" ] && {
|
|
| 189 |
- for testname in $($0); do |
|
| 190 |
- echo "$testname" |
|
| 191 |
- before_each_test |
|
| 192 |
- ( |
|
| 193 |
- set -eux |
|
| 194 |
- $testname |
|
| 195 |
- ) |
|
| 196 |
- if [ "$?" != "0" ]; then |
|
| 197 |
- echo "FAIL" |
|
| 198 |
- exit 1 |
|
| 199 |
- else |
|
| 200 |
- echo "PASS" |
|
| 201 |
- fi |
|
| 202 |
- |
|
| 203 |
- after_each_test |
|
| 204 |
- done |
|
| 205 |
-} |
| 206 | 1 |
deleted file mode 100644 |
| ... | ... |
@@ -1,114 +0,0 @@ |
| 1 |
-#!/bin/bash |
|
| 2 |
- |
|
| 3 |
-# |
|
| 4 |
-# XenServer specific defaults for the /tools/xen/ scripts |
|
| 5 |
-# Similar to stackrc, you can override these in your localrc |
|
| 6 |
-# |
|
| 7 |
- |
|
| 8 |
-# Name of this guest |
|
| 9 |
-GUEST_NAME=${GUEST_NAME:-DevStackOSDomU}
|
|
| 10 |
- |
|
| 11 |
-# Template cleanup |
|
| 12 |
-CLEAN_TEMPLATES=${CLEAN_TEMPLATES:-false}
|
|
| 13 |
- |
|
| 14 |
-# Size of image |
|
| 15 |
-VDI_MB=${VDI_MB:-5000}
|
|
| 16 |
- |
|
| 17 |
-# Devstack now contains many components. 4GB ram is not enough to prevent |
|
| 18 |
-# swapping and memory fragmentation - the latter of which can cause failures |
|
| 19 |
-# such as blkfront failing to plug a VBD and lead to random test fails. |
|
| 20 |
-# |
|
| 21 |
-# Set to 6GB so an 8GB XenServer VM can have a 1GB Dom0 and leave 1GB for VMs |
|
| 22 |
-OSDOMU_MEM_MB=6144 |
|
| 23 |
-OSDOMU_VDI_GB=8 |
|
| 24 |
- |
|
| 25 |
-# Network mapping. Specify bridge names or network names. Network names may |
|
| 26 |
-# differ across localised versions of XenServer. If a given bridge/network |
|
| 27 |
-# was not found, a new network will be created with the specified name. |
|
| 28 |
- |
|
| 29 |
-# Get the management network from the XS installation |
|
| 30 |
-VM_BRIDGE_OR_NET_NAME="OpenStack VM Network" |
|
| 31 |
-PUB_BRIDGE_OR_NET_NAME="OpenStack Public Network" |
|
| 32 |
- |
|
| 33 |
-# VM Password |
|
| 34 |
-GUEST_PASSWORD=${GUEST_PASSWORD:-secret}
|
|
| 35 |
- |
|
| 36 |
-# Extracted variables for OpenStack VM network device numbers. |
|
| 37 |
-# Make sure they form a continuous sequence starting from 0 |
|
| 38 |
-MGT_DEV_NR=0 |
|
| 39 |
-VM_DEV_NR=1 |
|
| 40 |
-PUB_DEV_NR=2 |
|
| 41 |
- |
|
| 42 |
-# Host Interface, i.e. the interface on the nova vm you want to expose the |
|
| 43 |
-# services on. Usually the device connected to the management network or the |
|
| 44 |
-# one connected to the public network is used. |
|
| 45 |
-HOST_IP_IFACE=${HOST_IP_IFACE:-"eth${MGT_DEV_NR}"}
|
|
| 46 |
- |
|
| 47 |
-# |
|
| 48 |
-# Our nova host's network info |
|
| 49 |
-# |
|
| 50 |
- |
|
| 51 |
-# Management network |
|
| 52 |
-MGT_IP=${MGT_IP:-dhcp}
|
|
| 53 |
-MGT_NETMASK=${MGT_NETMASK:-ignored}
|
|
| 54 |
- |
|
| 55 |
-# VM Network |
|
| 56 |
-VM_IP=${VM_IP:-10.255.255.255}
|
|
| 57 |
-VM_NETMASK=${VM_NETMASK:-255.255.255.0}
|
|
| 58 |
- |
|
| 59 |
-# Public network |
|
| 60 |
-# Aligned with stack.sh - see FLOATING_RANGE |
|
| 61 |
-PUB_IP=${PUB_IP:-172.24.4.10}
|
|
| 62 |
-PUB_NETMASK=${PUB_NETMASK:-255.255.255.0}
|
|
| 63 |
- |
|
| 64 |
-# Ubuntu install settings |
|
| 65 |
-UBUNTU_INST_RELEASE="xenial" |
|
| 66 |
-UBUNTU_INST_TEMPLATE_NAME="Ubuntu 16.04 (64-bit) for DevStack" |
|
| 67 |
-# For 12.04 use "precise" and update template name |
|
| 68 |
-# However, for 12.04, you should be using |
|
| 69 |
-# XenServer 6.1 and later or XCP 1.6 or later |
|
| 70 |
-# 11.10 is only really supported with XenServer 6.0.2 and later |
|
| 71 |
-UBUNTU_INST_ARCH="amd64" |
|
| 72 |
-UBUNTU_INST_HTTP_HOSTNAME="archive.ubuntu.com" |
|
| 73 |
-UBUNTU_INST_HTTP_DIRECTORY="/ubuntu" |
|
| 74 |
-UBUNTU_INST_HTTP_PROXY="" |
|
| 75 |
-UBUNTU_INST_LOCALE="en_US" |
|
| 76 |
-UBUNTU_INST_KEYBOARD="us" |
|
| 77 |
-# network configuration for ubuntu netinstall |
|
| 78 |
-UBUNTU_INST_IP="dhcp" |
|
| 79 |
-UBUNTU_INST_NAMESERVERS="" |
|
| 80 |
-UBUNTU_INST_NETMASK="" |
|
| 81 |
-UBUNTU_INST_GATEWAY="" |
|
| 82 |
- |
|
| 83 |
-# Create a separate xvdb. Tis could be used as a backing device for cinder |
|
| 84 |
-# volumes. Specify |
|
| 85 |
-# XEN_XVDB_SIZE_GB=10 |
|
| 86 |
-# VOLUME_BACKING_DEVICE=/dev/xvdb |
|
| 87 |
-# in your localrc to avoid kernel lockups: |
|
| 88 |
-# https://bugs.launchpad.net/cinder/+bug/1023755 |
|
| 89 |
-# |
|
| 90 |
-# Set the size to 0 to avoid creation of additional disk. |
|
| 91 |
-XEN_XVDB_SIZE_GB=0 |
|
| 92 |
- |
|
| 93 |
-STACK_USER=stack |
|
| 94 |
-DOMZERO_USER=domzero |
|
| 95 |
- |
|
| 96 |
-RC_DIR="../.." |
|
| 97 |
- |
|
| 98 |
-restore_nounset=$(set +o | grep nounset) |
|
| 99 |
-set +u |
|
| 100 |
- |
|
| 101 |
-## Note that the lines below are coming from stackrc to support |
|
| 102 |
-## new-style config files |
|
| 103 |
-source $RC_DIR/functions-common |
|
| 104 |
- |
|
| 105 |
-# allow local overrides of env variables, including repo config |
|
| 106 |
-if [[ -f $RC_DIR/localrc ]]; then |
|
| 107 |
- # Old-style user-supplied config |
|
| 108 |
- source $RC_DIR/localrc |
|
| 109 |
-elif [[ -f $RC_DIR/.localrc.auto ]]; then |
|
| 110 |
- # New-style user-supplied config extracted from local.conf |
|
| 111 |
- source $RC_DIR/.localrc.auto |
|
| 112 |
-fi |
|
| 113 |
- |
|
| 114 |
-$restore_nounset |