Print this page
6198 Let's EOL cachefs
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/cmd/stmsboot/stmsboot.sh
+++ new/usr/src/cmd/stmsboot/stmsboot.sh
1 1 #!/sbin/sh -p
2 2 #
3 3 # CDDL HEADER START
4 4 #
5 5 # The contents of this file are subject to the terms of the
6 6 # Common Development and Distribution License (the "License").
7 7 # You may not use this file except in compliance with the License.
8 8 #
9 9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 10 # or http://www.opensolaris.org/os/licensing.
11 11 # See the License for the specific language governing permissions
12 12 # and limitations under the License.
13 13 #
↓ open down ↓ |
13 lines elided |
↑ open up ↑ |
14 14 # When distributing Covered Code, include this CDDL HEADER in each
15 15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 16 # If applicable, add the following below this CDDL HEADER, with the
17 17 # fields enclosed by brackets "[]" replaced with your own identifying
18 18 # information: Portions Copyright [yyyy] [name of copyright owner]
19 19 #
20 20 # CDDL HEADER END
21 21 #
22 22 #
23 23 # Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
24 +# Copyright 2015 Nexenta Systems, Inc. All rights reserved.
24 25 #
25 26 #
26 27 PATH=/usr/bin:/usr/sbin:$PATH; export PATH
27 28 STMSBOOTUTIL=/lib/mpxio/stmsboot_util
28 29 STMSMETHODSCRIPT=/lib/svc/method/mpxio-upgrade
29 30 KDRVCONF=
30 31 DRVCONF=
31 32 TMPDRVCONF=
32 33 TMPDRVCONF_MPXIO_ENTRY=
33 34 TMPDRVCONF_SATA_ENTRY=
34 35 DRVLIST=
35 36 GUID=
36 37 VFSTAB=/etc/vfstab
37 38 SAVEDIR=/etc/mpxio
38 39 BOOTDEVICES=$SAVEDIR/boot-devices
39 40 RECOVERFILE=$SAVEDIR/recover_instructions
40 41 SVCCFG_RECOVERY=$SAVEDIR/svccfg_recover
41 42 SUPPORTED_DRIVERS="fp|mpt|mpt_sas|pmcs"
42 43 USAGE=`gettext "Usage: stmsboot [-D $SUPPORTED_DRIVERS] -e | -d | -u | -L | -l controller_number"`
43 44 TEXTDOMAIN=SUNW_OST_OSCMD
44 45 export TEXTDOMAIN
45 46 STMSINSTANCE=svc:system/device/mpxio-upgrade:default
46 47 FASTBOOTINSTANCE=svc:system/boot-config:default
47 48 STMSBOOT=/usr/sbin/stmsboot
48 49 BOOTADM=/sbin/bootadm
49 50 MOUNT=/usr/sbin/mount
50 51 EEPROM=/usr/sbin/eeprom
51 52 EGREP=/usr/bin/egrep
52 53 GREP=/usr/bin/grep
53 54 AWK=/usr/bin/awk
54 55 CP=/usr/bin/cp
55 56 DF=/usr/bin/df
56 57 LS=/usr/bin/ls
57 58 MV=/usr/bin/mv
58 59 RM=/usr/bin/rm
59 60 SORT=/usr/bin/sort
60 61 UNIQ=/usr/bin/uniq
61 62 EXPR=/usr/bin/expr
62 63 MKDIR=/usr/bin/mkdir
63 64 REBOOT=/usr/sbin/reboot
64 65 SED=/usr/bin/sed
65 66 SVCPROP=/usr/bin/svcprop
66 67 SVCCFG=/usr/sbin/svccfg
67 68 SVCS=/usr/bin/svcs
68 69 SVCADM=/usr/sbin/svcadm
69 70
70 71 NOW=`/usr/bin/date +%G%m%d_%H%M`
71 72 MACH=`/usr/bin/uname -p`
72 73 BOOTENV_FILE=bootenv.rc
73 74 reboot_needed=0
74 75 new_bootpath=""
75 76 CLIENT_TYPE_PHCI=""
76 77 CLIENT_TYPE_VHCI="/scsi_vhci"
77 78
78 79 #
79 80 # Copy all entries (including comments) from source driver.conf
80 81 # to destination driver.conf except those entries which contain
81 82 # the mpxio-disable property.
82 83 # Take into consideration entries that spawn more than one line.
83 84 #
84 85 # $1 source driver.conf file
85 86 # $2 destination driver.conf file
86 87 #
87 88 # Returns 0 on success, non zero on failure.
88 89 #
89 90 delete_mpxio_disable_entries()
90 91 {
91 92 # be careful here, we've got embedded \t characters
92 93 # in sed's pattern space.
93 94 $SED '
94 95 /^[ ]*#/{ p
95 96 d
96 97 }
97 98 s/[ ]*$//
98 99 /^$/{ p
99 100 d
100 101 }
101 102 /mpxio-disable[ ]*=.*;$/{ w '$3'
102 103 d
103 104 }
104 105 /disable-sata-mpxio[ ]*=.*;$/{ w '$4'
105 106 d
106 107 }
107 108 /;$/{ p
108 109 d
109 110 }
110 111 :rdnext
111 112 N
112 113 s/[ ]*$//
113 114 /[^;]$/b rdnext
114 115 /mpxio-disable[ ]*=/{ s/\n/ /g
115 116 w '$3'
116 117 d
117 118 }
118 119 ' $1 > $2
119 120
120 121 return $?
121 122 }
122 123
123 124 #
124 125 # backup the last saved copy of the specified files.
125 126 # $* files to backup
126 127 #
127 128 backup_lastsaved()
128 129 {
129 130 for file in $*
130 131 do
131 132 newfile=`basename $file`
132 133 $CP $file $SAVEDIR/$newfile.$cmd.$NOW
133 134 done
134 135 }
135 136
136 137 #
137 138 # build recover instructions
138 139 #
139 140 # $1 1 to include boot script in the instructions
140 141 # 0 otherwise
141 142 #
142 143 build_recover()
143 144 {
144 145 gettext "Instructions to recover your previous STMS configuration (if in case the system does not boot):\n\n" > $RECOVERFILE
145 146 echo "\tboot net \c" >> $RECOVERFILE
146 147 gettext "(or from a cd/dvd/another disk)\n" >> $RECOVERFILE
147 148 echo "\tfsck <your-root-device>" >> $RECOVERFILE
148 149 echo "\tmount <your-root-device> /mnt" >> $RECOVERFILE
149 150
150 151 if [ "$cmd" = "update" ]; then
151 152 gettext "\tUndo the modifications you made to STMS configuration.\n\tFor example undo any changes you made to " >> $RECOVERFILE
152 153 echo "/mnt$KDRVCONF." >> $RECOVERFILE
153 154 else
154 155 echo "\tcp /mnt${SAVEDIR}/$DRVCONF.$cmd.$NOW /mnt$KDRVCONF" >> $RECOVERFILE
155 156 fi
156 157
157 158 if [ $1 -eq 1 ]; then
158 159 echo "\tcp /mnt${SAVEDIR}/vfstab.$cmd.$NOW /mnt$VFSTAB" >> $RECOVERFILE
159 160
160 161 echo "repository /mnt/etc/svc/repository.db" > $SVCCFG_RECOVERY
161 162 echo "select $STMSINSTANCE" >> $SVCCFG_RECOVERY
162 163 echo "setprop general/enabled=false" >> $SVCCFG_RECOVERY
163 164 echo "exit" >> $SVCCFG_RECOVERY
164 165
165 166 echo "\t$SVCCFG -f /mnt$SVCCFG_RECOVERY" >> $RECOVERFILE
166 167
167 168 if [ -n "$new_bootpath" -a "$MACH" = "i386" ]; then
168 169 echo "\tcp /mnt${SAVEDIR}/bootenv.rc.$cmd.$NOW /mnt/boot/solaris/$BOOTENV_FILE" >> $RECOVERFILE
169 170 fi
170 171 fi
171 172
172 173 rootdisk=`$MOUNT | $GREP "/ on " | cut -f 3 -d " "`
173 174 echo "\tumount /mnt\n\treboot\n\n${rootdisk} \c" >> $RECOVERFILE
174 175 gettext "was your root device,\nbut it could be named differently after you boot net.\n" >> $RECOVERFILE
175 176 }
176 177
177 178
178 179 #
179 180 # Arrange for /etc/vfstab and dump configuration to be updated
180 181 # during the next reboot. If the cmd is "enable" or "disable", copy
181 182 # $TMPDRVCONF to $KDRVCONF.
182 183 #
183 184 # Returns 0 on success, 1 on failure.
184 185 #
185 186 update_sysfiles()
186 187 {
187 188
188 189 gettext "WARNING: This operation will require a reboot.\n"
189 190 gettext "Do you want to continue ? [y/n] (default: y) "
190 191 read response
191 192
192 193 if [ -n "$response" -a "$response" != "y" -a \
193 194 "$response" != "Y" ]; then
194 195 for d in $DRVLIST; do
195 196 TMPDRVCONF=/var/run/tmp.$d.conf.$$
196 197 $RM -f $TMPDRVCONF > /dev/null 2>&1
197 198 done;
198 199 return 0;
199 200 fi
200 201
201 202 # set need_bootscript to the number of drivers that
202 203 # we support.
203 204 need_bootscript=`echo $SUPPORTED_DRIVERS|$AWK -F"|" '{print NF}'`
204 205
205 206 if [ "$cmd" = "enable" -o "$cmd" = "disable" ]; then
206 207
207 208 for d in $DRVLIST; do
208 209 DRVCONF=$d.conf
209 210 KDRVCONF=/kernel/drv/$d.conf
210 211 TMPDRVCONF=/var/run/tmp.$d.conf.$$
211 212
212 213 $CP $KDRVCONF $SAVEDIR/`basename $KDRVCONF`.$cmd.$NOW
213 214 if [ -f $TMPDRVCONF ]; then
214 215 $CP $TMPDRVCONF $KDRVCONF
215 216 $RM -f $TMPDRVCONF
216 217 else
217 218 # if $TMPDRVCONF doesn't exist, then we
218 219 # haven't made any changes to it
219 220 continue;
220 221 fi
221 222
222 223 #
223 224 # there is no need to update the system files in the following
224 225 # cases:
225 226 # - we are enabling mpxio and the system has no configured
226 227 # disks accessible by phci paths.
227 228 # - we are disabling mpxio and the system has no configured
228 229 # disks accessible by vhci paths.
229 230 #
230 231
231 232 # Function to setup the CLIENT_TYPE_PHCI string based on
232 233 # the list of drivers that we're operating on. The variable
233 234 # depends upon the pathname of the parent node in the
234 235 # device tree, which can be different on x86/x64 and sparc.
235 236
236 237 CLIENT_TYPE_PHCI=`$STMSBOOTUTIL -D $d -N`;
237 238
238 239 if [ -z "$CLIENT_TYPE_PHCI" ]; then
239 240 continue;
240 241 fi
241 242
242 243 if [ "$cmd" = "enable" ]; then
243 244 $LS -l /dev/dsk/*s2 2> /dev/null | \
244 245 $EGREP -s "$CLIENT_TYPE_PHCI"
245 246 else
246 247 $LS -l /dev/dsk/*s2 2> /dev/null | \
247 248 $EGREP -s "$CLIENT_TYPE_VHCI"
248 249 fi
249 250
250 251 if [ $? -ne 0 ]; then
251 252 need_bootscript=`$EXPR $need_bootscript - 1`
252 253 fi
253 254 done
254 255 fi
255 256
256 257 if [ $need_bootscript -gt 0 ]; then
257 258 need_bootscript=1
258 259 if [ -n "$new_bootpath" -a "$MACH" = "i386" ]; then
259 260 #only update bootpath for x86.
260 261 $CP /boot/solaris/$BOOTENV_FILE $SAVEDIR/$BOOTENV_FILE.$cmd.$NOW
261 262 $EEPROM bootpath="$new_bootpath"
262 263 fi
263 264
264 265 if [ "$MACH" = "i386" ]; then
265 266 # Disable Fast Reboot temporarily for the next reboot only.
266 267 HASZFSROOT=`$DF -g / |$GREP zfs`
267 268 if [ -n "$HASZFSROOT" ]; then
268 269 $SVCCFG -s $FASTBOOTINSTANCE addpg config_ovr application P > /dev/null 2>&1
269 270 $SVCCFG -s $FASTBOOTINSTANCE \
270 271 setprop config_ovr/fastreboot_default=boolean:\"false\"
271 272 $SVCCFG -s $FASTBOOTINSTANCE \
272 273 setprop config_ovr/fastreboot_onpanic=boolean:\"false\"
273 274 $SVCADM refresh $FASTBOOTINSTANCE
274 275 fi
275 276 fi
276 277
277 278 # Enable the mpxio-upgrade service for the reboot
278 279 $SVCADM disable -t $STMSINSTANCE
279 280 $SVCCFG -s $STMSINSTANCE "setprop general/enabled=true"
280 281 else
281 282 need_bootscript=0
282 283 fi
283 284
284 285 build_recover $need_bootscript
285 286
286 287 if [ "$MACH" = "i386" ]; then
287 288 $BOOTADM update-archive
288 289 fi
289 290
290 291 gettext "The changes will come into effect after rebooting the system.\nReboot the system now ? [y/n] (default: y) "
291 292 read response
292 293
293 294 if [ -z "$response" -o "$response" = "y" -o \
294 295 "$response" = "Y" ]; then
295 296 $REBOOT
296 297 fi
297 298
298 299 return 0
299 300 }
300 301
301 302
302 303 #
303 304 # Enable or disable mpxio as specified by the cmd.
304 305 # Returns 0 on success, 1 on failure.
305 306 #
306 307 # Args: $cmd = {enable | disable}
307 308 # $d = {fp | mpt | mpt_sas | pmcs}
308 309 #
309 310 # the global variable $DRVLIST is used
310 311 #
311 312 configure_mpxio()
312 313 {
313 314 # be careful here, we've got embedded \t characters
314 315 # in sed's pattern space.
315 316 mpxiodisableno='mpxio-disable[ ]*=[ ]*"no"[ ]*;'
316 317 mpxiodisableyes='mpxio-disable[ ]*=[ ]*"yes"[ ]*;'
317 318 satadisableno='disable-sata-mpxio[ ]*=[ ]*"no"[ ]*;'
318 319 satadisableyes='disable-sata-mpxio[ ]*=[ ]*"yes"[ ]*;'
319 320
320 321 if [ "$cmd" = "enable" ]; then
321 322 mpxiodisable_cur_entry=$mpxiodisableyes
322 323 satadisable_cur_entry=$satadisableyes
323 324 propval=no
324 325 msg=`gettext "STMS already enabled"`
325 326 else
326 327 mpxiodisable_cur_entry=$mpxiodisableno
327 328 satadisable_cur_entry=$satadisableno
328 329 propval=yes
329 330 msg=`gettext "STMS already disabled"`
330 331 fi
331 332
332 333 DRVCONF=$d.conf
333 334 KDRVCONF=/kernel/drv/$d.conf
334 335 TMPDRVCONF=/var/run/tmp.$d.conf.$$
335 336 TMPDRVCONF_MPXIO_ENTRY=/var/run/tmp.$d.conf.mpxioentry.$$;
336 337 TMPDRVCONF_SATA_ENTRY=/var/run/tmp.$d.conf.sataentry.$$;
337 338
338 339 if delete_mpxio_disable_entries $KDRVCONF $TMPDRVCONF $TMPDRVCONF_MPXIO_ENTRY $TMPDRVCONF_SATA_ENTRY; then
339 340
340 341 if [ -s $TMPDRVCONF_MPXIO_ENTRY ]; then
341 342 # $DRVCONF does have mpxiodisable entries
342 343 $EGREP -s "$mpxiodisable_cur_entry" $TMPDRVCONF_MPXIO_ENTRY
343 344 if [ $? -eq 0 ]; then
344 345 reboot_needed=`$EXPR $reboot_needed + 1`
345 346 else
346 347 # if all mpxiodisable entries are no/yes for
347 348 # enable/disable mpxio, notify the user
348 349 $EGREP -s "$satadisable_cur_entry" $TMPDRVCONF_SATA_ENTRY
349 350 if [ $? -eq 0 -a "$d" = "mpt" ]; then
350 351 reboot_needed=`$EXPR $reboot_needed + 1`
351 352 else
352 353 $RM -f $TMPDRVCONF $TMPDRVCONF_MPXIO_ENTRY $TMPDRVCONF_SATA_ENTRY > /dev/null 2>&1
353 354 return 0;
354 355 fi
355 356 fi
356 357
357 358 # If mpxiodisable entries do not exist, always continue update
358 359 fi
359 360 else
360 361 $RM -f $TMPDRVCONF $TMPDRVCONF_MPXIO_ENTRY $TMPDRVCONF_SATA_ENTRY > /dev/null 2>&1
361 362 gettext "failed to update " 1>&2
362 363 echo "$KDRVCONF." 1>&2
363 364 gettext "No changes were made to your STMS configuration.\n" 1>&2
364 365 return 1
365 366 fi
366 367
367 368 rm $TMPDRVCONF_MPXIO_ENTRY $TMPDRVCONF_SATA_ENTRY > /dev/null 2>&1
368 369 echo "mpxio-disable=\"${propval}\";" >> $TMPDRVCONF
369 370 if [ "$d" = "mpt" ]; then
370 371 echo "disable-sata-mpxio=\"${propval}\";" >> $TMPDRVCONF
371 372 fi
372 373
373 374 }
374 375
375 376 setcmd()
376 377 {
377 378 if [ "$cmd" = "none" ]; then
378 379 cmd=$1
379 380 else
380 381 echo "$USAGE" 1>&2
381 382 exit 2
382 383 fi
383 384 }
384 385
385 386 #
386 387 # Need to update bootpath on x86 if boot system from FC disk
387 388 # Only update bootpath here when mpxio is enabled
388 389 # If mpxio is currently disabled, then we'll update bootpath in the
389 390 # mpxio-upgrade service method on reboot.
390 391 #
391 392
392 393 get_newbootpath_for_stmsdev() {
393 394 if [ "$cmd" = "enable" ]; then
394 395 return 0
395 396 fi
396 397
397 398 cur_bootpath=`$STMSBOOTUTIL -b`
398 399 if [ $? != 0 ]; then
399 400 return 1
400 401 fi
401 402
402 403 # Since on x64 platforms the eeprom command doesn't update the
403 404 # kernel, the file /boot/solaris/bootenv.rc and the kernel's
404 405 # bootpath variable have a good chance of differing. We do some
405 406 # extra handwaving to get the correct bootpath variable setting.
406 407
407 408 ONDISKVER=`$AWK '/bootpath/ {print $3}' /boot/solaris/bootenv.rc|\
408 409 $SED -e"s,',,g"`
409 410 if [ "$ONDISKVER" != "$cur_bootpath" ]; then
410 411 cur_bootpath="$ONDISKVER"
411 412 fi
412 413
413 414 NEWBOOTPATH=""
414 415 for path in $cur_bootpath; do
415 416 mapped=`$STMSBOOTUTIL -p $path`
416 417 if [ "$mapped" != "NOT_MAPPED" ]; then
417 418 if [ "$mapped" != "$path" ]; then
418 419 NEWBOOTPATH=`echo "$path " | \
419 420 $SED -e"s|$path|$mapped|"`" $NEWBOOTPATH"
420 421 else
421 422 NEWBOOTPATH="$NEWBOOTPATH $path"
422 423 fi
423 424 fi
424 425 done
425 426 # now strip off leading and trailing space chars
426 427 new_bootpath=`echo $NEWBOOTPATH`
427 428 return 0
428 429 }
429 430
430 431 #
431 432 # Emit a warning message to the user that by default we
432 433 # operate on all multipath-capable controllers that are
433 434 # attached to the system, and that if they want to operate
434 435 # on only a specific controller type (fp|mpt|mpt_sas|pmcs|....) then
435 436 # they need to re-invoke stmsboot with "-D $driver" in
436 437 # their argument list
437 438 #
438 439
439 440 emit_driver_warning_msg() {
440 441
441 442 # for each driver that we support, grab the list
442 443 # of controllers attached to the system.
443 444
444 445 echo ""
445 446 gettext "WARNING: stmsboot operates on each supported multipath-capable controller\n"
446 447 gettext " detected in a host. In your system, these controllers are\n\n"
447 448
448 449 for WARNDRV in `echo $SUPPORTED_DRIVERS| $SED -e"s,|, ,g"`; do
449 450 $STMSBOOTUTIL -D $WARNDRV -n
450 451 done;
451 452
452 453 echo ""
453 454 gettext "If you do NOT wish to operate on these controllers, please quit stmsboot\n"
454 455 gettext "and re-invoke with -D { fp | mpt | mpt_sas | pmcs} to specify which controllers you wish\n"
455 456 gettext "to modify your multipathing configuration for.\n"
456 457
457 458 echo ""
458 459 gettext "Do you wish to continue? [y/n] (default: y) "
459 460 read response
460 461
461 462 if [ -n "$response" -a "$response" != "Y" -a \
462 463 "$response" != "y" ]; then
463 464 exit
464 465 fi
465 466 }
466 467
467 468
468 469 #
469 470 #
470 471 # main starts here
471 472 #
472 473
473 474 cmd=none
474 475 # process options
475 476 while getopts D:geduLl: c
476 477 do
477 478 case $c in
478 479 e) setcmd enable;;
479 480 d) setcmd disable;;
480 481 u) setcmd update;;
481 482 L) setcmd listall;;
482 483 l) setcmd list
483 484 controller=$OPTARG;;
484 485 D) DRV=$OPTARG;;
485 486 g) GUID="-g";;
486 487 \?) echo "$USAGE" 1>&2
487 488 exit 2;;
488 489 esac
489 490 done
490 491
491 492 if [ "$cmd" = "none" ]; then
492 493 echo "$USAGE" 1>&2
493 494 exit 2
494 495 fi
495 496
496 497 if [ -z "$DRV" ]; then
497 498 DRVLIST="fp mpt mpt_sas pmcs"
498 499 else
499 500 DRVLIST=$DRV
500 501 fi
501 502
502 503 USERID=`id | $EGREP "uid=0"`
503 504 if [ -z "$USERID" ]; then
504 505 gettext "You must be super-user to run this script.\n" 1>&2
505 506 exit 1
506 507 fi
507 508
508 509 # just a sanity check
509 510 if [ ! -f $STMSBOOTUTIL -o ! -f $STMSMETHODSCRIPT ]; then
510 511 fmt=`gettext "Can't find %s and/or %s"`
511 512 printf "$fmt\n" "$STMSBOOTUTIL" "$STMSMETHODSCRIPT" 1>&2
512 513 exit 1
513 514 fi
514 515
515 516 # If the old sun4u-specific SMF method is found, remove it
516 517 $SVCCFG -s "platform/sun4u/mpxio-upgrade:default" < /dev/null > /dev/null 2>&1
517 518 if [ $? -eq 0 ]; then
518 519 $SVCCFG delete "platform/sun4u/mpxio-upgrade:default" > /dev/null 2>&1
519 520 fi
520 521
521 522 # now import the new service, if necessary
522 523 $SVCPROP -q $STMSINSTANCE < /dev/null > /dev/null 2>&1
523 524 if [ $? -ne 0 ]; then
524 525 if [ -f /lib/svc/manifest/system/device/mpxio-upgrade.xml ]; then
525 526 $SVCCFG import /lib/svc/manifest/system/device/mpxio-upgrade.xml
526 527 if [ $? -ne 0 ]; then
527 528
528 529 fmt=`gettext "Unable to import the %s service"`
529 530 printf "$fmt\n" "$STMSINSTANCE" 1>&2
530 531 exit 1
531 532 else
532 533 fmt=`gettext "Service %s imported successfully, continuing"`
533 534 printf "$fmt\n" "$STMSINSTANCE" 1>&2
534 535 fi
535 536 else
536 537 fmt=`gettext "Service %s does not exist on this host"`
537 538 printf "$fmt\n" "$STMSINSTANCE" 1>&2
538 539 exit 1
539 540 fi
540 541 fi
541 542
↓ open down ↓ |
508 lines elided |
↑ open up ↑ |
542 543
543 544 # make sure we can stash our data somewhere private
544 545 if [ ! -d $SAVEDIR ]; then
545 546 $MKDIR -p $SAVEDIR
546 547 fi
547 548 # prime the cache
548 549 $STMSBOOTUTIL -i
549 550
550 551
551 552 if [ "$cmd" = "enable" -o "$cmd" = "disable" -o "$cmd" = "update" ]; then
552 - #
553 - # The bootup script doesn't work on cache-only-clients as the script
554 - # is executed before the plumbing for cachefs mounting of root is done.
555 - #
556 - if $MOUNT -v | $EGREP -s " on / type (nfs|cachefs) "; then
557 - gettext "This command option is not supported on systems with an nfs or cachefs mounted root filesystem.\n" 1>&2
553 + if $MOUNT -v | $EGREP -s " on / type nfs "; then
554 + gettext "This command option is not supported on systems with an nfs mounted root filesystem.\n" 1>&2
558 555 exit 1
559 556 fi
560 557
561 558 # if the user has left the system with the mpxio-upgrade service
562 559 # in a temporarily disabled state (ie, service is armed for the next
563 560 # reboot), then let them know. We need to ensure that the system is
564 561 # is in a sane state before allowing any further invocations, so
565 562 # try to get the system admin to do so
566 563
567 564 ISARMED=`$SVCS -l $STMSINSTANCE|$GREP "enabled.*false.*temporary"`
568 565 if [ ! $? ]; then
569 566 echo ""
570 567 gettext "You need to reboot the system in order to complete\n"
571 568 gettext "the previous invocation of stmsboot.\n"
572 569 echo ""
573 570 gettext "Do you wish to reboot the system now? (y/n, default y) "
574 571 read response
575 572
576 573 if [ -z "$response" -o "x$response" = "Y" -o \
577 574 "$response" = "y" ]; then
578 575 $REBOOT
579 576 else
580 577 echo ""
581 578 gettext "Please reboot this system before continuing\n"
582 579 echo ""
583 580 exit 1
584 581 fi
585 582 fi
586 583
587 584 #
588 585 # keep a copy of the last saved files, useful for manual
589 586 # recovery in case of a problem.
590 587 #
591 588 for d in $DRVLIST; do
592 589 DRVCONF=$d.conf
593 590 KDRVCONF=/kernel/drv/$d.conf
594 591 TMPDRVCONF=/var/run/tmp.$d.conf.$$
595 592 TMPDRVCONF_MPXIO_ENTRY=/var/run/tmp.$d.conf.mpxioentry.$$;
596 593 if [ "$MACH" = "sparc" ]; then
597 594 backup_lastsaved $KDRVCONF $VFSTAB
598 595 else
599 596 backup_lastsaved $KDRVCONF $VFSTAB /boot/solaris/$BOOTENV_FILE
600 597 fi
601 598 done
602 599 fi
603 600
604 601 if [ "$cmd" = "enable" -o "$cmd" = "disable" ]; then
605 602
606 603 msgneeded=`echo "$DRVLIST" |$GREP " "`
607 604 if [ -n "$msgneeded" ]; then
608 605 emit_driver_warning_msg
609 606 fi
610 607 for d in $DRVLIST; do
611 608 configure_mpxio $cmd $d
612 609 done
613 610
614 611 if [ $reboot_needed -ne 0 ]; then
615 612 # Need to update bootpath on x86 if our boot device is
616 613 # now accessed through mpxio.
617 614 # Only update bootpath before reboot when mpxio is enabled
618 615 # If mpxio is currently disabled, we will update bootpath
619 616 # on reboot in the mpxio-upgrade service
620 617
621 618 if [ "$cmd" = "disable" ]; then
622 619 if [ "$MACH" = "i386" ]; then
623 620 get_newbootpath_for_stmsdev
624 621 if [ $? -ne 0 ]; then
625 622 $RM -f $TMPDRVCONF > /dev/null 2>&1
626 623 gettext "failed to update bootpath.\n" 1>&2
627 624 gettext "No changes were made to your STMS configuration.\n" 1>&2
628 625 return 1
629 626 fi
630 627 fi
631 628 # If we're not using ZFS root then we need
632 629 # to keep track of what / maps to in case
633 630 # it's an active-active device and we boot from
634 631 # the other path
635 632 HASZFSROOT=`$DF -g / |$GREP zfs`
636 633 if [ -z "$HASZFSROOT" ]; then
637 634 ROOTSCSIVHCI=`$DF /|$AWK -F":" '{print $1}' | \
638 635 $AWK -F"(" '{print $2}'| $SED -e"s,),,"`
639 636 TMPROOTDEV=`$LS -l $ROOTSCSIVHCI |$AWK -F">" '{print $2}' | \
640 637 $SED -e"s, ../../devices,,"`
641 638 $STMSBOOTUTIL -q $TMPROOTDEV > $BOOTDEVICES
642 639 fi
643 640 fi
644 641 update_sysfiles
645 642 else
646 643 echo "STMS is already ${cmd}d. No changes or reboots needed"
647 644 fi
648 645
649 646
650 647 elif [ "$cmd" = "update" ]; then
651 648 if [ "$MACH" = "i386" ]; then
652 649 # In this case we always change the bootpath to phci-based
653 650 # path first. bootpath will later be modified in mpxio-upgrade
654 651 # to the vhci-based path if mpxio is enabled on root.
655 652 get_newbootpath_for_stmsdev
656 653 if [ $? -ne 0 ]; then
657 654 gettext "failed to update bootpath.\n" 1>&2
658 655 return 1
659 656 fi
660 657 fi
661 658 update_sysfiles
662 659
663 660 elif [ "$cmd" = "list" ]; then
664 661 $STMSBOOTUTIL $GUID -l $controller
665 662 else
666 663 $STMSBOOTUTIL $GUID -L
667 664 fi
668 665
669 666 exit $?
↓ open down ↓ |
102 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX