-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathinit_infoscale.include
More file actions
1721 lines (1466 loc) · 47.5 KB
/
init_infoscale.include
File metadata and controls
1721 lines (1466 loc) · 47.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#/bin/bash
if [[ $0 == *.include ]] ; then
CUR_FILENAME="${0##*/}"
echo "ERROR: $0 is an include file for ${CUR_FILENAME%.*}.sh"
exit 5
fi
# disable the parameter "all"
#
DISABLE_THE_PARAMETER_ALL=${__TRUE}
# OS executables
#
SERVICE="/usr/sbin/service"
RPM="/usr/bin/rpm"
# Infoscale executables
#
UUIDCONFIG="/opt/VRTSvcs/bin/uuidconfig.pl"
VXDCTL="/usr/sbin/vxdctl"
VXIOD="/usr/sbin/vxiod"
VXCONFIGD="/usr/sbin/vxconfigd"
VXKEYLESS="/opt/VRTS/bin/vxkeyless"
VXLICREP="/usr/sbin/vxlicrep"
VXLICINST="/usr/sbin/vxlicinst"
HASTATUS="/opt/VRTSvcs/bin/hastatus"
LLTPING="/opt/VRTSllt/lltping"
LLTCONFIG="/usr/sbin/lltconfig"
GABCONFIG="/sbin/gabconfig"
# Infoscale config files
#
LLTHOSTS="/etc/llthosts"
LLTTAB="/etc/llttab"
GABTAB="/etc/gabtab"
VXVM_INSTALL_DB_FILE="/etc/vx/reconfig.d/state.d/install-db"
UUID_DIRECTORY="/etc/vx/.uuids"
UUID_FILE="${UUID_DIRECTORY}/clusuuid"
VCS_DIR="/opt/VRTSvcs"
VCS_BIN_DIR="${VCS_DIR}/bin/"
LICENSE_KEYS_FOUND_IN_RCM=${__FALSE}
LICENSEKEY=""
LICENSEKEY_FS=""
LICENSEKEY_VM=""
LICENSEKEY_VCS=""
INFOSCALE_TEST_LICENSE_TYPE=""
LIST_OF_LICENSES_FOUND_IN_RCM=""
# ----------------------------------------------------------------------
# task_read_infoscale_license_from_rcm
#
# function: task_read_infoscale_license_from_rcm
#
# usage: task_read_infoscale_license_from_rcm [hostid] [rcm_service] [rcm_function] # def: RCM_HOSTID RCM_VERSION RCM_FUNCTION
#
# returns: ${__TRUE} - ok executing the task
# ${__FALSE} - error executing the task
#
#
function task_read_infoscale_license_from_rcm {
typeset __FUNCTION="task_cdread_license_from_rcm"
typeset TASK_USAGE="${__FUNCTION} [hostid] # def: read license for this host"
${__DEBUG_CODE}
${__FUNCTION_INIT}
typeset THISRC=${__TRUE}
typeset CUR_OUTPUT=""
typeset TEMPRC=""
typeset CUR_KEY=""
typeset CUR_VALUE=""
# save the RCM variables
#
typeset ORIGINAL_HOSTID="${RCM_HOSTID}"
typeset ORIGINAL_RCM_SERVICE="${RCM_SERVICE}"
typeset ORIGINAL_RCM_FUNCTION="${RCM_FUNCTION}"
if [ ${THISRC} = ${__TRUE} ] ; then
RCM_SERVICE="${2:-veritas}"
RCM_FUNCTION="${3:-SFHA}"
RCM_HOSTID="${1:-${ORIGINAL_HOSTID}}"
check_rcm_values
if [ $? -ne 0 ] ; then
LogError "Error initiating the RCM support"
THISRC=${__FALSE}
fi
fi
if [ ${THISRC} = ${__TRUE} ] ; then
LogMsg "Reading the license for the host \"${RCM_HOSTID}\" from the RCM ..."
Read_APPL_PARAMS_entries
if [ "${FOUND_APPL_PARAM_ENTRY_KEYS}"x = ""x ] ; then
LogError "No RCM configuration found"
THISRC=${__FALSE}
fi
fi
#U# ----------------------------------------------------------------------
#U#
#U# Supported RCM APPL_PARAMS entries
#U#
#U# NAME VALUE
#U# ----------------------------------------------------------------------
#U# VAR:<name> value for the variable <name>
#U# licensekey InfoScale License SFHA
#U# licensekey_fs InfoScale License for Filesystem
#U# licensekey_vm InfoScale License for Volume Manager
#U# licensekey_vcs InfoScale License for Veritas Cluster
#U# demo_license type of the demo license
#U#
#U#
if [ ${THISRC} = ${__TRUE} ] ; then
LogMsg "Processing the configuration found in the RCM ..."
LICENSE_KEYS_FOUND_IN_RCM=${__FALSE}
i=0
while [ $i -lt RCM_APPL_PARAMS_KEY[0] ] ; do
(( i = i + 1 ))
CUR_KEY="${RCM_APPL_PARAMS_KEY[$i]}"
CUR_VALUE="${RCM_APPL_PARAMS_VAL[$i]}"
LogMsg " Processing the entry \"${CUR_KEY} = ${CUR_VALUE}\" ..."
case ${CUR_KEY} in
"licensekey" )
LogMsg "APPL_PARAMS entry \"${CUR_KEY}\" found: ${CUR_VALUE}"
LICENSEKEY="${CUR_VALUE}"
LICENSE_KEYS_FOUND_IN_RCM=${__TRUE}
LIST_OF_LICENSES_FOUND_IN_RCM="${LIST_OF_LICENSES_FOUND_IN_RCM} ${CUR_VALUE}"
;;
"licensekey_fs" )
LogMsg "APPL_PARAMS entry \"${CUR_KEY}\" found: ${CUR_VALUE}"
LICENSEKEY_FS="${CUR_VALUE}"
LICENSE_KEYS_FOUND_IN_RCM=${__TRUE}
LIST_OF_LICENSES_FOUND_IN_RCM="${LIST_OF_LICENSES_FOUND_IN_RCM} ${CUR_VALUE}"
;;
"licensekey_vm" )
LogMsg "APPL_PARAMS entry \"${CUR_KEY}\" found: ${CUR_VALUE}"
LICENSEKEY_VM="${CUR_VALUE}"
LICENSE_KEYS_FOUND_IN_RCM=${__TRUE}
LIST_OF_LICENSES_FOUND_IN_RCM="${LIST_OF_LICENSES_FOUND_IN_RCM} ${CUR_VALUE}"
;;
"licensekey_vcs" )
LogMsg "APPL_PARAMS entry \"${CUR_KEY}\" found: ${CUR_VALUE}"
LICENSEKEY_VCS="${CUR_VALUE}"
LICENSE_KEYS_FOUND_IN_RCM=${__TRUE}
LIST_OF_LICENSES_FOUND_IN_RCM="${LIST_OF_LICENSES_FOUND_IN_RCM} ${CUR_VALUE}"
;;
"demo_license" )
LogMsg "APPL_PARAMS entry \"${CUR_KEY}\" found: ${CUR_VALUE}"
INFOSCALE_TEST_LICENSE_TYPE="${CUR_VALUE}"
;;
"#"* )
LogMsg "Comment entry found: \"${CUR_KEY}\" = \"${CUR_VALUE}\" and ignored"
;;
"VAR:"* )
LogMsg " --- Variable assignment found in the RCM:"
VAR_NAME="${CUR_KEY#*:}"
LogMsg " --- Current value of ${VAR_NAME} is: \"$( eval echo \$${VAR_NAME} )\" "
set -x
eval ${VAR_NAME}="${CUR_VALUE}"
set +x
LogMsg " --- Current value of ${VAR_NAME} is now: \"$( eval echo \$${VAR_NAME} )\" "
;;
* )
LogWarning "Unknown RCM APPL_PARAMS entry found: \"${CUR_KEY}\" = \"${CUR_VALUE}\" "
;;
esac
done
fi
if [ ${LICENSE_KEYS_FOUND_IN_RCM} = ${__TRUE} ]; then
THISRC=${__TRUE}
LogMsg "-"
LogMsg "License keys found in the RCM are:"
if [ "${LICENSEKEY}"x != ""x ] ; then
LogMsg "Infoscale license for \"all\" found : \"${LICENSEKEY}\" "
fi
if [ "${LICENSEKEY_FS}"x != ""x ] ; then
LogMsg "Infoscale license for \"VxFS\" found : \"${LICENSEKEY_FS}\" "
fi
if [ "${LICENSEKEY_VM}"x != ""x ] ; then
LogMsg "Infoscale license for \"VxVM\" found : \"${LICENSEKEY_VM}\" "
fi
if [ "${LICENSEKEY_VCS}"x != ""x ] ; then
LogMsg "Infoscale license for \"VCS\" found : \"${LICENSEKEY_VCS}\" "
fi
else
LogError "No Infoscale licenses found in the RCM"
THISRC=${__FALSE}
fi
# restore the RCM variables
#
RCM_HOSTID="${ORIGINAL_HOSTID}"
RCM_SERVICE="${ORIGINAL_RCM_SERVICE}"
RCM_FUNCTION="${ORIGINAL_RCM_FUNCTION}"
return ${THISRC}
}
# ----------------------------------------------------------------------
# task_install_infoscale_license
#
# function: task_install_infoscale_license
#
# usage: task_install_infoscale_license licensekey
#
# returns: ${__TRUE} - ok executing the task
# ${__FALSE} - error executing the task
#
#
function task_install_infoscale_license {
typeset __FUNCTION="task_install_infoscale_license"
typeset TASK_USAGE="${__FUNCTION} [licensekey# [...]] # def: ask user; use 'rcm' to read the license from the RCM "
${__DEBUG_CODE}
${__FUNCTION_INIT}
typeset THISRC=${__TRUE}
typeset CUR_OUTPUT=""
typeset TEMPRC=""
typeset NEW_LICENSE="$1"
typeset CUR_LICENSE=""
if [ ${THISRC} = ${__TRUE} ] ; then
if [ ! -x "${VXLICINST}" ] ; then
LogError "${VXLICINST} not found or not executable"
THISRC=${__FALSE}
fi
fi
if [ ${THISRC} = ${__TRUE} ] ; then
if [ "${NEW_LICENSE}"x = "rcm"x -o "${NEW_LICENSE}"x = "RCM"x ] ; then
LogMsg "Reading the Infoscale license from the RCM ..."
task_read_infoscale_license_from_rcm
if [ "${LIST_OF_LICENSES_FOUND_IN_RCM}"x = ""x ] ; then
LogError "No Infoscale licenses found in the RCM"
THISRC=${__FALSE}
else
NEW_LICENSE="${LIST_OF_LICENSES_FOUND_IN_RCM}"
fi
fi
fi
if [ ${THISRC} = ${__TRUE} ] ; then
for CUR_LICENSE in ${NEW_LICENSE} ; do
LogMsg "Installing the Infoscale license \"${CUR_LICENSE}\" ..."
CUR_OUTPUT="$( set -x ; ${VXLICINST} -q -k "${CUR_LICENSE}" 2>$1 )"
TEMPRC=$?
LogMsg "-" "${CUR_OUTPUT}"
LogMsg "-"
if [ ${TEMPRC} -ne 0 ] ; then
LogError "Error installing the license \"${CUR_LICENSE}\" (RC=${TEMPRC})"
THISRC=${__FALSE}
fi
done
fi
return ${THISRC}
}
# ----------------------------------------------------------------------
# task_add_opt_VRTSVCS_bin_to_path_variable
#
# function: add the directory /opt/VRTSvcs/bin to the PATH variable
#
# usage: task_add_opt_VRTSVCS_bin_to_path_variable
#
# returns: ${__TRUE} - ok executing the task
# ${__FALSE} - error executing the task
#
#
function task_add_opt_VRTSVCS_bin_to_path_variable {
typeset __FUNCTION="task_add_opt_VRTSVCS_bin_to_path_variable"
typeset TASK_USAGE="${__FUNCTION} "
${__DEBUG_CODE}
${__FUNCTION_INIT}
typeset THISRC=${__TRUE}
typeset CUR_OUTPUT=""
typeset TEMPRC=""
typeset NEW_PATH="${VCS_BIN_DIR}"
typeset ETC_PROFILE="/etc/profile"
LogMsg "Checking if \"${NEW_PATH}\" is in the PATH variable in ${ETC_PROFILE} .."
( . "${ETC_PROFILE}" ; echo ":${PATH}:" | grep ":${NEW_PATH}:" >/dev/null )
if [ $? -eq 0 ] ; then
LogMsg " \"${NEW_PATH}\" is already in the PATH variable in ${ETC_PROFILE} "
else
LogMsg "Adding \"${NEW_PATH}\" to the PATH variable in ${ETC_PROFILE} ..."
CUR_OUTPUT="$( exec 2>&1 ; set -x ; cp "${ETC_PROFILE}" "${ETC_PROFILE}.$$" && echo "PATH=\$PATH:${NEW_PATH} ; export PATH ">>"${ETC_PROFILE}" )"
[ $? -ne 0 ] && THISRC=${__FALSE}
fi
return ${THISRC}
}
# ----------------------------------------------------------------------
# task_create_llthosts
#
# function: create the llthosts
#
# usage: task_create_llthosts [clusternode0 [clusternode1]]
#
# returns: ${__TRUE} - ok executing the task
# ${__FALSE} - error executing the task
#
#
function task_create_llthosts {
typeset __FUNCTION="task_create_llthosts"
typeset TASK_USAGE="${__FUNCTION} [clusternode0 [clusternode1]] # def: ask user"
${__DEBUG_CODE}
${__FUNCTION_INIT}
typeset THISRC=${__TRUE}
typeset CUR_OUTPUT=""
typeset TEMPRC=""
typeset CLUSTER_NODE0="$1"
typeset CLUSTER_NODE1="$2"
while [ "${CLUSTER_NODE0}"x = ""x ] ; do
AskUser "Please enter the name of the cluster node 0 (\"exit\" to abort):"
if [ "${USER_INPUT}"x = "exit"x ] ; then
break
elif [ "${USER_INPUT}"x != ""x ] ; then
CLUSTER_NODE0="${USER_INPUT}"
fi
done
while [ "${CLUSTER_NODE0}"x != ""x -a "${CLUSTER_NODE1}"x = ""x ] ; do
AskUser "Please enter the name of the cluster node 1 (\"exit\" to abort):"
if [ "${USER_INPUT}"x = "exit"x ] ; then
break
elif [ "${USER_INPUT}"x != ""x ] ; then
CLUSTER_NODE1="${USER_INPUT}"
fi
done
if [ "${CLUSTER_NODE0}"x != ""x -a "${CLUSTER_NODE1}"x != ""x ] ; then
CUR_OUTPUT="0 ${CLUSTER_NODE0}
1 ${CLUSTER_NODE1}
"
LogMsg "# The contents for the file \"${LLTHOSTS}\" are:"
LogMsg "-" "${CUR_OUTPUT}"
if [ -r "${LLTHOSTS}" ] ; then
LogError "The file \"${LLTHOSTS}\" already exists with these contents:"
LogMsg "-" "$( cat "${LLTHOSTS}" )"
THISRC=${__FALSE}
else
LogMsg "Creating the file \"${LLTHOSTS}\" ..."
echo "${CUR_OUTPUT}" >"${LLTHOSTS}" || THISRC=${__FALSE}
fi
else
LogMsg "Creating the file \"${LLTHOSTS}\" aborted by the user"
THISRC=${__FALSE}
fi
return ${THISRC}
}
# ----------------------------------------------------------------------
# task_create_llttab
#
# function: create the llttab
#
# usage: task_create_llttab [clusternode clusterno icadapter1 icadapter2 lowpriadapter]
#
# returns: ${__TRUE} - ok executing the task
# ${__FALSE} - error executing the task
#
#
function task_create_llttab {
typeset __FUNCTION="task_create_llttab"
typeset TASK_USAGE="${__FUNCTION} clusternode clusterno icadapter1 icadapter2 lowpriadapter # def: ask user"
${__DEBUG_CODE}
${__FUNCTION_INIT}
typeset THISRC=${__TRUE}
typeset CUR_OUTPUT=""
typeset TEMPRC=""
typeset CLUSTERNODE="$1"
typeset CLUSTERNO="$2"
typeset ICADAPTER1="$3"
typeset ICADAPTER2="$4"
typeset LOWPRIADPATER="$5"
while [ ${THISRC} = ${__TRUE} -a "${CLUSTERNODE}"x = ""x ] ; do
AskUser "Please enter the name of the cluster (\"exit\" to abort):"
if [ "${USER_INPUT}"x = "exit"x ] ; then
THISRC=${__FALSE}
break
elif [ "${USER_INPUT}"x != ""x ] ; then
CLUSTERNODE="${USER_INPUT}"
fi
done
while [ ${THISRC} = ${__TRUE} -a "${CLUSTERNO}"x = ""x ] ; do
AskUser "Please enter the cluster number (\"exit\" to abort):"
if [ "${USER_INPUT}"x = "exit"x ] ; then
THISRC=${__FALSE}
break
elif [ "${USER_INPUT}"x != ""x ] ; then
CLUSTERNO="${USER_INPUT}"
fi
done
while [ ${THISRC} = ${__TRUE} -a "${ICADAPTER1}"x = ""x ] ; do
AskUser "Please enter the network adapter used for the interconnect1 (\"exit\" to abort, \"list\" to list the existing adapter):"
if [ "${USER_INPUT}"x = "list"x ] ; then
LogMsg "Known network adapter are:"
CUR_OUTPUT="$( ip link list )"
LogMsg "-" "${CUR_OUTPUT}"
elif [ "${USER_INPUT}"x = "exit"x ] ; then
THISRC=${__FALSE}
break
elif [ "${USER_INPUT}"x != ""x ] ; then
ip link list "${USER_INPUT}" 2>/dev/null 1>/dev/null
if [ $? -ne 0 ] ; then
LogError "The adapter \"${USER_INPUT}\" does not exist"
else
ICADAPTER1="${USER_INPUT}"
fi
fi
done
while [ ${THISRC} = ${__TRUE} -a "${ICADAPTER2}"x = ""x ] ; do
AskUser "Please enter the network adapter used for the interconnect2 (\"exit\" to abort, \"list\" to list the existing adapter):"
if [ "${USER_INPUT}"x = "list"x ] ; then
LogMsg "Known network adapter are:"
CUR_OUTPUT="$( ip link list )"
LogMsg "-" "${CUR_OUTPUT}"
elif [ "${USER_INPUT}"x = "exit"x ] ; then
THISRC=${__FALSE}
break
elif [ "${USER_INPUT}"x != ""x ] ; then
ip link list "${USER_INPUT}" 2>/dev/null 1>/dev/null
if [ $? -ne 0 ] ; then
LogError "The adapter \"${USER_INPUT}\" does not exist"
else
ICADAPTER2="${USER_INPUT}"
fi
fi
done
while [ ${THISRC} = ${__TRUE} -a "${LOWPRIADPATER}"x = ""x ] ; do
AskUser "Please enter the network adapter used for the lowpri interconnect (\"exit\" to abort, \"list\" to list the existing adapter):"
if [ "${USER_INPUT}"x = "list"x ] ; then
LogMsg "Known network adapter are:"
CUR_OUTPUT="$( ip link list )"
LogMsg "-" "${CUR_OUTPUT}"
elif [ "${USER_INPUT}"x = "exit"x ] ; then
THISRC=${__FALSE}
break
elif [ "${USER_INPUT}"x != ""x ] ; then
ip link list "${USER_INPUT}" 2>/dev/null 1>/dev/null
if [ $? -ne 0 ] ; then
LogError "The adapter \"${USER_INPUT}\" does not exist"
else
LOWPRIADPATER="${USER_INPUT}"
fi
fi
done
CUR_OUTPUT="
set-node ${CLUSTERNODE}
set-cluster ${CLUSTERNO}
link ${ICADAPTER1} eth-$( ip link list ${ICADAPTER1} | grep ether | awk '{ print $2 }' ) - ether - -
link ${ICADAPTER2} eth-$( ip link list ${ICADAPTER2} | grep ether | awk '{ print $2 }' ) - ether - -
link ${LOWPRIADPATER} eth-$( ip link list ${LOWPRIADPATER} | grep ether | awk '{ print $2 }' ) - ether - -
include 0-1
"
LogMsg "# The contents for the file \"${LLTTAB}\" are:"
LogMsg "-" "${CUR_OUTPUT}"
if [ -r "${LLTTAB}" ] ; then
LogError "The file \"${LLTTAB}\" already exists with these contents:"
LogMsg "-" "$( cat "${LLTTAB}" )"
THISRC=${__FALSE}
else
LogMsg "Creating the file \"${LLTTAB}\" ..."
echo "${CUR_OUTPUT}" >"${LLTTAB}" || THISRC=${__FALSE}
fi
return ${THISRC}
}
# ----------------------------------------------------------------------
# task_check_gab_config_files
#
# function: check the gab config files
#
# usage: task_check_gab_config_files
#
# returns: ${__TRUE} - ok executing the task
# ${__FALSE} - error executing the task
#
#
function task_check_gab_config_files {
typeset __FUNCTION="task_check_gab_config_files"
typeset TASK_USAGE="${__FUNCTION} "
${__DEBUG_CODE}
${__FUNCTION_INIT}
typeset THISRC=${__TRUE}
typeset CUR_OUTPUT=""
typeset TEMPRC=""
typeset TEMPVAR=""
typeset GABTAB_CONTENT=""
LogMsg "Checking the gab config files ..."
LogMsg "-"
LogMsg "Checking the file \"${LLTHOSTS}\" ..."
if [ ! -r "${GABTAB}" ] ; then
LogError "The file \"${GABTAB}\" does not exist"
THISRC=${__FALSE}
else
LogMsg "The file \"${GABTAB}\" exists:"
LogMsg "-" "$( ls -l "${GABTAB}" )"
LogMsg "-"
LogMsg "File Contents are:"
GABTAB_CONTENT="$( cat "${GABTAB}" )"
LogMsg "-" "${GABTAB_CONTENT}"
LogMsg "-"
echo "${GABTAB_CONTENT}" grep "^${GABCONFIG} " | grep -- "-n ${CLUSTER_NODES}" >/dev/null
if [ $? -ne 0 ] ; then
LogError "The file \"${GABTAB}\" looks strange - please check the file contents manually"
THISRC=${__FALSE}
else
LogMsg "The file \"${GABTAB}\" looks okay"
fi
fi
return ${THISRC}
}
# ----------------------------------------------------------------------
# task_check_llt_config_files
#
# function: check the llt config files
#
# usage: task_check_llt_config_files
#
# returns: ${__TRUE} - ok executing the task
# ${__FALSE} - error executing the task
#
#
function task_check_llt_config_files {
typeset __FUNCTION="task_check_llt_config_files"
typeset TASK_USAGE="${__FUNCTION} "
${__DEBUG_CODE}
${__FUNCTION_INIT}
typeset THISRC=${__TRUE}
typeset CUR_OUTPUT=""
typeset TEMPRC=""
typeset TEMPVAR=""
typeset LLTTAB_CONTENT=""
typeset LLTHOSTS_CONTENT=""
typeset CUR_MAC_ADDRESS=""
LogMsg "Checking the llt config files ..."
LogMsg "-"
LogMsg "Checking the file \"${LLTHOSTS}\" ..."
if [ ! -r "${LLTHOSTS}" ] ; then
LogError "The file \"${LLTHOSTS}\" does not exist"
THISRC=${__FALSE}
else
LogMsg "The file \"${LLTHOSTS}\" exists:"
LogMsg "-" "$( ls -l "${LLTHOSTS}" )"
LogMsg "-"
LogMsg "File Contents are:"
LLTHOSTS_CONTENT="$( cat "${LLTHOSTS}" )"
LogMsg "-" "${LLTHOSTS_CONTENT}"
LogMsg "-"
echo "${LLTHOSTS_CONTENT}" | grep "${CUR_SHORT_HOST}" >/dev/null
if [ $? -ne 0 ] ; then
LogWarning "${CUR_SHORT_HOST} not found in \"${LLTHOSTS}\" "
fi
echo "${LLTHOSTS_CONTENT}" | grep "^0 " >/dev/null
if [ $? -ne 0 ] ; then
LogWarning "No definition for cluster node 0 found in \"${LLTHOSTS}\" "
fi
echo "${LLTHOSTS_CONTENT}" | grep "^1 " >/dev/null
if [ $? -ne 0 ] ; then
LogWarning "No definition for cluster node 1 found in \"${LLTHOSTS}\" "
fi
if [ ${THISRC} = ${__TRUE} ] ; then
LogMsg "The file \"${LLTHOSTS}\" looks okay"
else
LogError "The file \"${LLTHOSTS}\" looks suspicious"
fi
fi
LogMsg "-"
LogMsg "Checking the file \"${LLTTAB}\" ..."
if [ ! -r "${LLTTAB}" ] ; then
LogError "The file \"${LLTTAB}\" does not exist"
THISRC=${__FALSE}
else
LogMsg "The file \"${LLTTAB}\" exists:"
LogMsg "-" "$( ls -l "${LLTTAB}" )"
LogMsg "-"
LogMsg "File Contents are:"
LLTTAB_CONTENT="$( cat "${LLTTAB}" )"
LogMsg "-" "${LLTTAB_CONTENT}"
LogMsg "-"
TEMPVAR="$( echo "${LLTTAB_CONTENT}" | grep ^set-cluster | awk '{print $2 };' )"
if [ "${TEMPVAR}"x = ""x ] ; then
LogError "The \"set-cluster\" statement is missing in the file \"${LLTTAB}\" "
THISRC=${__FALSE}
else
LogMsg "The \"set-cluster\" statement is in the file \"${LLTTAB}\"; the value is \"${TEMPVAR}\" "
fi
TEMPVAR="$( echo "${LLTTAB_CONTENT}" | grep ^set-node | awk '{print $2 };' )"
if [ "${TEMPVAR}"x = ""x ] ; then
LogError "The \"set-node\" statement is missing in the file \"${LLTTAB}\" "
THISRC=${__FALSE}
else
echo "${LLTHOSTS_CONTENT}" | grep " ${TEMPVAR}$" >/dev/null
if [ $? -eq 0 ] ; then
LogMsg "OK, the nodename \"${TEMPVAR}\" from the file \"${LLTTAB}\" is configured in the file \"${LLTHOSTS}\" "
else
LogError "The nodename \"${TEMPVAR}\" from the file \"${LLTTAB}\" is not configured in the file \"${LLTHOSTS}\" "
THISRC=${__FALSE}
fi
fi
for CUR_MAC_ADDRESS in $( echo "${LLTTAB_CONTENT}" | grep "eth-" | awk '{print $3};' | sed "s/eth-//g" ) ; do
ip link list | grep "${CUR_MAC_ADDRESS}" >/dev/null
if [ $? -ne 0 ] ; then
LogError "The mac address \"${CUR_MAC_ADDRESS}\" used in the file \"${LLTTAB}\" does not belong to an existing network adapter"
THISRC=${__FALSE}
else
LogMsg "The mac address \"${CUR_MAC_ADDRESS}\" used in the file \"${LLTTAB}\" belongs to an existing network adapter"
fi
done
if [ ${THISRC} = ${__TRUE} ] ; then
LogMsg "The file \"${LLTHOSTS}\" looks okay"
else
LogError "The file \"${LLTHOSTS}\" looks suspicious"
fi
fi
return ${THISRC}
}
# ----------------------------------------------------------------------
# task_start_gab
#
# function: start the gab daemon
#
# usage: task_start_gab
#
# returns: ${__TRUE} - ok executing the task
# ${__FALSE} - error executing the task
#
#
function task_start_gab {
typeset __FUNCTION="task_start_gab"
typeset TASK_USAGE="${__FUNCTION}"
${__DEBUG_CODE}
${__FUNCTION_INIT}
typeset THISRC=${__TRUE}
typeset CUR_OUTPUT=""
typeset TEMPRC=""
typeset CUR_SERVICE="gab"
typeset CUR_SERVICE_NAME="gab daemon"
LogMsg "Starting the ${CUR_SERVICE_NAME} ..."
if [ ! -x "${SERVICE}" ] ; then
LogError "${SERVICE} not found or not executable"
THISRC=${__FALSE}
else
LogMsg "Checking if the ${CUR_SERVICE_NAME} is already running ..."
CUR_OUTPUT="$( set -x ; ${SERVICE} ${CUR_SERVICE} status 2>&1 )"
TEMPRC=$?
LogMsg "-" "${CUR_OUTPUT}"
if [ ${TEMPRC} = 0 ] ; then
LogMsg "The ${CUR_SERVICE_NAME} is already running"
else
LogMsg "The ${CUR_SERVICE_NAME} is not running; now starting the ${CUR_SERVICE_NAME} ..."
CUR_OUTPUT="$( set -x ; ${SERVICE} ${CUR_SERVICE} start 2>&1 )"
TEMPRC=$?
LogMsg "-" "${CUR_OUTPUT}"
LogMsg "Checking the status of the ${CUR_SERVICE_NAME} ..."
CUR_OUTPUT="$( set -x ; ${SERVICE} ${CUR_SERVICE} status 2>&1 )"
TEMPRC=$?
LogMsg "-" "${CUR_OUTPUT}"
if [ ${TEMPRC} = 0 ] ; then
LogMsg "The ${CUR_SERVICE_NAME} is now running"
else
LogError "Error starting the ${CUR_SERVICE_NAME}"
THISRC=${__FALSE}
fi
fi
fi
return ${THISRC}
}
# ----------------------------------------------------------------------
# task_stop_gab
#
# function: stop the gab daemon
#
# usage: task_stop_gab
#
# returns: ${__TRUE} - ok executing the task
# ${__FALSE} - error executing the task
#
#
function task_stop_gab {
typeset __FUNCTION="task_stop_gab"
typeset TASK_USAGE="${__FUNCTION}"
${__DEBUG_CODE}
${__FUNCTION_INIT}
typeset THISRC=${__TRUE}
typeset CUR_OUTPUT=""
typeset TEMPRC=""
typeset CUR_SERVICE="gab"
typeset CUR_SERVICE_NAME="gab daemon"
LogMsg "Stopping the ${CUR_SERVICE_NAME} ..."
if [ ! -x "${SERVICE}" ] ; then
LogError "${SERVICE} not found or not executable"
THISRC=${__FALSE}
else
LogMsg "Checking if the ${CUR_SERVICE_NAME} is already stopped ..."
CUR_OUTPUT="$( set -x ; ${SERVICE} ${CUR_SERVICE} status 2>&1 )"
TEMPRC=$?
LogMsg "-" "${CUR_OUTPUT}"
if [ ${TEMPRC} != 0 ] ; then
LogMsg "The ${CUR_SERVICE_NAME} is not running"
else
LogMsg "The ${CUR_SERVICE_NAME} is running; now stopping the ${CUR_SERVICE_NAME} ..."
CUR_OUTPUT="$( set -x ; ${SERVICE} ${CUR_SERVICE} stop 2>&1 )"
TEMPRC=$?
LogMsg "-" "${CUR_OUTPUT}"
LogMsg "Checking the status of the ${CUR_SERVICE_NAME} ..."
CUR_OUTPUT="$( set -x ; ${SERVICE} ${CUR_SERVICE} status 2>&1 )"
TEMPRC=$?
LogMsg "-" "${CUR_OUTPUT}"
if [ ${TEMPRC} != 0 ] ; then
LogMsg "The ${CUR_SERVICE_NAME} is now stopped"
else
LogError "Error stopping the ${CUR_SERVICE_NAME}"
THISRC=${__FALSE}
fi
fi
fi
return ${THISRC}
}
# ----------------------------------------------------------------------
# task_start_llt
#
# function: start the llt daemon
#
# usage: task_start_llt
#
# returns: ${__TRUE} - ok executing the task
# ${__FALSE} - error executing the task
#
#
function task_start_llt {
typeset __FUNCTION="task_start_llt"
typeset TASK_USAGE="${__FUNCTION}"
${__DEBUG_CODE}
${__FUNCTION_INIT}
typeset THISRC=${__TRUE}
typeset CUR_OUTPUT=""
typeset TEMPRC=""
typeset CUR_SERVICE="llt"
typeset CUR_SERVICE_NAME="llt daemon"
LogMsg "Starting the ${CUR_SERVICE_NAME} ..."
if [ ! -x "${SERVICE}" ] ; then
LogError "${SERVICE} not found or not executable"
THISRC=${__FALSE}
else
LogMsg "Checking if the ${CUR_SERVICE_NAME} is already running ..."
CUR_OUTPUT="$( set -x ; ${SERVICE} ${CUR_SERVICE} status 2>&1 )"
TEMPRC=$?
LogMsg "-" "${CUR_OUTPUT}"
if [ ${TEMPRC} = 0 ] ; then
LogMsg "The ${CUR_SERVICE_NAME} is already running"
else
LogMsg "The ${CUR_SERVICE_NAME} is not running; now starting the ${CUR_SERVICE_NAME} ..."
CUR_OUTPUT="$( set -x ; ${SERVICE} ${CUR_SERVICE} start 2>&1 )"
TEMPRC=$?
LogMsg "-" "${CUR_OUTPUT}"
LogMsg "Checking the status of the ${CUR_SERVICE_NAME} ..."
CUR_OUTPUT="$( set -x ; ${SERVICE} ${CUR_SERVICE} status 2>&1 )"
TEMPRC=$?
LogMsg "-" "${CUR_OUTPUT}"
if [ ${TEMPRC} = 0 ] ; then
LogMsg "The ${CUR_SERVICE_NAME} is now running"
else
LogError "Error starting the ${CUR_SERVICE_NAME}"
THISRC=${__FALSE}
fi
fi
fi
return ${THISRC}
}
# ----------------------------------------------------------------------
# task_stop_llt
#
# function: stop the llt daemon
#
# usage: task_stop_llt
#
# returns: ${__TRUE} - ok executing the task
# ${__FALSE} - error executing the task
#
#
function task_stop_llt {
typeset __FUNCTION="task_stop_llt"
typeset TASK_USAGE="${__FUNCTION}"
${__DEBUG_CODE}
${__FUNCTION_INIT}
typeset THISRC=${__TRUE}
typeset CUR_OUTPUT=""
typeset TEMPRC=""
typeset CUR_SERVICE="llt"
typeset CUR_SERVICE_NAME="llt daemon"
LogMsg "Stopping the ${CUR_SERVICE_NAME} ..."
if [ ! -x "${SERVICE}" ] ; then
LogError "${SERVICE} not found or not executable"
THISRC=${__FALSE}
else
LogMsg "Checking if the ${CUR_SERVICE_NAME} is already stopped ..."
CUR_OUTPUT="$( set -x ; ${SERVICE} ${CUR_SERVICE} status 2>&1 )"
TEMPRC=$?
LogMsg "-" "${CUR_OUTPUT}"
if [ ${TEMPRC} != 0 ] ; then
LogMsg "The ${CUR_SERVICE_NAME} is not running"
else
LogMsg "The ${CUR_SERVICE_NAME} is running; now stopping the ${CUR_SERVICE_NAME} ..."
CUR_OUTPUT="$( set -x ; ${SERVICE} ${CUR_SERVICE} stop 2>&1 )"
TEMPRC=$?
LogMsg "-" "${CUR_OUTPUT}"
LogMsg "Checking the status of the ${CUR_SERVICE_NAME} ..."
CUR_OUTPUT="$( set -x ; ${SERVICE} ${CUR_SERVICE} status 2>&1 )"
TEMPRC=$?
LogMsg "-" "${CUR_OUTPUT}"
if [ ${TEMPRC} != 0 ] ; then
LogMsg "The ${CUR_SERVICE_NAME} is now stopped"
else
LogError "Error stopping the ${CUR_SERVICE_NAME}"
THISRC=${__FALSE}
fi
fi
fi
return ${THISRC}
}
# ----------------------------------------------------------------------
# task_view_llt_config
#
# function: view the llt config
#
# usage: task_view_llt_config
#
# returns: ${__TRUE} - ok executing the task
# ${__FALSE} - error executing the task
#
#
function task_view_llt_config {
typeset __FUNCTION="task_view_llt_config"
typeset TASK_USAGE="${__FUNCTION} "
${__DEBUG_CODE}
${__FUNCTION_INIT}
typeset THISRC=${__TRUE}
typeset CUR_OUTPUT=""
typeset TEMPRC=""
LogMsg "Retrieving the llt status ..."
if [ ! -x "${LLTCONFIG}" ] ; then
LogError "${LLTCONFIG} not found or not executable"
THISRC=${__FALSE}
else
CUR_OUTPUT="$( ${LLTCONFIG} -a list 2>&1 )"
TEMPRC=$?
LogMsg "-" "${CUR_OUTPUT}"
if [ ${TEMPRC} -ne 0 ] ; then
LogError "Error retrieving the llt status"
THISRC=${__FALSE}
fi
fi
return ${THISRC}
}
# ----------------------------------------------------------------------
# task_list_installed_vrts_packages
#
# function: list the installed VRTS packages
#
# usage: task_list_installed_vrts_packages
#
# returns: ${__TRUE} - ok executing the task
# ${__FALSE} - error executing the task
#
#
function task_list_installed_vrts_packages {
typeset __FUNCTION="task_list_installed_vrts_packages"
typeset TASK_USAGE="${__FUNCTION} "