mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-26 04:03:11 +00:00
Merge pull request #589 from nathanleclaire/azure_recent_fixes
Fixes for Azure hostname and swap disk
This commit is contained in:
commit
1b529e5763
@ -10,7 +10,24 @@ start()
|
|||||||
{
|
{
|
||||||
ebegin "Configuring host block device"
|
ebegin "Configuring host block device"
|
||||||
|
|
||||||
DEV="$(find /dev -maxdepth 1 -type b ! -name 'loop*' | grep -v '[0-9]$' | sed 's@.*/dev/@@' | head -1 )"
|
# We are being specific with Azure for now. Otherwise the subshell
|
||||||
|
# below will reference /dev/sdb, which is Azure's "local resource disk"
|
||||||
|
# (see
|
||||||
|
# https://blogs.msdn.microsoft.com/mast/2013/12/06/understanding-the-temporary-drive-on-windows-azure-virtual-machines/).
|
||||||
|
#
|
||||||
|
# Since attempting to format swap on that disk will cause Azure VHD
|
||||||
|
# validation to fail, we default to using /dev/sda. requirements
|
||||||
|
# including not allowing swap partitions.
|
||||||
|
#
|
||||||
|
# IMPORTANT: If this, or the root device (/dev/sda1) changes in the
|
||||||
|
# syslinux / bootloader config for Azure, they will need to be updated
|
||||||
|
# in parallel.
|
||||||
|
if [ "$(mobyplatform)" = "azure" ]
|
||||||
|
then
|
||||||
|
DEV="sda"
|
||||||
|
else
|
||||||
|
DEV="$(find /dev -maxdepth 1 -type b ! -name 'loop*' | grep -v '[0-9]$' | sed 's@.*/dev/@@' | head -1 )"
|
||||||
|
fi
|
||||||
|
|
||||||
[ -z "${DEV}" ] && exit 1
|
[ -z "${DEV}" ] && exit 1
|
||||||
|
|
||||||
|
@ -13,13 +13,6 @@ start()
|
|||||||
[ "$(mobyplatform)" != "azure" ] && exit 0
|
[ "$(mobyplatform)" != "azure" ] && exit 0
|
||||||
ebegin "Running Azure-specific initialization"
|
ebegin "Running Azure-specific initialization"
|
||||||
|
|
||||||
einfo "Setting hostname"
|
|
||||||
|
|
||||||
# TODO: This is probably quite fragile (splitting the returned JSON by
|
|
||||||
# quotes instead of properly parsing). Would bundling 'jq' in Moby be
|
|
||||||
# too much overhead?
|
|
||||||
hostname $(wget -qO- http://169.254.169.254/metadata/v1/instanceinfo | awk -F '"' '{ print $4; }')
|
|
||||||
|
|
||||||
for i in $(seq 1 20)
|
for i in $(seq 1 20)
|
||||||
do
|
do
|
||||||
einfo "Pulling Windows Azure Linux Agent container"
|
einfo "Pulling Windows Azure Linux Agent container"
|
||||||
@ -47,12 +40,15 @@ start()
|
|||||||
--ipc host \
|
--ipc host \
|
||||||
--pid host \
|
--pid host \
|
||||||
--net host \
|
--net host \
|
||||||
|
--uts host \
|
||||||
--restart unless-stopped \
|
--restart unless-stopped \
|
||||||
-v /usr/bin/docker:/usr/local/bin/docker:ro \
|
-v /usr/bin/docker:/usr/local/bin/docker:ro \
|
||||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||||
-v /var/log:/var/log \
|
-v /var/log:/var/log \
|
||||||
|
-v /mnt:/mnt \
|
||||||
-v /home:/home \
|
-v /home:/home \
|
||||||
-v /etc:/etc \
|
-v /etc:/etc \
|
||||||
|
-v /etc/hostname:/etc/hostname \
|
||||||
-v /lib/modules:/lib/modules \
|
-v /lib/modules:/lib/modules \
|
||||||
-v /lib/firmware:/lib/firmware \
|
-v /lib/firmware:/lib/firmware \
|
||||||
-v /var/lib/waagent:/var/lib/waagent \
|
-v /var/lib/waagent:/var/lib/waagent \
|
||||||
@ -70,12 +66,18 @@ start()
|
|||||||
passwd -u docker
|
passwd -u docker
|
||||||
checkpath --directory --mode 0700 /home/docker/.ssh
|
checkpath --directory --mode 0700 /home/docker/.ssh
|
||||||
|
|
||||||
# Wait for custom data to arrive
|
# Wait for WALinux agent provisioning to finish before invoking the
|
||||||
while [ ! -f /var/lib/waagent/CustomData ]
|
# passed custom data. This assures us that hostname etc. is set
|
||||||
|
# correctly before running, say, swarm commmands.
|
||||||
|
while [ ! -f /var/lib/waagent/provisioned ]
|
||||||
do
|
do
|
||||||
sleep 5
|
sleep 5
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Hack to fix swarm hostname issue. See
|
||||||
|
# https://github.com/docker/docker/issues/27173
|
||||||
|
service docker restart
|
||||||
|
|
||||||
. /var/lib/waagent/CustomData
|
. /var/lib/waagent/CustomData
|
||||||
|
|
||||||
eend 0
|
eend 0
|
||||||
|
Loading…
Reference in New Issue
Block a user