add last minute changes on the migration process

OBS-URL: https://build.opensuse.org/package/show/Virtualization:containers/docker?expand=0&rev=85
This commit is contained in:
Jordi Massaguer 2016-03-15 11:47:01 +00:00 committed by Git OBS Bridge
parent f129359d5e
commit 6632f104c3

View File

@ -88,6 +88,8 @@ Requires: lvm2 >= 2.2.89
Requires: procps
Requires: tar >= 1.26
Requires: xz >= 4.9
# Not necessary, but must be installed to have a smooth upgrade.
Recommends: docker-image-migrator
Conflicts: lxc < 1.0
PreReq: %fillup_prereq
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@ -259,8 +261,8 @@ install -p -m 644 man/man5/Dockerfile.5 %{buildroot}%{_mandir}/man5
%pre
# We're currently inside rpmlint, which will cause us to fail the tests if it
# happens that the Docker install in the builder requires a migration. $BUILD
if [[ -z "$BUILD_ROOT" && -z "$DOCKER_FORCE_IMAGE_MIGRATION" ]]
# happens that the Docker install in the builder requires a migration.
if [[ -z "$BUILD_ROOT" ]]
then
# In order to make sure we don't print a scary warning when we shouldn't we
# need to test these things (in this order):
@ -272,6 +274,12 @@ then
# 4. Check that there are images in the graph/ directory.
if [[ -d "%{docker_store}" && ( ! -f "%{docker_migration_testfile}" ) && -d "%{docker_store}" && -n "$(find "%{docker_store}" -maxdepth 1 -type d 2>/dev/null | grep -Ev '_tmp|^%{docker_store}$')" ]]
then
if [ -n "$DOCKER_FORCE_INSTALL" ]
then
echo >&2 "*** IGNORING DOWNTIME WARNING! FORCING INSTALLATION. ***"
else
cat >&2 <<EOF
*** WARNING ***
@ -285,18 +293,30 @@ of Docker will not complete successfully, and you will have the opportunity to
run a separate migration tool (which will not cause downtime for your Docker
daemon).
In order to run this migration tool, please install docker-image-migrator package.
In order to run this migration tool, please install the 'docker-image-migrator'
package. You can run the migration with this command, which will exit after the
migration has been completed:
$ /usr/lib/docker-image-migrator/do-image-migration-v1to2.sh
Because the migrator requires information about the storage driver used by Docker,
the migration script will source /etc/sysconfig/docker and use \$DOCKER_OPTS as
arguments to the migrator. If this automated migration fails, it will be re-attempted
with every known storage driver. In addition, the script accepts arguments which
will simiarly be appended to the set of arguments (after \$DOCKER_OPTS) to the
migrator.
However, if you prefer to not run this separate migration tool, you can force this
update using the following command. THIS WILL CAUSE DOWNTIME, BECAUSE DOCKER WILL
RUN THE MIGRATION ON FIRST START AND YOU WILL BE UNABLE TO START ANY CONTAINERS
OR USE ANY DOCKER COMMANDS (EVEN CONTAINERS WITH RESTART POLICIES ACTIVE):
$ DOCKER_FORCE_IMAGE_MIGRATION=1 sudo -E zypper up docker
$ DOCKER_FORCE_INSTALL=1 sudo -E zypper up docker
EOF
# Fail the update.
exit 1
# Fail the update.
exit 1
fi
fi
# In order to make sure that we don't accidentally cause problems with an