~ubuntu-branches/ubuntu/intrepid/multipath-tools/intrepid-proposed

« back to all changes in this revision

Viewing changes to debian/hsg80_start

  • Committer: Bazaar Package Importer
  • Author(s): Fabio M. Di Nitto
  • Date: 2007-04-04 08:17:48 UTC
  • Revision ID: james.westby@ubuntu.com-20070404081748-unzef0a51km19wyw
Tags: 0.4.7-1.1ubuntu3
* Remove multipath-tools-boot init script.

* Wild changes and updates to udev rules:
  - All the hsg80 MULTIBUS FAILOVER are now handled here.
  - Fix rule to call kpartx also on "change" udev events.
  - Invoke multipath -v 0 device to make sure we hot plug
    all devices into multipath.

* Add /sbin/hsg80_start that wraps all the work to make an hsg80 in
  MULTIBUS FAILOVER working properly.
  This is automatically called by udev.

(Closes LP: #98518)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
 
 
3
device="$1"
 
4
 
 
5
# checking proper invocation and if we have the tools to work.
 
6
# sfdisk is part of util-linux (Essential: yes)
 
7
if [ -z "$device" ] || ! which sg_start > /dev/null; then
 
8
        exit 0
 
9
fi
 
10
 
 
11
# wait maximum 1 minute for a device to appear in /dev
 
12
slumber=600
 
13
while [ ${slumber} -gt 0 -a ! -b /dev/$device ]; do
 
14
        sleep 0.1
 
15
        slumber=$(( ${slumber} - 1 ))
 
16
done
 
17
 
 
18
# if the device finally exists start it.
 
19
if [ -b /dev/$device ]; then
 
20
        if ! sg_turs /dev/$device > /dev/null 2>&1; then
 
21
                # start the device and wait for it
 
22
                sg_start --imm=0 --start /dev/$device
 
23
                sleep 2
 
24
        fi
 
25
        # rescan the device
 
26
        echo 1 > /sys/block/$device/device/rescan
 
27
        # rescan partition table
 
28
        if which sfdisk > /dev/null; then
 
29
                sfdisk -R /dev/$device
 
30
        fi
 
31
        # this is harsh but multipathd needs a hard restart
 
32
        kill -9 $(pidof /sbin/multipathd) || true
 
33
        multipath -v 0 /dev/$device
 
34
        invoke-rc.d multipath-tools start > /dev/null 2>&1 || true
 
35
fi
 
36
 
 
37
exit 0