Fix interaction between custom image and native

- Enable/start docker service on custom image in native mode if not
  found
This commit is contained in:
Fred Park 2018-02-22 18:46:13 -08:00
Родитель 3272fa6483
Коммит 53fcd2c313
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 3C4D545F457737EB
3 изменённых файлов: 75 добавлений и 52 удалений

Просмотреть файл

@ -1072,17 +1072,18 @@ def _construct_pool_object(
_rflist.append(_NODEPREP_WINDOWS_FILE)
start_task.append(
('powershell -ExecutionPolicy Unrestricted -command '
'{npf}{a}{e}{v}{x}').format(
'{npf}{a}{e}{u}{v}{x}').format(
npf=_NODEPREP_WINDOWS_FILE[0],
a=' -a' if azurefile_vd else '',
e=' -e {}'.format(pfx.sha1) if encrypt else '',
u=' -u' if util.is_not_empty(custom_image_na) else '',
v=' -v {}'.format(__version__),
x=' -x {}'.format(data._BLOBXFER_VERSION))
)
else:
_rflist.append(_NODEPREP_NATIVEDOCKER_FILE)
start_task.append(
'{npf}{a}{c}{e}{f}{m}{n}{v}{x}'.format(
'{npf}{a}{c}{e}{f}{m}{n}{u}{v}{x}'.format(
npf=_NODEPREP_NATIVEDOCKER_FILE[0],
a=' -a' if azurefile_vd else '',
c=' -c' if azureblob_vd else '',
@ -1092,6 +1093,7 @@ def _construct_pool_object(
sc_args) else '',
n=' -n' if settings.can_tune_tcp(
pool_settings.vm_size) else '',
u=' -u' if util.is_not_empty(custom_image_na) else '',
v=' -v {}'.format(__version__),
x=' -x {}'.format(data._BLOBXFER_VERSION),
)

Просмотреть файл

@ -10,6 +10,7 @@ MOUNTS_PATH=$AZ_BATCH_NODE_ROOT_DIR/mounts
azurefile=0
azureblob=0
blobxferversion=latest
custom_image=0
encrypted=
gluster_on_compute=0
networkopt=0
@ -17,7 +18,7 @@ sc_args=
version=
# process command line options
while getopts "h?acef:m:nv:x:" opt; do
while getopts "h?acef:m:nuv:x:" opt; do
case "$opt" in
h|\?)
echo "shipyard_nodeprep_nativedocker.sh parameters"
@ -28,6 +29,7 @@ while getopts "h?acef:m:nv:x:" opt; do
echo "-f set up glusterfs on compute"
echo "-m [type:scid] mount storage cluster"
echo "-n optimize network TCP settings"
echo "-u custom image"
echo "-v [version] batch-shipyard version"
echo "-x [blobxfer version] blobxfer version"
echo ""
@ -51,6 +53,9 @@ while getopts "h?acef:m:nv:x:" opt; do
n)
networkopt=1
;;
u)
custom_image=1
;;
v)
version=$OPTARG
;;
@ -157,6 +162,15 @@ check_docker_root_dir() {
check_for_docker_host_engine() {
set +e
# enable and start docker service if custom image
if [ $custom_image -eq 1 ]; then
docker --version
if [ $? -ne 0 ]; then
systemctl enable docker.service
systemctl start docker.service
fi
fi
systemctl status docker.service
docker --version
if [ $? -ne 0 ]; then
echo "ERROR: Docker not installed"
@ -382,6 +396,7 @@ echo "------------------------------"
echo "Batch Shipyard version: $version"
echo "Blobxfer version: $blobxferversion"
echo "Distrib ID/Release: $DISTRIB_ID $DISTRIB_RELEASE"
echo "Custom image: $custom_image"
echo "Network optimization: $networkopt"
echo "Encrypted: $encrypted"
echo "Storage cluster mount: ${sc_args[*]}"
@ -453,59 +468,63 @@ check_docker_root_dir $DISTRIB_ID
# check for nvidia card/driver/docker
check_for_nvidia
# install gluster on compute
if [ $gluster_on_compute -eq 1 ]; then
if [ $DISTRIB_ID == "ubuntu" ]; then
install_packages $DISTRIB_ID glusterfs-server
systemctl enable glusterfs-server
systemctl start glusterfs-server
# create brick directory
mkdir -p /mnt/gluster
elif [[ $DISTRIB_ID == centos* ]]; then
install_packages $DISTRIB_ID epel-release centos-release-gluster38
sed -i -e "s/enabled=1/enabled=0/g" /etc/yum.repos.d/CentOS-Gluster-3.8.repo
install_packages $DISTRIB_ID --enablerepo=centos-gluster38,epel glusterfs-server
systemctl daemon-reload
chkconfig glusterd on
systemctl start glusterd
# create brick directory
mkdir -p /mnt/resource/gluster
# install gluster on compute software
if [ $custom_image -eq 0 ]; then
if [ $gluster_on_compute -eq 1 ]; then
if [ $DISTRIB_ID == "ubuntu" ]; then
install_packages $DISTRIB_ID glusterfs-server
systemctl enable glusterfs-server
systemctl start glusterfs-server
# create brick directory
mkdir -p /mnt/gluster
elif [[ $DISTRIB_ID == centos* ]]; then
install_packages $DISTRIB_ID epel-release centos-release-gluster38
sed -i -e "s/enabled=1/enabled=0/g" /etc/yum.repos.d/CentOS-Gluster-3.8.repo
install_packages $DISTRIB_ID --enablerepo=centos-gluster38,epel glusterfs-server
systemctl daemon-reload
chkconfig glusterd on
systemctl start glusterd
# create brick directory
mkdir -p /mnt/resource/gluster
fi
fi
fi
# install storage cluster software
if [ ! -z $sc_args ]; then
if [ $DISTRIB_ID == "ubuntu" ]; then
for sc_arg in ${sc_args[@]}; do
IFS=':' read -ra sc <<< "$sc_arg"
server_type=${sc[0]}
if [ $server_type == "nfs" ]; then
install_packages $DISTRIB_ID nfs-common nfs4-acl-tools
elif [ $server_type == "glusterfs" ]; then
install_packages $DISTRIB_ID glusterfs-client acl
else
echo "ERROR: Unknown file server type ${sc[0]} for ${sc[1]}"
exit 1
fi
done
elif [[ $DISTRIB_ID == centos* ]]; then
for sc_arg in ${sc_args[@]}; do
IFS=':' read -ra sc <<< "$sc_arg"
server_type=${sc[0]}
if [ $server_type == "nfs" ]; then
install_packages $DISTRIB_ID nfs-utils nfs4-acl-tools
systemctl daemon-reload
systemctl enable rpcbind
systemctl start rpcbind
elif [ $server_type == "glusterfs" ]; then
install_packages $DISTRIB_ID epel-release centos-release-gluster38
sed -i -e "s/enabled=1/enabled=0/g" /etc/yum.repos.d/CentOS-Gluster-3.8.repo
install_packages $DISTRIB_ID --enablerepo=centos-gluster38,epel glusterfs-server acl
else
echo "ERROR: Unknown file server type ${sc[0]} for ${sc[1]}"
exit 1
fi
done
if [ $custom_image -eq 0 ]; then
if [ ! -z $sc_args ]; then
if [ $DISTRIB_ID == "ubuntu" ]; then
for sc_arg in ${sc_args[@]}; do
IFS=':' read -ra sc <<< "$sc_arg"
server_type=${sc[0]}
if [ $server_type == "nfs" ]; then
install_packages $DISTRIB_ID nfs-common nfs4-acl-tools
elif [ $server_type == "glusterfs" ]; then
install_packages $DISTRIB_ID glusterfs-client acl
else
echo "ERROR: Unknown file server type ${sc[0]} for ${sc[1]}"
exit 1
fi
done
elif [[ $DISTRIB_ID == centos* ]]; then
for sc_arg in ${sc_args[@]}; do
IFS=':' read -ra sc <<< "$sc_arg"
server_type=${sc[0]}
if [ $server_type == "nfs" ]; then
install_packages $DISTRIB_ID nfs-utils nfs4-acl-tools
systemctl daemon-reload
systemctl enable rpcbind
systemctl start rpcbind
elif [ $server_type == "glusterfs" ]; then
install_packages $DISTRIB_ID epel-release centos-release-gluster38
sed -i -e "s/enabled=1/enabled=0/g" /etc/yum.repos.d/CentOS-Gluster-3.8.repo
install_packages $DISTRIB_ID --enablerepo=centos-gluster38,epel glusterfs-server acl
else
echo "ERROR: Unknown file server type ${sc[0]} for ${sc[1]}"
exit 1
fi
done
fi
fi
fi

Просмотреть файл

@ -1,6 +1,7 @@
param(
[switch] $a, # mount azurefile shares
[String] $e, # encrypted sha1 cert
[switch] $u, # custom image
[String] $v, # batch-shipyard version
[String] $x # blobxfer version
)
@ -28,6 +29,7 @@ Write-Host "---------------------------------------"
Write-Host "Batch Shipyard version: $v"
Write-Host "Blobxfer version: $x"
Write-Host "Mounts path: $MountsPath"
Write-Host "Custom image: $u"
Write-Host "Encrypted: $e"
Write-Host "Azure File: $a"
Write-Host ""