Commit 3493b40b authored by Nikos Skalkotos's avatar Nikos Skalkotos

Merge branch 'release-0.20'

parents 0a613f84 8d8927ab
2016-09-29, v0.20rc1
* Add support for NetworkManager in CofigureNetwork configuration task
* Add a new Linux configuration task for regenerating the machine ID
* Update the documentation
2016-07-20, v0.19.1
* Add "auto" to the known Linux file systems
......
......@@ -52,16 +52,16 @@ Although *diskdump* is a lot more flexible than the older formats, there are
still some rules to follow:
* For Linux:
* All block devices in ``/etc/fstab`` should be specified using persistent
names (UUID or LABEL)
* LVM partitions are not supported
* Only ext{2,3,4} file systems are supported
* All block devices in ``/etc/fstab`` should be specified using persistent
names (UUID or LABEL)
* LVM partitions are not supported
* Only ext{2,3,4} file systems are supported
* For FreeBSD:
* GUID Partition Tables (GPT) should be used
* Only UFS2 file systems are supported
* Labels should be omitted in ``/etc/fstab`` entries
* GUID Partition Tables (GPT) should be used
* Only UFS2 file systems are supported
* Labels should be omitted in ``/etc/fstab`` entries
* For {Open,Net}BSD:
* Only FFS file systems should be used
* Only FFS file systems should be used
.. _windows-deployment:
......@@ -144,7 +144,7 @@ one:
The ``@TIMEZONE_INDEX@`` container will be replaced during the installation of
the file by the index value of the time zone which is specified through the
*WINDOWS_TIMEZONE* configuration variable. For more info check `here
<https://msdn.microsoft.com/en-us/library/ms912391%28v=winembedded.11%29.aspx>`_.
<https://msdn.microsoft.com/en-us/library/ms912391%28v=winembedded.11%29.aspx>`__.
This file is known to work with Windows XP and in order for the deployment to
be completely unattended, the user must provide a Windows Product key using the
*os_product_key* OS parameter *snf-image* offers. As with the newer Windows
......@@ -291,7 +291,7 @@ environment variables that are present when the configuration tasks run.
|NIC_%N_* |The Ganeti provided environment variable for the Nth |
| |network interface controller. Check |
| |`here <http://docs.ganeti.org/ganeti/current/man/ganeti|
| |-os-interface.html>`_ |
| |-os-interface.html>`__ |
+---------------------+-------------------------------------------------------+
|DHCP_TAGS |The value of the DHCP_TAGS configuration parameter (see|
| |:ref:`Configuration Parameters |
......
This diff is collapsed.
......@@ -27,7 +27,7 @@ snf-image also supports Image customization via hooks. Hooks allow for:
snf-image is being used in large scale production environments with Ganeti to
successfully deploy many major Linux distributions (Debian, Ubuntu/Kubuntu,
CentOS, Fedora, OpenSUSE, Slackware, Arch Linux, CoreOS), Windows Server
flavors (2008 R2, 2012, 20012 R2), as well as BSD systems (FreeBSD, OpenBSD,
flavors (2008 R2, 2012, 2012 R2), as well as BSD systems (FreeBSD, OpenBSD,
NetBSD). It is also known to work well with current Desktop versions of Windows
(7, 8, 8.1) as well as Windows XP.
......
......@@ -13,13 +13,19 @@ Installing snf-image using packages
Debian GNU/Linux
^^^^^^^^^^^^^^^^
For Debian 7.x (Wheezy) we provide packages in our APT repository. To use
our repository add the following lines to file ``/etc/apt/sources.list``:
We provide Debian packages in our APT repository. To use our packages on
Debian 7.x (Wheezy) add the following lines to file ``/etc/apt/sources.list``:
``deb http://apt.dev.grnet.gr wheezy/``
``deb-src http://apt.dev.grnet.gr wheezy/``
For Debian 8.x (Jessie) add the following lines:
``deb http://apt.dev.grnet.gr jessie/``
``deb-src http://apt.dev.grnet.gr jessie/``
After you update ``/etc/apt/sources.list`` import the repo's GPG key:
.. code-block:: console
......@@ -39,13 +45,19 @@ the post install phase of the package installation.
Ubuntu
^^^^^^
For Ubuntu 14.04 LTS we provide packages in our APT repository. To use our
repository add the following lines to file ``/etc/apt/sources.list``:
We provide Ubuntu packages in our APT repository. To use our packages on
Ubuntu 14.04 LTS add the following lines to file ``/etc/apt/sources.list``:
``deb http://apt.dev.grnet.gr trusty/``
``deb-src http://apt.dev.grnet.gr trusty/``
For Ubuntu 16.04 LTS add the following lines:
``deb http://apt.dev.grnet.gr xenial/``
``deb-src http://apt.dev.grnet.gr xenial/``
After you update ``/etc/apt/sources.list`` import the repo's GPG key:
.. code-block:: console
......@@ -65,6 +77,9 @@ the post install phase of the package installation.
CentOS
^^^^^^
.. warning::
CentOS packages are no longer actively supported.
For CentOS 6.5 we provide packages in our Yum repository.
To add the GRNET repository in your system, run:
......
......@@ -228,6 +228,12 @@ All image formats properties
you want to write a custom configuration task check
:ref:`Configuration Tasks Environment<configuration-tasks-environment>`.
* **NM_NETWORKING=bool**
If this property is defined with a yes value, the *ConfigureNetwork* task
will try to configure the Ganeti-provided NICs by creating Network Manager
configuration files, instead of using the distro-specific network
configuration mechanism (*ifupdown* for Debian, *ifcfg* for Red Hat, etc.).
* **EXCLUDE_ALL_TASKS=bool**
If this property is defined with a yes value, the image will not be
configured at all, during the deployment. This is really handy because it
......
......@@ -12,45 +12,53 @@ that have been tested with *snf-image* and provided here for testing purposes:
* Debian Jessie Base System
[`diskdump <https://cdn.synnefo.org/debian_base-8.0-x86_64.diskdump>`_]
[`md5sum <https://cdn.synnefo.org/debian_base-8.0-x86_64.diskdump.md5sum>`_]
[`metadata <https://cdn.synnefo.org/debian_base-8.0-x86_64.diskdump.meta>`_]
[`diskdump <https://cdn.synnefo.org/debian_base-8.0-x86_64.diskdump>`__]
[`md5sum <https://cdn.synnefo.org/debian_base-8.0-x86_64.diskdump.md5sum>`__]
[`metadata <https://cdn.synnefo.org/debian_base-8.0-x86_64.diskdump.meta>`__]
* Debian Jessie Desktop
[`diskdump <https://cdn.synnefo.org/debian_desktop-8.0-x86_64.diskdump>`_]
[`md5sum <https://cdn.synnefo.org/debian_desktop-8.0-x86_64.diskdump.md5sum>`_]
[`metadata <https://cdn.synnefo.org/debian_desktop-8.0-x86_64.diskdump.meta>`_]
[`diskdump <https://cdn.synnefo.org/debian_desktop-8.0-x86_64.diskdump>`__]
[`md5sum <https://cdn.synnefo.org/debian_desktop-8.0-x86_64.diskdump.md5sum>`__]
[`metadata <https://cdn.synnefo.org/debian_desktop-8.0-x86_64.diskdump.meta>`__]
* CentOS 7.x
[`diskdump <https://cdn.synnefo.org/centos-7-x86_64.diskdump>`_]
[`md5sum <https://cdn.synnefo.org/centos-7-x86_64.diskdump.md5sum>`_]
[`metadata <https://cdn.synnefo.org/centos-7-x86_64.diskdump.meta>`_]
[`diskdump <https://cdn.synnefo.org/centos-7-x86_64.diskdump>`__]
[`md5sum <https://cdn.synnefo.org/centos-7-x86_64.diskdump.md5sum>`__]
[`metadata <https://cdn.synnefo.org/centos-7-x86_64.diskdump.meta>`__]
* Fedora Desktop 23
[`diskdump <https://cdn.synnefo.org/fedora-23-x86_64.diskdump>`_]
[`md5sum <https://cdn.synnefo.org/fedora-23-x86_64.diskdump.md5sum>`_]
[`metadata <https://cdn.synnefo.org/fedora-23-x86_64.diskdump.meta>`_]
[`diskdump <https://cdn.synnefo.org/fedora-23-x86_64.diskdump>`__]
[`md5sum <https://cdn.synnefo.org/fedora-23-x86_64.diskdump.md5sum>`__]
[`metadata <https://cdn.synnefo.org/fedora-23-x86_64.diskdump.meta>`__]
* Ubuntu Desktop LTS 16.04
[`diskdump <https://cdn.synnefo.org/ubuntu_desktop-16.04-x86_64.diskdump>`__]
[`md5sum <https://cdn.synnefo.org/ubuntu_desktop-16.04-x86_64.diskdump.md5sum>`__]
[`metadata <https://cdn.synnefo.org/ubuntu_desktop-16.04-x86_64.diskdump.meta>`__]
* Ubuntu Server LTS 16.04
[`diskdump <https://cdn.synnefo.org/ubuntu_server-16.04-x86_64.diskdump>`__]
[`md5sum <https://cdn.synnefo.org/ubuntu_server-16.04-x86_64.diskdump.md5sum>`__]
[`metadata <https://cdn.synnefo.org/ubuntu_server-16.04-x86_64.diskdump.meta>`__]
* Ubuntu Desktop LTS 14.04
[`diskdump <https://cdn.synnefo.org/ubuntu_desktop-14.04-x86_64.diskdump>`_]
[`md5sum <https://cdn.synnefo.org/ubuntu_desktop-14.04-x86_64.diskdump.md5sum>`_]
[`metadata <https://cdn.synnefo.org/ubuntu_desktop-14.04-x86_64.diskdump.meta>`_]
[`diskdump <https://cdn.synnefo.org/ubuntu_desktop-14.04-x86_64.diskdump>`__]
[`md5sum <https://cdn.synnefo.org/ubuntu_desktop-14.04-x86_64.diskdump.md5sum>`__]
[`metadata <https://cdn.synnefo.org/ubuntu_desktop-14.04-x86_64.diskdump.meta>`__]
* Ubuntu Server LTS 14.04
[`diskdump <https://cdn.synnefo.org/ubuntu_server-14.04-x86_64.diskdump>`_]
[`md5sum <https://cdn.synnefo.org/ubuntu_server-14.04-x86_64.diskdump.md5sum>`_]
[`metadata <https://cdn.synnefo.org/ubuntu_server-14.04-x86_64.diskdump.meta>`_]
[`diskdump <https://cdn.synnefo.org/ubuntu_server-14.04-x86_64.diskdump>`__]
[`md5sum <https://cdn.synnefo.org/ubuntu_server-14.04-x86_64.diskdump.md5sum>`__]
[`metadata <https://cdn.synnefo.org/ubuntu_server-14.04-x86_64.diskdump.meta>`__]
* OpenSUSE Desktop 13.2
[`diskdump <https://cdn.synnefo.org/opensuse_desktop-13.2-x86_64.diskdump>`_]
[`md5sum <https://cdn.synnefo.org/opensuse_desktop-13.2-x86_64.diskdump.md5sum>`_]
[`metadata <https://cdn.synnefo.org/opensuse_desktop-13.2-x86_64.diskdump.meta>`_]
[`diskdump <https://cdn.synnefo.org/opensuse_desktop-13.2-x86_64.diskdump>`__]
[`md5sum <https://cdn.synnefo.org/opensuse_desktop-13.2-x86_64.diskdump.md5sum>`__]
[`metadata <https://cdn.synnefo.org/opensuse_desktop-13.2-x86_64.diskdump.meta>`__]
* Oracle Linux 7.x
[`diskdump <https://cdn.synnefo.org/oraclelinux-7-x86_64.diskdump>`_]
[`md5sum <https://cdn.synnefo.org/oraclelinux-7-x86_64.diskdump.md5sum>`_]
[`metadata <https://cdn.synnefo.org/oraclelinux-7-x86_64.diskdump.meta>`_]
[`diskdump <https://cdn.synnefo.org/oraclelinux-7-x86_64.diskdump>`__]
[`md5sum <https://cdn.synnefo.org/oraclelinux-7-x86_64.diskdump.md5sum>`__]
[`metadata <https://cdn.synnefo.org/oraclelinux-7-x86_64.diskdump.meta>`__]
* FreeBSD 10.2
[`diskdump <https://cdn.synnefo.org/freebsd-10.2-x86_64.diskdump>`_]
[`md5sum <https://cdn.synnefo.org/freebsd-10.2-x86_64.diskdump.md5sum>`_]
[`metadata <https://cdn.synnefo.org/freebsd-10.2-x86_64.diskdump.meta>`_]
[`diskdump <https://cdn.synnefo.org/freebsd-10.2-x86_64.diskdump>`__]
[`md5sum <https://cdn.synnefo.org/freebsd-10.2-x86_64.diskdump.md5sum>`__]
[`metadata <https://cdn.synnefo.org/freebsd-10.2-x86_64.diskdump.meta>`__]
* NetBSD 7.0
[`diskdump <https://cdn.synnefo.org/netbsd-7.0-x86_64.diskdump>`_]
[`md5sum <https://cdn.synnefo.org/netbsd-7.0-x86_64.diskdump.md5sum>`_]
[`metadata <https://cdn.synnefo.org/netbsd-7.0-x86_64.diskdump.meta>`_]
[`diskdump <https://cdn.synnefo.org/netbsd-7.0-x86_64.diskdump>`__]
[`md5sum <https://cdn.synnefo.org/netbsd-7.0-x86_64.diskdump.md5sum>`__]
[`metadata <https://cdn.synnefo.org/netbsd-7.0-x86_64.diskdump.meta>`__]
Sample Usage
^^^^^^^^^^^^
......
__version__ = "0.19.1"
__version__ = "0.20rc2.dev0"
......@@ -290,6 +290,26 @@ get_distro() {
fi
}
get_networking_tool() {
local root_dir distro tool
root_dir=$1
if check_yes_no SNF_IMAGE_PROPERTY_NM_NETWORKING; then
tool="nm"
else
distro=$(get_base_distro "$root_dir")
if [ "$distro" = debian ]; then
tool=ifupdown
elif [ "$distro" = redhat ]; then
tool=ifcfg
else
tool=$distro
fi
fi
echo "@networkingdir@/$tool.sh"
}
get_partition_table() {
local dev output
dev="$1"
......
networkingdir=$(libdir)/$(PACKAGE)/networking
dist_networking_SCRIPTS = debian.sh redhat.sh freebsd.sh openbsd.sh netbsd.sh
dist_networking_SCRIPTS = ifupdown.sh ifcfg.sh freebsd.sh openbsd.sh netbsd.sh nm.sh
edit = sed \
-e 's|@sysconfdir[@]|$(sysconfdir)|g' \
......
#! /bin/bash
# Copyright (C) 2016 GRNET S.A.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
# Script for configuring network manager connections
set -e
. "@commondir@/common.sh"
networking_opts "$@"
SYSTEM_CONNECTIONS="$SNF_IMAGE_TARGET/etc/NetworkManager/system-connections/"
if [ "$initialize" = yes ]; then
exit 0
fi
if [ "$finalize" = yes ]; then
exit 0
fi
if [ "$ipv4" = "none" ]; then
ipv4_section+="method=disabled"
elif [ "$ipv4" = "dhcp" ]; then
ipv4_section+="method=auto"
else
ipv4_section+="method=manual
address1=$IP/${SUBNET##*/}"
if [ -n "$GATEWAY" ]; then
ipv4_section+=",$GATEWAY"
fi
fi
if [ "$ipv6" != 'none' ]; then
ipv6_section="method=auto"
else
ipv6_section="method=disabled"
fi
connection="$SYSTEM_CONNECTIONS/Wired connection $index"
cat > "$connection" <<EOF
[connection]
id=Wired connection $index
uuid=$(cat /proc/sys/kernel/random/uuid)
type=ethernet
autoconnect=true
[ethernet]
mac-address=$MAC
mac-address-blacklist=
[ipv4]
dns-search=
$ipv4_section
[ipv6]
addr-gen-mode=eui64
dns-search=
ip6-privacy=0
$ipv6_section
EOF
# For security, the 'keyfile' plugin that will read the connection files found
# under /etc/NetworkManager/system-connections will ignore files that are
# readable or writeable by any user or group other than 'root' since private
# keys and passphrases may be stored in plaintext inside the file.
chown 0:0 "$connection"
chmod 600 "$connection"
# vim: set sta sts=4 shiftwidth=4 sw=4 et ai :
#! /bin/bash
# Copyright (C) 2016 GRNET S.A.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
### BEGIN TASK INFO
# Provides: ClearMachineId
# RunBefore: EnforcePersonality
# RunAfter: FilesystemResizeMounted
# Short-Description: Regenerate /etc/machine-id file in Linux Systems
### END TASK INFO
set -e
. "@commondir@/common.sh"
trap task_cleanup EXIT
report_task_start
# Check if the task should be prevented from running.
check_if_excluded
check_if_mounted_excluded
if [ ! -d "$SNF_IMAGE_TARGET" ]; then
log_error "Target dir: \`$SNF_IMAGE_TARGET' is missing."
fi
# Check if the image overwrites the task
check_if_overwritten
if [ "$SNF_IMAGE_PROPERTY_OSFAMILY" != "linux" ]; then
exit 0
fi
# Generate a new random UUID
uuid=$(sed 's/-//g' /proc/sys/kernel/random/uuid)
if [ -f "$SNF_IMAGE_TARGET/etc/machine-id" ]; then
echo "$uuid" > "$SNF_IMAGE_TARGET/etc/machine-id"
else
warn "\`/etc/machine-id' file is not present"
fi
# The machine-id may be also cached by dbus
if [ -f "$SNF_IMAGE_TARGET/var/lib/dbus/machine-id" ]; then
echo "$uuid" > "$SNF_IMAGE_TARGET/var/lib/dbus/machine-id"
else
warn "\`/var/lib/dbus/machine-id' file is not present"
fi
exit 0
# vim: set sta sts=4 shiftwidth=4 sw=4 et ai :
......@@ -42,17 +42,20 @@ fi
# Check if the image overwrites the task
check_if_overwritten
distro=$(get_base_distro "$SNF_IMAGE_TARGET")
networking_tool=$(get_networking_tool "$SNF_IMAGE_TARGET")
if [ ! -f "@networkingdir@/$distro.sh" ]; then
if [ ! -f "$networking_tool" ]; then
warn "Don't know how to configure the network for this OS"
exit 0
else
echo "Using $networking_tool"
fi
export SNF_IMAGE_TARGET
# Initialize the driver
"@networkingdir@/$distro.sh" -i
echo "Running: $networking_tool -i"
"$networking_tool" -i
for index in $(seq 0 $((SNF_IMAGE_NIC_COUNT-1))); do
dhcp=no
......@@ -129,12 +132,14 @@ for index in $(seq 0 $((SNF_IMAGE_NIC_COUNT-1))); do
fi
fi
"@networkingdir@/$distro.sh" $ARGS
echo "Running: $networking_tool $ARGS"
"$networking_tool" $ARGS
done
# Finalize the driver
"@networkingdir@/$distro.sh" -f
echo "Running: $networking_tool -f"
"$networking_tool" -f
# vim: set sta sts=4 shiftwidth=4 sw=4 et ai :
......
......@@ -8,6 +8,7 @@ dist_tasks_SCRIPTS = \
40FilesystemResizeMounted \
50AddSwap \
50AssignHostname \
50ChangeMachineId \
50ChangePassword \
50ConfigureNetwork \
50DeleteSSHKeys \
......
......@@ -102,7 +102,7 @@ get_api10_arguments() {
esac
instance=$INSTANCE_NAME
if [ $DISK_COUNT -lt 1 -o -z "$DISK_0_PATH" ]; then
if [ $DISK_COUNT -lt 1 ]; then
log_error "At least one disk is needed"
exit 1
fi
......@@ -111,21 +111,22 @@ get_api10_arguments() {
log_error "Missing OS API Variable: \`EXPORT_DEVICE'"
exit 1
fi
blockdev=$EXPORT_DEVICE
export_disk=$EXPORT_DEVICE
elif [ "$SCRIPT_NAME" = "import" ]; then
if [ -z "$IMPORT_DEVICE" ]; then
log_error "Missing OS API Variable: \`IMPORT_DEVICE'"
exit 1
fi
blockdev=$IMPORT_DEVICE
import_disk=$IMPORT_DEVICE
else
blockdev=$DISK_0_PATH
disk0=$(find_disk 0)
fi
if [ "$SCRIPT_NAME" = "rename" -a -z "$OLD_INSTANCE_NAME" ]; then
log_error "Missing OS API Variable: \`OLD_INSTANCE_NAME'"
exit 1
fi
old_name=$OLD_INSTANCE_NAME
disk_type=$INSTANCE_HV_disk_type
}
get_api20_arguments() {
......@@ -213,6 +214,47 @@ format_disk0() {
EOF
}
# This is used for export/import and in case we have an fsdump image type.
# If the give disk is a block device this is a no-op.
losetup_disk() {
local disk bdev
disk="$1"
if [ -b "$disk" ]; then
echo "$disk"
elif [ -f "$disk" ] ; then
bdev=$($LOSETUP --show -f "$disk")
add_cleanup $LOSETUP -d "$bdev"
echo $bdev
else
log_error "Cannot losetup $disk: not a regular file"
report_error "Could not use disk provided by Ganeti"
exit 1
fi
}
find_disk() {
local idx path uri
idx=$1
eval path=\$DISK_${idx}_PATH
eval uri=\$DISK_${idx}_URI
# Here we check if we have a valid disk path (block device or regular file)
if [ -b "$path" -o -f "$path" ]; then
echo $path
# Otherwise we choose the userspace URI and
# hope that snf-image can handle it
elif [ -n "$uri" ]; then
echo $uri
else
log_error "Disk information not exported by Ganeti"
exit 1
fi
}
create_floppy() {
local img target IFS index name tm
......
......@@ -133,17 +133,12 @@ case $BACKEND_TYPE in
;;
esac
# If the target device is not a real block device we'll first losetup it.
# This is needed for file disks.
if [ ! -b "$blockdev" ]; then
original_blockdev="$blockdev"
blockdev=$($LOSETUP --show -f "$blockdev")
add_cleanup $LOSETUP -d "$blockdev"
fi
case "$IMAGE_TYPE" in
ntfsdump|extdump)
# Create partitions
# Create a corresponding blockdev if required
blockdev=$(losetup_disk "$disk0")
# Create partitions on blockdev
format_disk0 "$blockdev" "$IMAGE_TYPE"
# Install a new MBR
......@@ -159,7 +154,7 @@ case "$IMAGE_TYPE" in
fi
;;
diskdump)
target="$blockdev"
target="$disk0"
;;
*)
log_error "Unknown Image format: \`$IMAGE_TYPE'"
......
......@@ -26,11 +26,7 @@ ganeti_os_main
# If the device we will export from, is not a real block device,
# we'll first losetup it. This is needed for file disks.
if [ ! -b "$blockdev" ]; then
original_blockdev="$blockdev"
blockdev=$($LOSETUP --show -f "$blockdev")
add_cleanup $LOSETUP -d "$blockdev"
fi
blockdev=$(losetup_disk "$export_disk")
# Export disk's predicted size to Ganeti.
# Used to provide a time estimate of the export process to the user.
......
......@@ -26,11 +26,7 @@ ganeti_os_main
# If the device we will import to, is not a real block device,
# we'll first losetup it. This is needed for file disks.
if [ ! -b "$blockdev" ]; then
original_blockdev="$blockdev"
blockdev=$($LOSETUP --show -f "$blockdev")
add_cleanup $LOSETUP -d "$blockdev"
fi
blockdev=$(losetup_disk "$import_disk")
$DD of="$blockdev" bs=4M
......
# Copyright (C) 2013-2015 GRNET S.A. and individual contributors
# Copyright (C) 2013-2016 GRNET S.A. and individual contributors
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......@@ -15,21 +15,45 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
get_img_dev() {
local idx=$1
local letters=( a b c d e f g h e j k l m n )
case $disk_type in
# The helper's root disk is always paravirtual and thus /dev/vda
# will be occupied.
paravirtual) echo /dev/vd${letters[$idx+1]};;
scsi-generic|scsi-block|scsi-hd|scsi) echo /dev/sd${letters[$idx]};;
esac
}
get_img_driver() {
case $disk_type in
paravirtual) echo virtio-blk-pci;;
scsi|scsi-hd) echo scsi-hd;;
scsi-block) echo scsi-block;;
scsi-generic) echo scsi-generic;;
esac
}
assign_disk_devices_to() {
local varname
local varname dev i
varname="$1"
# This will declare the given variable as an array
eval $varname=\(\)
set -- b c d e f g h e j k l m n
# For DISK_COUNT=3, disk_type=paravirtual, and varname=snf_export_DEV
# this will create snf_export_DEV array of ( /dev/vdb /dev/vdc /dev/vdd )
for ((i = 0; i < DISK_COUNT; i++)); do
eval $varname+=\(\"/dev/vd$1\"\); shift
dev=$(get_img_dev $i)
eval $varname+=\(\"$dev\"\)
done
}
launch_helper() {
local result_file result snapshot rc floppy i disk_path disks
local result_file result snapshot rc floppy i disks
floppy="$1"
......@@ -41,8 +65,8 @@ launch_helper() {
disks=""
for ((i=0; i < DISK_COUNT; i++)); do
eval disk_path=\"\$DISK_${i}_PATH\"
disks+=" -drive file=$disk_path,format=raw,if=virtio,cache=none"
disks+=" -drive file=$(find_disk $i),format=raw,if=none,cache=none,id=drive$i"
disks+=" -device $(get_img_driver),id=disk$i,drive=drive$i"
done
set +e
......@@ -53,11 +77,16 @@ launch_helper() {
HELPER_DEBUG_ARG=""
fi
if [[ "$disk_type" =~ ^scsi ]]; then
EXTRA_CONTROLLER_ARG="-device virtio-scsi-pci"
fi
$TIMEOUT -k "$HELPER_HARD_TIMEOUT" "$HELPER_SOFT_TIMEOUT" \
$KVM -runas "$HELPER_USER" \
-drive file="$HELPER_DIR/image",format=raw,if=virtio,readonly \
$disks -m "$HELPER_MEMORY" -boot c -serial stdio \
-drive file="$HELPER_DIR/image",format=raw,if=none,id=helper,readonly \
-device virtio-blk-pci,id=helper,drive=helper \
$EXTRA_CONTROLLER_ARG $disks \
-m "$HELPER_MEMORY" -boot c -serial stdio \
-serial "file:$(printf "%q" "$result_file")" \
-serial file:>(./helper-monitor.py ${MONITOR_FD}) \
-serial pty \
......
......@@ -137,6 +137,16 @@ if [ "x$NO_CHECKSUM" != "xyes" ]; then
exit 1
fi
# The filename listed inside the md5sum file may be different than the one
# of the image we have downloaded. This is due to redirections and the fact
# that we are not using --remote-header-name which would use the
# server-specified Content-Disposition filename instead of extracting a
# filename from the URL. This option is not used because some versions of
# curl will not attempt to decode %-sequences which may lead to unexpected
# filenames. It's better if we just replace the filename inside the md5sum
# file with the one we know.
sed -i 's/ .\+$/'" $IMAGE"'/' "$IMAGE_DIR/$IMAGE.md5sum"
$MD5SUM -c "$IMAGE_DIR/$IMAGE.md5sum"
fi
......
......@@ -40,7 +40,7 @@ launch_helper() {
set -- c d e f g h i j k l m n o p q r
for ((i = 0; i < DISK_COUNT; i++)); do
eval disk_path=\"\$DISK_${i}_PATH\"
disk_path="$(find_disk $i)"
case $(stat -L -c %F "$disk_path") in
"regular file")
ftype=file
......
m4_define([devflow_version], [0.19.1])
m4_define([devflow_version], [0.20rc2.dev0])
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment