1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-22 22:03:39 +03:00

M #-: Modifications to run & lock locations

* Add run and lock paths to self-contained
* Move oned lock to lock location
* vcenter monitor fifo is created in run location
* vcenter monitor lock is created in lock location
This commit is contained in:
Ruben S. Montero 2020-06-11 13:15:23 +02:00
parent 770cb0d7f5
commit b72a275813
No known key found for this signature in database
GPG Key ID: A0CEA6FA880A1D87
6 changed files with 29 additions and 17 deletions

View File

@ -171,6 +171,8 @@ else
LIB_LOCATION="$ROOT/lib"
ETC_LOCATION="$ROOT/etc"
VAR_LOCATION="$ROOT/var"
RUN_LOCATION="$VAR_LOCATION/run"
LOCK_LOCATION="$VAR_LOCATION/lock"
ONEGATE_LOCATION="$LIB_LOCATION/onegate"
SUNSTONE_LOCATION="$LIB_LOCATION/sunstone"
ONEFLOW_LOCATION="$LIB_LOCATION/oneflow"
@ -213,7 +215,7 @@ else
$INCLUDE_LOCATION $SHARE_LOCATION $SYSTEM_DS_LOCATION \
$DEFAULT_DS_LOCATION $MAN_LOCATION $DOCS_LOCATION \
$VM_LOCATION $ONEGATE_LOCATION $ONEFLOW_LOCATION \
$MAIN_JS_LOCATION $ONEHEM_LOCATION"
$MAIN_JS_LOCATION $ONEHEM_LOCATION $LOCK_LOCATION $RUN_LOCATION"
DELETE_DIRS="$MAKE_DIRS"

View File

@ -49,7 +49,7 @@ else
ONE_SCHEDULER=$ONE_LOCATION/bin/mm_sched
ONE_HEM=$ONE_LOCATION/bin/onehem-server
LOCK_FILE=$ONE_LOCATION/var/.lock
LOCK_FILE=$ONE_LOCATION/var/lock/.lock
fi
KILL_9_SECONDS=10

View File

@ -19,11 +19,13 @@
if [ -z "${ONE_LOCATION}" ]; then
MAD_LOCATION=/usr/lib/one/mads
VAR_LOCATION=/var/lib/one
LOCK_FILE=/var/lock/one/vcenter_monitor
RUN_LOCATION=/var/run/one
LOCK_LOCATION=/var/lock/one/
else
MAD_LOCATION=$ONE_LOCATION/lib/mads
VAR_LOCATION=$ONE_LOCATION/var
LOCK_FILE=$ONE_LOCATION/var/.vcenter_monitor_lock
RUN_LOCATION=$ONE_LOCATION/var/run
LOCK_LOCATION=$ONE_LOCATION/var/lock
fi
export DRIVER_NAME="one_im_sh_${BASH_ARGV##* }"
@ -37,7 +39,8 @@ export DRIVER_NAME="one_im_sh_${BASH_ARGV##* }"
#-------------------------------------------------------------------------------
if [ "${BASH_ARGV##* }" = "vcenter" ]; then
FIFO_PATH="/tmp/vcenter_monitor.fifo"
LOCK_FILE="$LOCK_LOCATION/vcenter_monitor"
FIFO_PATH="$RUN_LOCATION/vcenter_monitor.fifo"
VMON_PATH="$VAR_LOCATION/remotes/im/lib/vcenter_monitor.rb"
# Sanitize previous instances

View File

@ -16,18 +16,25 @@
# limitations under the License. #
#--------------------------------------------------------------------------- #
IO_FIFO_PATH="/tmp/vcenter_monitor.fifo"
if [ -z "$ONE_LOCATION" ]; then
LOG=/var/log/one/vcenter_monitor.log
BIN=/var/lib/one/remotes/im/lib/vcenter_monitor.rb
LOCK_FILE=/var/lock/one/vcenter_monitor
if [ -z "${ONE_LOCATION}" ]; then
MAD_LOCATION=/usr/lib/one/mads
VAR_LOCATION=/var/lib/one
RUN_LOCATION=/var/run/one
LOCK_LOCATION=/var/lock/one
LOG_LOCATION=/var/log/one
else
BIN=$ONE_LOCATION/var/remotes/im/lib/vcenter_monitor.rb
LOG=$ONE_LOCATION/var/vcenter_monitor.log
LOCK_FILE=$ONE_LOCATION/var/.vcenter_monitor_lock
MAD_LOCATION=$ONE_LOCATION/lib/mads
VAR_LOCATION=$ONE_LOCATION/var
RUN_LOCATION=$ONE_LOCATION/var/run
LOCK_LOCATION=$ONE_LOCATION/var/lock
LOG_LOCATION=$ONE_LOCATION/var
fi
LOG="$LOG_LOCATION/vcenter_monitor.log"
LOCK_FILE="$LOCK_LOCATION/vcenter_monitor"
FIFO_PATH="$RUN_LOCATION/vcenter_monitor.fifo"
VMON_PATH="$VAR_LOCATION/remotes/im/lib/vcenter_monitor.rb"
#-------------------------------------------------------------------------------
# Process Arguments
#-------------------------------------------------------------------------------
@ -50,7 +57,7 @@ STDIN=${STDIN//[$'\t\r\n']}
MONITOR_ACTION="$ACTION $HID $STDIN"
flock $LOCK_FILE echo $MONITOR_ACTION > $IO_FIFO_PATH
flock $LOCK_FILE echo $MONITOR_ACTION > $FIFO_PATH
echo "<MONITOR_MESSAGES></MONITOR_MESSAGES>"

View File

@ -184,7 +184,7 @@ int main(int argc, char **argv)
var_location = nl;
var_location += "/var/";
lockfile = var_location + ".lock";
lockfile = var_location + "/lock/.lock";
}
fd = open(lockfile.c_str(), O_CREAT|O_EXCL, 0640);

View File

@ -41,7 +41,7 @@ else
GEMS_LOCATION = ONE_LOCATION + '/share/gems'
VAR_LOCATION = ONE_LOCATION + '/var'
ETC_LOCATION = ONE_LOCATION + '/etc'
LOCK_FILE = VAR_LOCATION + '/.lock'
LOCK_FILE = VAR_LOCATION + '/lock/.lock'
end
ONED_CONF = "#{ETC_LOCATION}/oned.conf"