optimisation and correction
This commit is contained in:
@@ -21,7 +21,7 @@
|
|||||||
# higher priority.
|
# higher priority.
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
export VER_conf_ceph="1.0.0"
|
export VER_conf_ceph="1.0.1"
|
||||||
export DEP_conf_ceph=""
|
export DEP_conf_ceph=""
|
||||||
|
|
||||||
conf_ceph()
|
conf_ceph()
|
||||||
@@ -31,16 +31,12 @@ conf_ceph()
|
|||||||
# Determine the type of installation
|
# Determine the type of installation
|
||||||
if [[ $SYS_ARCH == "x86_64" || $SYS_ARCH == "i386" ]]; then
|
if [[ $SYS_ARCH == "x86_64" || $SYS_ARCH == "i386" ]]; then
|
||||||
export CEPH_STATUS=ceph
|
export CEPH_STATUS=ceph
|
||||||
|
elif [[ -n $SMBSRV ]]; then
|
||||||
|
export CEPH_STATUS=smb
|
||||||
|
elif [[ -n $NFSSRV ]]; then
|
||||||
|
export CEPH_STATUS=nfs
|
||||||
else
|
else
|
||||||
if [[ -n $SMBSRV ]]; then
|
export CEPH_STATUS=none
|
||||||
export CEPH_STATUS=smb
|
|
||||||
else
|
|
||||||
if [[ -n $NFSSRV ]]; then
|
|
||||||
export CEPH_STATUS=nfs
|
|
||||||
else
|
|
||||||
export CEPH_STATUS=none
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $CEPH_STATUS == ceph ]]; then
|
if [[ $CEPH_STATUS == ceph ]]; then
|
||||||
@@ -48,16 +44,18 @@ conf_ceph()
|
|||||||
pkginst ceph-common
|
pkginst ceph-common
|
||||||
|
|
||||||
# hosts files required for Ceph bootstrap when DNS not yet started
|
# hosts files required for Ceph bootstrap when DNS not yet started
|
||||||
if [[ -z $(grep "# Ceph" /etc/hosts) ]]; then
|
if ! grep -q "^# Ceph" /etc/hosts; then
|
||||||
prnt I "Adding server list to /etc/hosts"
|
prnt I "Adding server list to /etc/hosts"
|
||||||
backup_dist /etc/hosts
|
backup_dist /etc/hosts
|
||||||
tag_file /etc/hosts
|
tag_file /etc/hosts
|
||||||
echo >> /etc/hosts
|
echo >> /etc/hosts
|
||||||
echo "# Ceph servers:" >> /etc/hosts
|
echo "# Ceph servers:" >> /etc/hosts
|
||||||
for srv in $CEPH_SRV_NAMES; do
|
for srv in $CEPH_SRV_NAMES; do
|
||||||
local line="$(eval echo \$CEPHIP_$srv) $srv.$REALM $srv"
|
local line
|
||||||
|
line="$(eval echo \$CEPHIP_$srv) $srv.$REALM $srv"
|
||||||
prnt m " - Adding line $line to /etc/hosts"
|
prnt m " - Adding line $line to /etc/hosts"
|
||||||
echo "$line" >> /etc/hosts
|
echo "$line" >> /etc/hosts
|
||||||
|
unset line
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
prnt W "Ceph servers already in /etc/hosts, nothing to do"
|
prnt W "Ceph servers already in /etc/hosts, nothing to do"
|
||||||
@@ -67,18 +65,19 @@ conf_ceph()
|
|||||||
prnt I "Adding ceph entries to /etc/fstab"
|
prnt I "Adding ceph entries to /etc/fstab"
|
||||||
tag_file /etc/fstab
|
tag_file /etc/fstab
|
||||||
echo >> /etc/fstab
|
echo >> /etc/fstab
|
||||||
local srvlist=$(echo $CEPH_SRV_NAMES | sed "s/ /,/g")
|
local srvlist=${CEPH_SRV_NAMES/ /,}
|
||||||
local secret=$(fetch_secret "$CEPH_SECRET")
|
local secret
|
||||||
if [[ -z $(grep $srvlist /etc/fstab) ]]; then
|
secret=$(fetch_secret "$CEPH_SECRET")
|
||||||
|
if ! grep -q "$srvlist" /etc/fstab; then
|
||||||
echo "# Ceph :" >> /etc/fstab
|
echo "# Ceph :" >> /etc/fstab
|
||||||
for mnt in $CEPH_MOUNTS; do
|
for mnt in $CEPH_MOUNTS; do
|
||||||
mkdir -pv $mnt
|
mkdir -pv "$mnt"
|
||||||
echo "$srvlist:/ $(eval echo \$CEPH_MP_$mnt) ceph defaults,_netdev,name=admin,secret=$secret,id=$mnt 0 0" >> /etc/fstab
|
echo "$srvlist:/ $(eval echo \$CEPH_MP_$mnt) ceph defaults,_netdev,name=admin,secret=$secret,id=$mnt 0 0" >> /etc/fstab
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
prnt W "Ceph entry already in /etc/fstab, nothing to do"
|
prnt W "Ceph entry already in /etc/fstab, nothing to do"
|
||||||
fi
|
fi
|
||||||
unset srvlist
|
unset srvlist secret
|
||||||
success=yes
|
success=yes
|
||||||
elif [[ $CEPH_STATUS == smb ]]; then
|
elif [[ $CEPH_STATUS == smb ]]; then
|
||||||
pkginst smbclient
|
pkginst smbclient
|
||||||
@@ -87,7 +86,7 @@ conf_ceph()
|
|||||||
prnt I "Adding Samba entries to /etc/fstab"
|
prnt I "Adding Samba entries to /etc/fstab"
|
||||||
echo >> /etc/fstab
|
echo >> /etc/fstab
|
||||||
tag_file /etc/fstab
|
tag_file /etc/fstab
|
||||||
if [[ -z $(grep $SMBSRV /etc/fstab) ]]; then
|
if ! grep -q "$SMBSRV" /etc/fstab; then
|
||||||
echo "# Samba:" >> /etc/fstab
|
echo "# Samba:" >> /etc/fstab
|
||||||
for mnt in $CEPH_MOUNTS; do
|
for mnt in $CEPH_MOUNTS; do
|
||||||
echo "//$SMBSRV/$mnt $(eval echo \$CEPH_MP_$mnt) cifs defaults,_netdev,username=root,password= 0 0" >> /etc/fstab
|
echo "//$SMBSRV/$mnt $(eval echo \$CEPH_MP_$mnt) cifs defaults,_netdev,username=root,password= 0 0" >> /etc/fstab
|
||||||
@@ -98,7 +97,7 @@ conf_ceph()
|
|||||||
success=yes
|
success=yes
|
||||||
elif [[ $CEPH_STATUS == nfs ]]; then
|
elif [[ $CEPH_STATUS == nfs ]]; then
|
||||||
tag_file /etc/fstab
|
tag_file /etc/fstab
|
||||||
: # To be implemented
|
# To be implemented
|
||||||
elif [[ $CEPH_STATUS == none ]]; then
|
elif [[ $CEPH_STATUS == none ]]; then
|
||||||
prnt W "No alternative set for unsuported hardware, nothing will be done."
|
prnt W "No alternative set for unsuported hardware, nothing will be done."
|
||||||
return 0
|
return 0
|
||||||
@@ -107,9 +106,9 @@ conf_ceph()
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
if [[ $success == yes ]]; then
|
if [[ $success == yes ]]; then
|
||||||
# TODO: Create some mount binds for convenience
|
# Create some mount binds for convenience
|
||||||
# TODO: That part should be a different module with own configuration
|
# TODO: That part should be a different module with own configuration
|
||||||
if [[ -z $(grep "^/srv/ceph/share" /etc/fstab) ]]; then
|
if grep -q "^/srv/ceph/share" /etc/fstab; then
|
||||||
echo "/srv/ceph/share /share none defaults,_netdev,bind 0 0" >> /etc/fstab
|
echo "/srv/ceph/share /share none defaults,_netdev,bind 0 0" >> /etc/fstab
|
||||||
if [[ $SHARED_HOME == 1 ]]; then
|
if [[ $SHARED_HOME == 1 ]]; then
|
||||||
echo "/srv/ceph/share/home /home none defaults,_netdev,bind 0 0" >> /etc/fstab
|
echo "/srv/ceph/share/home /home none defaults,_netdev,bind 0 0" >> /etc/fstab
|
||||||
@@ -123,8 +122,9 @@ conf_ceph()
|
|||||||
# Mount Ceph volumes if required
|
# Mount Ceph volumes if required
|
||||||
prnt I "Mounting ceph volumes"
|
prnt I "Mounting ceph volumes"
|
||||||
for mnt in $CEPH_MOUNTS; do
|
for mnt in $CEPH_MOUNTS; do
|
||||||
if [[ -z $(mount | grep "on $(eval echo "\$CEPH_MP_mnt)")" ]]; then
|
if ! mountpoint -q "$(eval echo \$CEPH_MP_$mnt)"; then
|
||||||
mount -v $(eval echo "\$CEPH_MP_mnt)")
|
mount -v "$(eval echo \$CEPH_MP_$mnt)" ||
|
||||||
|
prnt W "Error while mounting CEPH filesystem (check CEPH logs), ignoring"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
@@ -145,7 +145,7 @@ precheck_conf_ceph()
|
|||||||
done
|
done
|
||||||
if [[ -z $CEPH_SECRET ]]; then
|
if [[ -z $CEPH_SECRET ]]; then
|
||||||
prnt E "CEPH secret key is not declared, can't continue!"
|
prnt E "CEPH secret key is not declared, can't continue!"
|
||||||
prnt I "If you don't want to put tour CEPH secret in configuration file,"
|
prnt I "If you don't want to put a CEPH secret var in configuration file,"
|
||||||
prnt m "you need to export it temporarily in your environment, using the"
|
prnt m "you need to export it temporarily in your environment, using the"
|
||||||
prnt m "\"CEPH_SECRET\" variable."
|
prnt m "\"CEPH_SECRET\" variable."
|
||||||
die 181
|
die 181
|
||||||
@@ -159,7 +159,7 @@ precheck_conf_ceph()
|
|||||||
die 182
|
die 182
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
prnt W "System incompatible with ceph, falling back to samba..."
|
prnt W "System incompatible with ceph, falling back to Samba or NFS..."
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user