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 |
......
......@@ -149,31 +149,22 @@ if any of the environment variables *SNF_IMAGE_DEV*,
*SNF_IMAGE_PROPERTY_ROOT_PARTITION* or *SNF_IMAGE_TARGET* is unset or has a
non-sane value.
**AddSwap**: Formats the swap partition added by *FixPartitionTable* task and
adds an appropriate swap entry in the system's ``/etc/fstab``. The script will
only run if *SNF_IMAGE_PROPERTY_SWAP* is present and will fail if
*SNF_IMAGE_TARGET* in not defined.
**DeleteSSHKeys**: On Linux and \*BSD instances, this script will clear out any
ssh keys found in the instance's disk. For Debian and Ubuntu systems, the keys
are also recreated. Besides removing files that comply to the
``/etc/ssh/ssh_*_key`` pattern, the script will also parses
``/etc/ssh/sshd_config`` file for custom keys. The only variable this script
depends on is *SNF_IMAGE_TARGET*.
**DisableRemoteDesktopConnections**: This script temporary disables RDP
connections on Windows instances by changing the value of *fDenyTSConnection*
registry key. RDP connections will be enabled back during the specialize pass
of the Windows setup. The task will fail if *SNF_IMAGE_TARGET* is not defined.
**InstallUnattend**: Installs the Unattend.xml files on Windows instances. This
is needed by Windows in order to perform an unattended setup. The
*SNF_IMAGE_TARGET* variables needs to be present for this task to run.
**SELinuxAutorelabel**: Creates *.autorelabel* file in Red Hat images. This is
needed if SELinux is enabled to enforce an automatic file system relabeling
during the first boot. The only environment variable required by this task is
*SNF_IMAGE_TARGET*.
**FilesystemResizeMounted**: For Windows VMs this task injects a script into
the VM's file system that will enlarge the last file system to cover up the
whole partition. The script will run during the specialize pass of the Windows
setup. For Linux VMs this task is used to extend the last file system in case
its type is Btrfs or XFS, since those file systems require to be mounted in
order to resize them. If the *SNF_IMAGE_TARGET* variable is missing, the task
will fail.
**AddSwap**: Formats the swap partition added by *FixPartitionTable* task and
adds an appropriate swap entry in the system's ``/etc/fstab``. The script will
only run if *SNF_IMAGE_PROPERTY_SWAP* is present and will fail if
*SNF_IMAGE_TARGET* in not defined.
**AssignHostname**: Assigns or changes the hostname of the instance. The task
will fail if the Linux distribution is not supported and ``/etc/hostname`` is
......@@ -182,6 +173,11 @@ SUSE and Gentoo derived distributions. The hostname is read from
*SNF_IMAGE_HOSTNAME* variable. In addition to the latter, *SNF_IMAGE_TARGET* is
also required.
**ChangeMachineId**: On Linux instances, this script will generate a new random
machine ID and will place it in ``/etc/machine-id``. For more info check
`here <https://www.freedesktop.org/software/systemd/man/machine-id.html>`_. The
task will fail if *SNF_IMAGE_TARGET* is missing.
**ChangePassword**: Changes the password for a list of existing users. On Linux
systems this is accomplished by directly altering the instance's
``/etc/shadow`` file. On Windows systems a script is injected into the VM's
......@@ -202,16 +198,25 @@ variables are exported to the task. The only variable required by this task is
adjust the *DHCP_TAGS* and the *\*_DHCPV6_TAGS* configuration parameters (see
:doc:`/configuration`).
**FilesystemResizeMounted**: For Windows VMs this task injects a script into
the VM's file system that will enlarge the last file system to cover up the
whole partition. The script will run during the specialize pass of the Windows
setup. For Linux VMs this task is used to extend the last file system in case
its type is Btrfs or XFS, since those file systems require to be mounted in
order to resize them. If the *SNF_IMAGE_TARGET* variable is missing, the task
will fail.
**DeleteSSHKeys**: On Linux and \*BSD instances, this script will clear out any
ssh keys found in the instance's disk. For Debian and Ubuntu systems, the keys
are also recreated. Besides removing files that comply to the
``/etc/ssh/ssh_*_key`` pattern, the script will also parses
``/etc/ssh/sshd_config`` file for custom keys. The only variable this script
depends on is *SNF_IMAGE_TARGET*.
**DisableRemoteDesktopConnections**: This script temporary disables RDP
connections on Windows instances by changing the value of *fDenyTSConnection*
registry key. RDP connections will be enabled back during the specialize pass
of the Windows setup. The task will fail if *SNF_IMAGE_TARGET* is not defined.
**SELinuxAutorelabel**: Creates *.autorelabel* file in Red Hat images. This is
needed if SELinux is enabled to enforce an automatic file system relabeling
during the first boot. The only environment variable required by this task is
*SNF_IMAGE_TARGET*.
**EnforcePersonality**: Injects the files specified by the
*SNF_IMAGE_PROPERTY_OSFAMILY* variable into the file system. If the variable is
*SNF_IMAGE_PERSONALITY* variable into the file system. If the variable is
missing a warning is produced. Only *SNF_IMAGE_TARGET* is required for this
task to run.
......@@ -222,48 +227,65 @@ a warning is produced.
**UmountImage**: Umounts the file systems previously mounted by MountImage. The
only environment variable required is *SNF_IMAGE_TARGET*.
+-------------------------------+---+--------------------------------------------+----------------------------------------------+
| | | Dependencies | Environment Variables [#]_ |
+ Name | +------------------+-------------------------+-------------------------+--------------------+
| |Pr.| Run-After | Run-Before | Required | Optional |
+===============================+===+==================+=========================+=========================+====================+
|FixPartitionTable |10 | |FilesystemResizeUnmounted|DEV | |
+-------------------------------+---+------------------+-------------------------+-------------------------+--------------------+
|FilesystemResizeUnmounted |20 |FixPartitionTable |MountImage |DEV | |
+-------------------------------+---+------------------+-------------------------+-------------------------+--------------------+
|MountImage |30 | |UmountImage |DEV | |
| | | | |TARGET | |
| | | | |PROPERTY_ROOT_PARTITION | |
+-------------------------------+---+------------------+-------------------------+-------------------------+--------------------+
|AddSwap |40 |MountImage |EnforcePersonality |TARGET |PROPERTY_OSFAMILY |
| | | | | |PROPERTY_SWAP |
+-------------------------------+---+------------------+-------------------------+-------------------------+--------------------+
|DeleteSSHKeys |40 |MountImage |EnforcePersonality |TARGET |PROPERTY_OSFAMILY |
+-------------------------------+---+------------------+-------------------------+-------------------------+--------------------+
|DisableRemoteDesktopConnections|40 |EnforcePersonality|UmountImage |TARGET |PROPERTY_OSFAMILY |
+-------------------------------+---+------------------+-------------------------+-------------------------+--------------------+
|InstallUnattend |40 |MountImage |EnforcePersonality |TARGET |PROPERTY_OSFAMILY |
+-------------------------------+---+------------------+-------------------------+-------------------------+--------------------+
|SELinuxAutorelabel |40 |MountImage |EnforcePersonality |TARGET |PROPERTY_OSFAMILY |
+-------------------------------+---+------------------+-------------------------+-------------------------+--------------------+
|AssignHostname |50 |InstallUnattend |EnforcePersonality |TARGET | |
| | | | |HOSTNAME |PROPERTY_OSFAMILY |
+-------------------------------+---+------------------+-------------------------+-------------------------+--------------------+
|ChangePassword |50 |InstallUnattend |EnforcePersonality |TARGET |PROPERTY_USERS |
| | | | | |PROPERTY_OSFAMILY |
| | | | | |PASSWD |
+-------------------------------+---+------------------+-------------------------+-------------------------+--------------------+
|ConfigureNetwork |50 |InstallUnattend |EnforcePersonality |TARGET |NIC_* |
+-------------------------------+---+------------------+-------------------------+-------------------------+--------------------+
|FilesystemResizeMounted |50 |InstallUnattend |EnforcePersonality |TARGET |PROPERTY_OSFAMILY |
+-------------------------------+---+------------------+-------------------------+-------------------------+--------------------+
|EnforcePersonality |60 |MountImage |UmountImage |TARGET |PERSONALITY |
| | | | | |PROPERTY_OSFAMILY |
+-------------------------------+---+------------------+-------------------------+-------------------------+--------------------+
|RunCustomTask |70 |MountImage |UmountImage |TARGET |PROPERTY_CUSTOM_TASK|
+-------------------------------+---+------------------+-------------------------+-------------------------+--------------------+
|UmountImage |80 |MountImage | |TARGET | |
+-------------------------------+---+------------------+-------------------------+-------------------------+--------------------+
**FilesystemResizeAfterUmount**: This is used for doing offline resize if the
file system in the last partition is NTFS. This is done after umount and not
before mounting the file system, because *ntfsresize* (which is used to perform
the actual resize) will mark the file system as dirty at the end and mounting
it afterwards is not recommended. This is done in order to force a chkdsk the
next time Windows boots. Offline NTFS resize is favored on windows-legacy and
non-windows OSes that do not support online resize. If you want to force
offline resize on newer Windows systems, the *OFFLINE_NTFSRESIZE* image
property must be defined.
+-------------------------------+---+--------------------------------------------+-----------------------------------------------------+
| | | Dependencies | Environment Variables [#]_ |
+ Name | +------------------+-------------------------+-------------------------+---------------------------+
| |Pr.| Run-After | Run-Before | Required | Optional |
+===============================+===+==================+=========================+=========================+===========================+
|FixPartitionTable |10 | |FilesystemResizeUnmounted|DEV | |
+-------------------------------+---+------------------+-------------------------+-------------------------+---------------------------+
|FilesystemResizeUnmounted |20 |FixPartitionTable |MountImage |DEV |RESIZE_PART |
+-------------------------------+---+------------------+-------------------------+-------------------------+---------------------------+
|MountImage |30 | |UmountImage |DEV | |
| | | | |TARGET | |
| | | | |PROPERTY_ROOT_PARTITION | |
+-------------------------------+---+------------------+-------------------------+-------------------------+---------------------------+
|InstallUnattend |35 |MountImage |EnforcePersonality |TARGET |PROPERTY_OSFAMILY |
+-------------------------------+---+------------------+-------------------------+-------------------------+---------------------------+
|FilesystemResizeMounted |40 |InstallUnattend |EnforcePersonality |TARGET |PROPERTY_OSFAMILY |
| | | | | |RESIZE_PART |
| | | | | |PROPERTY_OFFLINE_NTFSRESIZE|
+-------------------------------+---+------------------+-------------------------+-------------------------+---------------------------+
|AddSwap |50 |MountImage |EnforcePersonality |TARGET |PROPERTY_OSFAMILY |
| | | | | |PROPERTY_SWAP |
+-------------------------------+---+------------------+-------------------------+-------------------------+---------------------------+
|AssignHostname |50 |InstallUnattend |EnforcePersonality |TARGET | |
| | | | |HOSTNAME |PROPERTY_OSFAMILY |
+-------------------------------+---+------------------+-------------------------+-------------------------+---------------------------+
|ChangeMachineId |50 |InstallUnattend |EnforcePersonality |TARGET |PROPERTY_OSFAMILY |
+-------------------------------+---+------------------+-------------------------+-------------------------+---------------------------+
|ChangePassword |50 |InstallUnattend |EnforcePersonality |TARGET |PROPERTY_USERS |
| | | | | |PROPERTY_OSFAMILY |
| | | | | |PASSWD |
+-------------------------------+---+------------------+-------------------------+-------------------------+---------------------------+
|ConfigureNetwork |50 |InstallUnattend |EnforcePersonality |TARGET |NIC_* |
+-------------------------------+---+------------------+-------------------------+-------------------------+---------------------------+
|DeleteSSHKeys |50 |MountImage |EnforcePersonality |TARGET |PROPERTY_OSFAMILY |
+-------------------------------+---+------------------+-------------------------+-------------------------+---------------------------+
|DisableRemoteDesktopConnections|50 |EnforcePersonality|UmountImage |TARGET |PROPERTY_OSFAMILY |
+-------------------------------+---+------------------+-------------------------+-------------------------+---------------------------+
|SELinuxAutorelabel |50 |MountImage |EnforcePersonality |TARGET |PROPERTY_OSFAMILY |
+-------------------------------+---+------------------+-------------------------+-------------------------+---------------------------+
|EnforcePersonality |60 |MountImage |UmountImage |TARGET |PERSONALITY |
| | | | | |PROPERTY_OSFAMILY |
+-------------------------------+---+------------------+-------------------------+-------------------------+---------------------------+
|RunCustomTask |70 |MountImage |UmountImage |TARGET |PROPERTY_CUSTOM_TASK |
+-------------------------------+---+------------------+-------------------------+-------------------------+---------------------------+
|UmountImage |80 |MountImage | |TARGET | |
+-------------------------------+---+------------------+-------------------------+-------------------------+---------------------------+
|FilesystemResizeAfterUmount |81 |UmountImage | |DEV |RESIZE_PART |
| | | | | |PROPERTY_OSFAMILY |
| | | | | |PROPERTY_OFFLINE_NTFSRESIZE|
+-------------------------------+---+------------------+-------------------------+-------------------------+---------------------------+
.. [#] all environment variables are prefixed with *SNF_IMAGE_*
......@@ -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"