1# sg_persist 2# Before use sg_persist ocft test case you have to prepare to make pacemaker 3# can be started successfully because sg_persist RA needs to use the result of 4# `crm_node -i` as sg_persist register key. 5 6CONFIG 7 Agent sg_persist 8 AgentRoot /usr/lib/ocf/resource.d/heartbeat 9 InstallPackage sg3_utils 10 HangTimeout 20 11 12VARIABLE 13 14 # Please set the disk you want to test 15 #OCFT_DEVS="/dev/disk/by-id/scsi-14945540000000000844965720e6e555176b19461345d68d5" 16 OCFT_DEVS= 17 18 # please set the IP addrees of the other server. 19 IP_2= 20 21SETUP-AGENT 22 # start pacemaker to get node_id through crm_node -i 23 systemctl start pacemaker 24 25CLEANUP-AGENT 26 27CASE-BLOCK required_args 28 Env HA_SBIN_DIR="" 29 Env OCF_RESKEY_devs="$OCFT_DEVS" 30 Env OCF_RESKEY_reservation_type=1 31 Env OCF_RESKEY_CRM_meta_notify=true 32 Env OCF_RESKEY_CRM_meta_master_max=1 33 34CASE-BLOCK required_args_error 35 Env HA_SBIN_DIR="" 36 Env OCF_RESKEY_devs="$OCFT_DEVS" 37 Env OCF_RESKEY_reservation_type=1 38 Env OCF_RESKEY_CRM_meta_notify=true 39 Env OCF_RESKEY_CRM_meta_master_max=2 40 41CASE-BLOCK required_args_type_5 42 Env HA_SBIN_DIR="" 43 Env OCF_RESKEY_devs="$OCFT_DEVS" 44 Env OCF_RESKEY_reservation_type=5 45 Env OCF_RESKEY_CRM_meta_notify=true 46 Env OCF_RESKEY_CRM_meta_master_max=1 47 48CASE-BLOCK required_args_type_7 49 Env HA_SBIN_DIR="" 50 Env OCF_RESKEY_devs="$OCFT_DEVS" 51 Env OCF_RESKEY_reservation_type=7 52 Env OCF_RESKEY_CRM_meta_notify=true 53 Env OCF_RESKEY_CRM_meta_master_max=2 54 55CASE-BLOCK default_status 56 AgentRun stop 57 58CASE-BLOCK prepare 59 Include required_args 60 Include default_status 61 62CASE-BLOCK prepare_type_5 63 Include required_args_type_5 64 Include default_status 65 66CASE-BLOCK prepare_type_7 67 Include required_args_type_7 68 Include default_status 69 70CASE "check base env" 71 Include prepare 72 AgentRun start OCF_SUCCESS 73 74CASE "check base env: unset 'OCF_RESKEY_sg_persist_devs'" 75 Include prepare 76 Unenv OCF_RESKEY_devs 77 AgentRun start OCF_ERR_INSTALLED 78 79CASE "validate all" 80 Include required_args 81 AgentRun validate-all OCF_SUCCESS 82 83CASE "validate all--type:5" 84 Include required_args_type_5 85 AgentRun validate-all OCF_SUCCESS 86 87CASE "validate all--type:7" 88 Include required_args_type_7 89 AgentRun validate-all OCF_SUCCESS 90 91CASE "validate all--error configured" 92 Include required_args_error 93 AgentRun validate-all OCF_ERR_CONFIGURED 94 95CASE "normal start" 96 Include prepare 97 AgentRun start OCF_SUCCESS 98 99CASE "normal stop" 100 Include prepare 101 AgentRun start 102 AgentRun stop OCF_SUCCESS 103 104CASE "double start" 105 Include prepare 106 AgentRun start 107 AgentRun start OCF_SUCCESS 108 109CASE "double stop" 110 Include prepare 111 AgentRun stop 112 AgentRun stop OCF_SUCCESS 113 114CASE "monitor when running" 115 Include prepare 116 AgentRun start 117 AgentRun monitor OCF_SUCCESS 118 119CASE "monitor when not running" 120 Include prepare 121 AgentRun stop 122 AgentRun monitor OCF_NOT_RUNNING 123 124CASE "Primary/Secondary monitor" 125 Include prepare 126 AgentRun start 127 AgentRun promote 128 AgentRun monitor OCF_RUNNING_MASTER 129 AgentRun demote 130 AgentRun monitor OCF_SUCCESS 131 AgentRun stop 132 133CASE "promote/demote test in single-primary mode" 134 Include prepare 135 Include@$IP_2 prepare 136 137 # start 138 AgentRun start 139 AgentRun@$IP_2 start 140 141 # promote local first 142 AgentRun promote OCF_SUCCESS 143 144 # demote local prepare for remote promote 145 AgentRun demote 146 147 # remote promote 148 AgentRun@$IP_2 promote OCF_SUCCESS 149 AgentRun@$IP_2 monitor OCF_RUNNING_MASTER 150 AgentRun monitor OCF_SUCCESS 151 152 # promote local then promote(by preempt) remote, which will cause local OCF_NOT_RUNNING 153 AgentRun promote OCF_SUCCESS 154 AgentRun monitor OCF_RUNNING_MASTER 155 AgentRun@$IP_2 monitor OCF_NOT_RUNNING 156 157 # remove all reservation registration 158 AgentRun demote 159 AgentRun stop 160 AgentRun@$IP_2 stop 161 162 163CASE "normal start--type 5" 164 Include prepare_type_5 165 Include@$IP_2 prepare_type_5 166 AgentRun start OCF_SUCCESS 167 AgentRun@$IP_2 start OCF_SUCCESS 168 169CASE "promote/demote test in single-primary mode" 170 Include prepare_type_5 171 Include@$IP_2 prepare_type_5 172 173 # start 174 AgentRun start 175 AgentRun@$IP_2 start 176 177 # promote local first 178 AgentRun promote OCF_SUCCESS 179 AgentRun monitor OCF_RUNNING_MASTER 180 181 # demote local prepare for remote promote 182 AgentRun demote 183 # remote promote 184 AgentRun@$IP_2 promote OCF_SUCCESS 185 AgentRun@$IP_2 monitor OCF_RUNNING_MASTER 186 AgentRun monitor OCF_SUCCESS 187 188 # promote local then promote(by preempt) remote, which will cause local OCF_NOT_RUNNING 189 AgentRun promote OCF_SUCCESS 190 AgentRun monitor OCF_RUNNING_MASTER 191 AgentRun@$IP_2 monitor OCF_NOT_RUNNING 192 193 # remove all reservation registration 194 AgentRun demote 195 AgentRun stop 196 AgentRun@$IP_2 stop 197 198CASE "normal start--type 7: 2 masters" 199 Include prepare_type_7 200 Include@$IP_2 prepare_type_7 201 AgentRun start OCF_SUCCESS 202 AgentRun@$IP_2 start OCF_SUCCESS 203 204 205CASE "Primary/Primary monitor--type 7" 206 Include prepare_type_7 207 Include@$IP_2 prepare_type_7 208 209 AgentRun start OCF_SUCCESS 210 AgentRun@$IP_2 start OCF_SUCCESS 211 212 AgentRun promote OCF_SUCCESS 213 AgentRun monitor OCF_RUNNING_MASTER 214 215 AgentRun@$IP_2 promote OCF_SUCCESS 216 AgentRun monitor OCF_RUNNING_MASTER 217 AgentRun@$IP_2 monitor OCF_RUNNING_MASTER 218 219 AgentRun demote OCF_SUCCESS 220 AgentRun monitor OCF_NOT_RUNNING 221 AgentRun@$IP_2 demote OCF_SUCCESS 222 AgentRun@$IP_2 monitor OCF_NOT_RUNNING 223 224 AgentRun stop 225 AgentRun@$IP_2 stop 226