1: #!/bin/sh
2:
3: # AdvancedCopy Manager
4: # All Rights Reserved, Copyright FUJITSU LIMITED, 2004-2007
5:
6: #
7: # Preprocessing of Replication(Destination) processing
8: #
9: # Argument: $1 Device name of Destination disk
10: # $2 Reserve
11: #
12: # Error number
13: # 2: Argument error
14: # 10: umount error
15: # 50: varyoffvg error
16: # 99: Script not customize
17:
18: # Argument check
19: case $# in
20: 2)
21: ;;
22: *)
23: exit 2
24: ;;
25: esac
26:
27: device=$1
28:
29: # Determination of postprocessing file name
30: if [ "`echo $device | /usr/bin/grep "/dev/hdisk"`" != "" ]
31: then
32: dev_type="lvm_pv"
33: # /dev/hdisk? -> hdisk?
34: dev="`echo $device | /usr/bin/awk -F\/ '{ print $3 }'`"
35:
36: elif [ "`echo $device | /usr/bin/grep "/dev/vx/dmp/"`" != "" ]
37: then
38: dev_type="vxvm_pv"
39: # /dev/vx/dmp/device -> device
40: dev="`echo $device | /usr/bin/awk -F\/ '{ print $5 }'`"
41:
42: elif [ "`echo $device | /usr/bin/grep "/dev/"`" != "" ]
43: then
44: dev_type="lvm_vg"
45: # /dev/VG_Name -> VG_Name
46: dev="`echo $device | /usr/bin/awk -F\/ '{ print $3 }'`"
47:
48: else
49: # Other Volume
50: exit 0
51: fi
52:
53: post_file="/etc/opt/FJSVswsrp/"$SWSTGNODE"/data/DEFAULT/"$dev".dpre"
54:
55: /usr/bin/rm -rf $post_file 2> /dev/null
56:
57: err_log_path="/var/opt/FJSVswsrp/"$SWSTGNODE"/log"
58:
59: # When the Destination disk is a volume group #############################
60: if [ "$dev_type" = "lvm_vg" ]
61: then
62:
63: # Devices are volume group and script not customize
64: exit 99
65:
66: # When devices of volume group can be unmounted
67: # Specify the name of volume group to unmount
68: if [ "$device" = "/dev/vgXX" ]
69: then
70: printf "mount," > $post_file
71:
72: # Unmount all logical volumes of the volume group
73: mount_point="/XX"
74: /usr/sbin/umount $mount_point 2>/dev/null
75: if [ $? != 0 ]
76: then
77: retry_count=3
78: sleep_time=1
79: result_flag=1
80:
81: while [ $retry_count -gt 0 ]
82: do
83: /usr/sbin/umount $mount_point > $err_log_path/$dev.umount 2>&1
84: if [ $? != 0 ]
85: then
86: retry_count=`expr $retry_count - 1`
87: /usr/bin/sleep $sleep_time
88: else
89: /usr/bin/rm -f $err_log_path/$dev.umount
90: result_flag=0
91: break
92: fi
93: done
94:
95: if [ $result_flag != 0 ]
96: then
97: /usr/sbin/fuser -cu $mount_point> $err_log_path/$dev.fuser 2>&1
98: /usr/bin/ps -ef > $err_log_path/$dev.ps 2>&1
99: exit 10
100: fi
101: fi
102:
103: # mount_point="/XX"
104: # /usr/sbin/umount $mount_point 2>/dev/null
105: # if [ $? != 0 ]
106: # then
107: # retry_count=3
108: # sleep_time=1
109: # result_flag=1
110: #
111: # while [ $retry_count -gt 0 ]
112: # do
113: # /usr/sbin/umount $mount_point > $err_log_path/$dev.umount 2>&1
114: # if [ $? != 0 ]
115: # then
116: # retry_count=`expr $retry_count - 1`
117: # sleep $sleep_time
118: # else
119: # rm -f $err_log_path/$dev.umount
120: # result_flag=0
121: # break
122: # fi
123: # done
124: #
125: # if [ $result_flag != 0 ]
126: # then
127: # /usr/sbin/fuser -cu $mount_point> $err_log_path/$dev.fuser 2>&1
128: # /usr/bin/ps -ef > $err_log_path/$dev.ps 2>&1
129: # exit 10
130: # fi
131: # fi
132:
133: fi
134:
135: # varyoff destination volume group
136: ACTIVE_VGS=`/usr/sbin/lsvg -o`
137: for i in $ACTIVE_VGS
138: do
139: if [ "$dev" = "$i" ]
140: then
141: /usr/sbin/varyoffvg $i 2> /dev/null
142: if [ $? != 0 ]
143: then
144: /usr/sbin/varyoffvg $i > $err_log_path/$dev.varyoffvg 2>&1
145: if [ $? != 0 ]
146: then
147: exit 50
148: fi
149: fi
150: printf "varyon" >> $post_file
151: break
152: fi
153: done
154:
155: # When the Destination disk is a VxVM physical volume #########################
156: elif [ "$dev_type" = "vxvm_pv" ]
157: then
158: # Nothing is done to VxVM physical volume.
159: echo "none," > $post_file
160:
161: # When the Destination disk is a LVM physical volume ##########################
162: elif [ "$dev_type" = "lvm_pv" ]
163: then
164: # Nothing is done to LVM physical volume.
165: echo "none," > $post_file
166:
167: fi
168:
169: exit 0 |