Document how to fix BASE-IS-OLD
[mirror/dsa-wiki.git] / input / howto / export-iscsi.creole
1 = Export iSCSI with gustini =
2 This document describes how to add new new volumes on gustini and add them into the OS.
3
4 == via Web-Frontend ==
5 {{{
6 * Log into gustini via webfrontend
7 * Manage
8   + Volume Management
9     - add volume 
10       add volume size and name but leave LUN blank (NONE)
11     - volume mapping
12       find the next free scsi-lun
13       * run "multipathd -k" on dijkstra
14         + show topology
15         geo2-boot (3600c0ff000d5f6bde2d4cf4901000000) dm-7 HP      ,MSA2012i      
16         [size=245M][features=0][hwhandler=0]
17         \_ round-robin 0 [prio=0][active]
18          \_ 1:0:0:1 sda 8:0   [active][ready]
19          \_ 0:0:0:1 sdb 8:16  [active][ready]
20                   ^ that is the LUN
21       find the next unused one and map it
22   + on dijkstra: rescan the iscsi bus
23     iscsiadm -m node --targetname "iqn.1986-03.com.hp:storage.msa2012i.0834d5ecda.a" --rescan
24
25   + on dijkstra: add aliases to the wwids (show topology)
26   + on dijkstra: service multipath-tools reload
27 }}}
28
29 == via telnet interface ==
30 {{{
31 * Log into gustini via telnet
32 * create a new volume (eg berlioz-boot) on vdisk giustini-vdisk-1:
33   + create volume vdisk giustini-vdisk-1 size 256MB berlioz-boot
34   (there is a 'help create volume' command with lots of informations)
35 * find the next free LUN numbers on traetta:
36   + show host-maps traetta
37 * map the new volume to traetta.debian.org, LUN 12
38   + map volume berlioz-boot lun 12 host traetta access rw
39   (again, there is a 'help map volume' command with lots of informations)
40
41 * Run 'show host-maps $host' again, then, on the host, run:
42         convert_sn() {
43           local sn a b c d
44           sn="$1"
45           a="${sn%??????????????????????????}"; sn="${sn#??????}"
46           b="${sn%????????????????????}"; sn="${sn#??????}"
47           c="${sn%??????????????}"; sn="${sn#??????}"
48           d="$sn"
49
50           if [ "${c#0000}" = "$c" ]; then
51             echo >&2 "sn has unexpected value ($1: $a - $b - $c - $d)"
52             return 1
53           fi
54
55           echo "36${a}000${b}${c#0000}${d}"
56           return 0
57         }
58
59         parse_volume() {
60           host=`hostname`
61           echo "Paste appropriate 'show host-maps $host' output line:"
62           read name sn id lun access channels
63
64           if [ "$access" != "rw" ]; then
65             echo >&2 "Do not have rw access"
66             return 1
67           fi
68
69           if [ "$(echo -n "$sn" | wc -c)" != "32" ]; then
70             echo >&2 "Unexpected sn length in '$sn' (wanted 32 chars)"
71             return 1
72           fi
73
74           wwid=$(convert_sn "$sn")
75
76           if [ -z "$wwid" ]; then
77             return 1
78           fi
79
80           echo ""
81           echo "  multipath {"
82           echo "    wwid $wwid"
83           echo "    alias $name"
84           echo "  }"
85           echo ""
86
87           mp="$(multipath -ll $wwid)"
88           if [ -z "$mp" ]; then
89             echo >&2 "Warning: multipath does not know about $wwid"
90             return 1
91           fi
92
93           if ! echo "$mp" | grep -q ":$lun "; then
94             echo >&2 "Warning: Are you sure $wwid is lun $lun?  multipath -ll disagrees"
95             return 1
96           fi
97         }
98
99         parse_volume
100 }}}