Penguin
Annotated edit history of XenNotes version 30, including all changes. View license author blame.
Rev Author # Line
20 DanielLawson 1 !!!ntpdate(1) has no effect
2 Xen by default just uses the dom0's clock, which isn't updated within the domU's. Either set <tt>/proc/xen/independent_wallclock</tt> to 1 (so that this domU has an indepedent clock from the host dom0, or set the clock in the dom0.
29 WikiWorld 3
4 !!!Making a tape drive available to a guest via iSCSI Xenserver5.6
5
30 WikiWorld 6 <verbatim>
29 WikiWorld 7 Making a tape drive available to a guest via iSCSI
8 This is specifically for Citrix XenServer, although the principles will of course work in other Xen implementations
9
10 I recently had a scenario where I was replacing two Windows servers with XenServer guests. This was fine, but we needed a way to backup to the existing SCSI DDS4 DAT drive. After failing to make PCI passthrough work, I settled on the much nicer method of providing the tape drive via an iSCSI target on the XenServer Host (Dom0). Here is how I achieved this.
11
12 NOTE WELL: This method replaces the old one using a patched ietd. It is STILL unsupported
13
14 •Download and install the DDK machine from citrix.com
15 •Download the following packages to the DDK from http://scst.sourceforge.net/downloads.html
16
17
18 You can get the SCST source files from http://scst.sourceforge.net/downloads.html
19 As I want a stable platform I use the downloads from "Download released versions"
20 For the iscsi-target we need three files: scst, iscsi-scst and scstadmin.
21 You can get these files in varios ways, in the example they are downloaded with links.
22 If links is not already installed install it:
23 'emerge links'
24 Go the the directory where you want the files (the example uses /opt/build) and get the files:
25 'cd /root'
26 'links http://scst.sourceforge.net/downloads.html'
27 and download under stable the three needed files, at this moment they are scst-1.0.1.1.tar.gz, scstadmin-1.0.6.tar.gz and iscsi-scst-1.0.1.1.tar.gz
28 after downloading exit links:
29 'q'
30
31 •Extract them in a build directory (I'm using /opt/build)
32
33
34 Now extract the three downloaded files
35 'tar -zxf scst-1.0.1.1.tar.gz'
36 'tar -zxf scstadmin-1.0.6.tar.gz'
37 'tar -zxf iscsi-scst-1.0.1.1.tar.gz'
38
39 •Edit the scst-1.0.1.1/src/Makefile and uncomment the line EXTRA_CFLAGS += -DCONFIG_SCST_STRICT_SERIALIZING
40
41 Here's where it gets a little ugly, and I'd welcome suggestions (just edit this wiki) for how to do this the "right" way. This is necessary because the make install part of the build depends on having the kernel-dev skeleton installed, and this can't be installed on a XenServer Host (to my knowledge).
42
43 •tar up the devel tree - example (the dir will change depending on the XenServer/kernel version):
44 cd /usr/src/kernels/2.6.18-128.1.6.el5.xs5.5.0.505.1024xen-i686
45 tar -czvpf /opt/build/build.tar.gz .
46 cd /opt/build
47
48 Ok now time to move to your Xenserver host.
49
50 •Copy the entire /opt/build dir to the target host and execute the following steps ($kern is the version you used above):
51 yum --enablerepo=base install gcc make patch m4 openssl-devel yum-utils
52 . /etc/xensource-inventory
53 if [ "$PRODUCT_VERSION" == "5.6.0" ] ; then
54 yum -y --enablerepo=base install yum-utils
55 yumdownloader --enablerepo=base e2fsprogs-devel
56 rpm --nodeps -Uvh e2fsprogs-devel*.rpm
57 rm -f e2fsprogs-devel*.rpm
58 fi
59 yum --enablerepo=base install gcc make patch m4 openssl-devel yum-utils
60 mkdir /lib/modules/$kern/build
61 cd /lib/modules/$kern/build
62 tar -zxvf /opt/build/build.tar.gz
63 cd /opt/build
64
65 cd scst-1.0.1.1/src
66 make all
67 make install
68 depmod -aq
69
70 cd ../scstadmin-1.0.6
71 make all
72 make install
73 Remove the scst_disk module from the startup file
74 vi /etc/init.d/scst
75 change the line SCST_MODULES="scst scst-disk scst_vdisk" to SCST_MODULES="scst scst-disk scst_vdisk scst_tape"
76
77 cd /opt/build/iscsi-scst-1.0.1.1
78 make all
79 make install
80 cp etc/initiators.* /etc
81 cp etc/iscsi-scstd.conf /etc
82 depmod -aq
83
84 Now have a look in /proc/scsi/scsi (or use lsscsi) to get your HCIL info for your tape drive and create /etc/scst.conf using THAT info, NOT the example info given here...
85
86 [HANDLER tape]
87 DEVICE 6:0:3:0
88
89 [ASSIGNMENT Default]
90 DEVICE 6:0:3:0,0
91
92 •Now create /etc/iscsi-scstd.conf similar to the following
93 echo "Target $(sed -n 's/InitiatorName=//p' /etc/iscsi/initiatorname.iscsi):storage" >/etc/iscsi-scstd.conf
94
95 Target iqn.2005-03.org.open-iscsi:76cf8781117f:storage•Ensure you have TCP port 3260 open in /etc/sysconfig/iptables and run service iptables restart
96 •Finally, set the relevant daemons to start on boot with chkconfig scst on && chkconfig iscsi-scst on (and start them with service scst start && service iscsi-scst start)
97 You should now be able to discover and connect to the target.
98
99 Tested using MS iSCSI initiator on Windows Server 2008 against the above config on XenServer 5.6.
30 WikiWorld 100 </verbatim>
20 DanielLawson 101
102 !!!Making a tape drive available to a guest via iSCSI
103 __This is specifically for Citrix ~XenServer, although the principles will of course work in other Xen implementations__
104
105 I recently had a scenario where I was replacing two Windows servers with ~XenServer guests. This was fine, but we needed a way to backup to the existing SCSI DDS4 DAT drive. After failing to make PCI passthrough work, I settled on the much nicer method of providing the tape drive via an iSCSI target on the ~XenServer Host (Dom0). Here is how I achieved this.
25 GreigMcGill 106
107 __NOTE WELL: This method replaces the old one using a patched ietd. It is STILL unsupported__
108
109 * Download and install the DDK machine from citrix.com
110 * Download the following packages to the DDK from http://scst.sourceforge.net/downloads.html
111 ** scst
112 ** iscsi-scst
113 ** scstadmin
114 * Extract them in a build directory (I'm using /opt/build)
115 * Edit the scst-1.0.1.1/src/Makefile and uncomment the line <tt>EXTRA_CFLAGS += -DCONFIG_SCST_STRICT_SERIALIZING</tt>
116 * Now, in order, do a <tt>make</tt> and <tt>make install</tt> for scst, iscsi-scst, and scstadmin (you need the install, even though it's on the DDK for the deps of iscsi-scst)
117
118 Here's where it gets a little ugly, and I'd welcome suggestions (just edit this wiki) for how to do this the "right" way. This is necessary because the <tt>make install</tt> part of the build depends on having the kernel-dev skeleton installed, and this can't be installed on a ~XenServer Host (to my knowledge).
119
120 * tar up the devel tree - example (the dir will change depending on the ~XenServer/kernel version):
121 <pre>
122 cd /usr/src/kernels/2.6.18-128.1.6.el5.xs5.5.0.505.1024xen-i686
123 tar -czvpf /opt/build/build.tar.gz .
124 cd /opt/build
125 </pre>
126
127 OK, you're now ready to install on your target XenServer host
128
129 * Copy the entire /opt/build dir to the target host and execute the following steps ($kern is the version you used above):
130 <pre>
26 GreigMcGill 131 yum --enablerepo=base install gcc make patch m4 openssl-devel yum-utils
132 . /etc/xensource-inventory
27 GreigMcGill 133 if ~[ "$PRODUCT_VERSION" == "5.6.0" ] ; then
26 GreigMcGill 134 yum -y --enablerepo=base install yum-utils
28 CarlHeaton 135 yumdownloader --enablerepo=base e2fsprogs-devel
26 GreigMcGill 136 rpm --nodeps -Uvh e2fsprogs-devel*.rpm
137 rm -f e2fsprogs-devel*.rpm
138 fi
25 GreigMcGill 139 mkdir /lib/modules/$kern/build
140 cd /lib/modules/$kern/build
141 tar -zxvf /opt/build/build.tar.gz
142 cd /opt/build
143 cd scst-1.0.1.1
144 make install
145 cd ../scstadmin-1.0.6
146 make
147 make install
148 cd ../iscsi-scst-1.0.1.1
149 make
150 make install
151 </pre>
152
153 Now have a look in /proc/scsi/scsi (or use <tt>lsscsi</tt>) to get your HCIL info for your tape drive and create /etc/scst.conf using THAT info, NOT the example info given here...
154
155 <pre>
156 ~[HANDLER tape]
157 DEVICE 6:0:3:0
158
159 ~[ASSIGNMENT Default]
160 DEVICE 6:0:3:0,0
161 </pre>
162
163 * Now create /etc/iscsi-scstd.conf similar to the following (I generated mine using the method found [here | http://iscsi-scst.sourceforge.net/iscsi-scst-howto.txt])
164 <pre>
165 Target iqn.2005-03.org.open-iscsi:76cf8781117f:storage
166 </pre>
167
168 * Ensure you have TCP port 3260 open in /etc/sysconfig/iptables and run service iptables restart
169
170 * Finally, set the relevant daemons to start on boot with chkconfig scst on && chkconfig iscsi-scst on (and start them with service scst start && service iscsi-scst start)
171
172 You should now be able to discover and connect to the target.
173
174 Tested using MS iSCSI initiator on Windows Server 2008 against the above config on ~XenServer 5.5.
175
176 I note this page is referenced A LOT from Citrix and other sites. It is very important to note this is NOT supported by Citrix. It would be great if they provided this ability natively, to save me the ton of work I've had to do retesting the old solution and finally developing this one (well, I developed nothing, just put it all together, but still...). If this is useful to anyone out there, I'm a huge beer nerd, and love great craft beer from all over the world. If you want to say thanks, you can send beer to:
177
178
179 <pre>
180 Greig McGill
181 23 Saxbys Road
182 Hamilton 3206
183 New Zealand
184 </pre>
185
26 GreigMcGill 186 If you can't be arsed sending me a nice beer, well, I never thought you would anyway! :)
25 GreigMcGill 187
188 __The old method below works on XenServer pre 5.0__
20 DanielLawson 189
190 Note 1: This is totally unsupported by Citrix
191
192 Note 2: I've used the ~XenServer terminology "host" instead of Dom0, as this applies to the Citrix commercial implementation of Xen. It will probably work fine on OSS Xen, but you can just install the normal kernel dev packages and ignore the DDK stuff.
193
194 Note 3: This is for ~XenServer 4.1.0, but the principles are the same for previous versions. Just ensure you understand each step rather than following blindly.
195
196 Note 4: You'll need to enable yum repositories. Do this by editing /etc/yum.repos.d/CentOS-Base.repo, and set "enabled=1" for the Base, Updates and Addons repositories
23 GreigMcGill 197
24 GreigMcGill 198 Note 5: Thanks to the wonderful work of [Blake-r | http://sourceforge.net/users/blake-r] the [rawio patch | http://sourceforge.net/tracker/index.php?func=detail&aid=2855101&group_id=108475&atid=650593] has now been updated to work against [iscsitarget-0.4.17 | http://sourceforge.net/projects/iscsitarget/files/iscsitarget/0.4.17/iscsitarget-0.4.17.tar.gz/download] - when using this against a kernel newer than 2.6.22, you'll need to edit kernel/target_raw.c and replace all the psg.page occurrences with psg.page_link due to changes in the scatterlist struct. To take advantage of this, just substitute the newer versions of iscsitarget and the rawio patch in these instructions. You should be able to keep all the instructions the same, but I've not tested this yet.
20 DanielLawson 199
200 * Download the Xen 4.1 DDK from citrix.com
201 * The DDK is an ISO containing a VM with a development environment. Import it to your Xen host, and start it.
202 * Download iscsitarget 0.4.14 (you MUST use this version, as the patch for rawio support will not cleanly apply to 0.4.15) from http://optusnet.dl.sourceforge.net/sourceforge/iscsitarget/iscsitarget-0.4.14.tar.gz into your DDK VM.
203 * Download the patch for rawio support from http://sourceforge.net/mailarchive/attachment.php?list_name=iscsitarget-devel&message_id=1170171101.2822.23.camel@localhost.localdomain&counter=1 into your DDK VM (assuming you're saving it in /tmp)
204 * Now do the following:
205 <pre>
206 yum install kernel-devel bison flex
207 tar -zxvf iscsitarget-0.4.14.tar.gz
208 cd iscsitarget-0.4.14
209 patch -p0 < /tmp/raw.p
210 make
211 </pre>
212 * scp the entire iscsitarget-0.4.14 directory to your destination Xen host, and on that host (after enabling the base repo in /etc/yum.repos.d/CentOS-Base.repo) do:
213 <pre>
214 yum install make gcc
215 cd iscsitarget-0.4.14
216 make install
217 mkdir /lib/modules/`uname -r`/kernel/iscsi
218 cp kernel/iscsi_trgt.ko /lib/modules/`uname -r`/kernel/iscsi
219 depmod -aq
220 </pre>
221
222 The last three steps are required because <tt>make install</tt> will not copy the kernel module correctly outside the target environment.
223
224 * Now edit your <tt>/etc/ietd.conf</tt> and configure the tape as per the following example snippet (cat /proc/scsi/scsi for the correct [HCIL] values for your SCSI tape drive, this is an example only):
225 <pre>
226 Target iqn.2007-04.com.example:tape0
227 Lun 0 H=1,C=0,I=6,L=0,Type=rawio
228 Type 1
229 </pre>
230
231 * Save and do <tt>/etc/init.d/iscsi-target start</tt>
232 * Modify <tt>/etc/sysconfig/iptables</tt> to allow port 3260 tcp from the IP addresses running the initiator.
233 * Attach to the target using the initiator of your choice.
234
21 GreigMcGill 235 !!Working around pesky controllers which change HCIL at boot
20 DanielLawson 236
21 GreigMcGill 237 See the following, requested by Simon Larsen at http://fragged.nu/2009/05/making-a-tape-drive-available-to-a-guest-via-iscsi/
22 GreigMcGill 238
239 Simon, if you read this, your captcha on your blog is broken, preventing comments, and there's no contact email address. Hope you find this, and find it useful. ;)
21 GreigMcGill 240
241 Just bung it in your rc.local.
242
243 <verbatim>
244 #!/bin/bash
245 #
246 # This script is a (very) primitive method of determining the current HCIL info
247 # for /etc/ietd.conf (config file for iscsi-target) to work around some
248 # controllers which change this ID at boot time. You'll probably want to add
249 # some data validation of those vars as this is purely for my environments.
250 # Feel free to adapt or use it in any way you see fit.
251 # Greig McGill. August, 2009
252
253 # First set some vars
254
255 ietd="/etc/ietd.conf"
256 iqn="iqn.2009-08.nz.org.aol.internal:tape0"
257
258 # Get the whole HCIL string representing the tape drive.
259 # IMPORTANT NOTE: I am assuming there is only one sequential access device.
260 # If I am wrong, you WILL need to rewrite this, or badness will happen.
261 # You have been warned.
262
263 HCIL="`cat /proc/scsi/scsi | grep -B2 Sequential | head -1`"
264
265 # Now get each component
266
267 H="`echo $HCIL | cut -c 11`"
268 C="`echo $HCIL | cut -c 23`"
269 I="`echo $HCIL | cut -c 30`"
270 L="`echo $HCIL | cut -c 38`"
271
272 # Got all that, now generate ietd.conf and restart iscsi-target
273
274 cat <<EOT >$ietd
275 Target $iqn
276 Lun 0 H=$H,C=$C,I=$I,L=$L,Type=rawio
277 Type 1
278 EOT
279
280 /etc/init.d/iscsi-target restart
281
282 # exit with no error
283
284 exit 0
285 </verbatim>
20 DanielLawson 286
287 See [iSCSINotes] as well for more information
288
289 -----
290 CategoryXen

PHP Warning

lib/blame.php:177: Warning: Invalid argument supplied for foreach()