<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Running Systems</title>
	<atom:link href="http://run.tournament.org.il/feed/" rel="self" type="application/rss+xml" />
	<link>http://run.tournament.org.il</link>
	<description>(and me chasing them)</description>
	<lastBuildDate>Wed, 02 Jun 2010 13:50:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Don&#8217;t try it at home &#8211; NetApp SnapMirror network-free Seeding</title>
		<link>http://run.tournament.org.il/dont-try-it-at-home-netapp-snapmirror-network-free-seeding/</link>
		<comments>http://run.tournament.org.il/dont-try-it-at-home-netapp-snapmirror-network-free-seeding/#comments</comments>
		<pubDate>Wed, 26 May 2010 20:37:59 +0000</pubDate>
		<dc:creator>ez-aton</dc:creator>
				<category><![CDATA[Disk Storage]]></category>
		<category><![CDATA[netapp]]></category>
		<category><![CDATA[storage]]></category>

		<guid isPermaLink="false">http://run.tournament.org.il/?p=517</guid>
		<description><![CDATA[Well, this is rather common. Network-free seeding is being performed through using a tape device. What happens if you do not have a tape device? We have the poor-man&#8217;s huge TB disks (SATA for the people) connected to simple PC systems, but no tape&#8230; We perform network-free seeding into disk. There is a utility called [...]


Related posts:<ol><li><a href='http://run.tournament.org.il/citrix-xenserver-5-0-cannot-cooperate-with-netapp-snapmirror/' rel='bookmark' title='Permanent Link: Citrix XenServer 5.0 cannot cooperate with NetApp SnapMirror'>Citrix XenServer 5.0 cannot cooperate with NetApp SnapMirror</a> <small>It has been a long while, I know. I was...</small></li>
<li><a href='http://run.tournament.org.il/netapp-snapmirror-monitor-script/' rel='bookmark' title='Permanent Link: NetApp SnapMirror monitor script'>NetApp SnapMirror monitor script</a> <small>I have had some work done lately with NetApp SnapMirror....</small></li>
</ol>

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Well, this is rather common. Network-free seeding is being performed through using a tape device.<br />
What happens if you do not have a tape device? We have the poor-man&#8217;s huge TB disks (SATA for the people) connected to simple PC systems, but no tape&#8230;<br />
We perform network-free seeding into disk.</p>
<p>There is a utility called &#8216;lrep&#8217; which is nice and effective. It forces the use of Qtree-based snapmirror (QSM), which has its own limitations. I advise you&#8217;ll read NetApp&#8217;s &#8220;SnapMirror Async Overview and Best Practices Guide&#8221; with id TR3446 for further details.</p>
<p>Limitations:</p>
<ul>
<li>You have to have enough space on the source NetApp device to contain twice the volume you require to replicate</li>
<li>You can copy the output replica to an external Windows/Linux/Other system, of a movable type (could be a desktop), with large disks using CIFS or NFS.</li>
<li>HIgh CPU usage is guaranteed, as well as high disk usage.</li>
<li>You are aware to the fact that this is <em>dangerous</em>, and they will probably won&#8217;t like you just a little bit for doing this.</li>
</ul>
<p>Concept:</p>
<p>Using the command &#8216;<em>snapmirror store</em>&#8216; you are able to store initial replica into a tape device for later seeding. The options (/man/Internet) describe how you should use your tape device. You don&#8217;t have one, or you don&#8217;t have one on each site.</p>
<p>Operation:</p>
<ul>
<li>Create a volume or verify you have enough free space on some existing volume on the source NetApp device.</li>
<li>You will require the exact amount of used space on the source volume, give or give a little.</li>
<li>I recommend you&#8217;ll disable snapshots on the target volume for the duration of this operation, to save space.</li>
</ul>
<p>Let&#8217;s assume that the source volume name is &#8216;vol2&#8242;, and that we have enough free space on /vol/vol1/free_space.</p>
<p>You need to perform the following:</p>
<p><em>Dangerous</em> &#8211; change your privilege level:</p>
<blockquote><p>priv set diag</p></blockquote>
<p>Perform the initial SnapMirror</p>
<blockquote><p>snapmirror store vol2 /vol/vol1/free_space/vol2</p></blockquote>
<p>Remember &#8211; you have to be in &#8216;diag&#8217; mode for it to work.</p>
<p>Reduce your privileges to normal:</p>
<blockquote><p>priv set</p></blockquote>
<p>Track the status through</p>
<blockquote><p>snapmirror status</p></blockquote>
<p>When the operation has completed, connect from your external Windows/Linux/Other machine to /vol/vol1/free_space and copy out the file &#8216;vol2&#8242; which will probably be huge.</p>
<p>Transfer the Windows/Linux/Other system (or only its disk) to the alternate location, create a volume or verify you have enough free space on an existing volume to contain the entire file, and copy it to that location. I will assume it&#8217;s the same as on the source NetApp device &#8211; /vol/vol1/free_space/</p>
<p>Change your privileges level:</p>
<blockquote><p>﻿﻿priv set diag</p></blockquote>
<p>Create the target volume, and set it to be restricted (the values here are just an example):</p>
<blockquote><p>vol create vol2 aggr0 100g</p>
<p>vol restrict vol2</p></blockquote>
<p>Perform a &#8216;snapmirror retrieve&#8217; operation:</p>
<blockquote><p>snapmirror retrieve vol2 /vol/vol1/free_space/vol2</p></blockquote>
<p>Reduce your privileges to normal:</p>
<blockquote><p>priv set</p></blockquote>
<p>You can track the status through</p>
<blockquote><p>snapmirror status</p></blockquote>
<p>Following that, perform an update with the source NetApp real path (filer1:/vol/vol2) and you&#8217;re fine.</p>
<p>Remember &#8211; be very very careful when running under &#8216;diag&#8217; privileges.</p>


<p>Related posts:<ol><li><a href='http://run.tournament.org.il/citrix-xenserver-5-0-cannot-cooperate-with-netapp-snapmirror/' rel='bookmark' title='Permanent Link: Citrix XenServer 5.0 cannot cooperate with NetApp SnapMirror'>Citrix XenServer 5.0 cannot cooperate with NetApp SnapMirror</a> <small>It has been a long while, I know. I was...</small></li>
<li><a href='http://run.tournament.org.il/netapp-snapmirror-monitor-script/' rel='bookmark' title='Permanent Link: NetApp SnapMirror monitor script'>NetApp SnapMirror monitor script</a> <small>I have had some work done lately with NetApp SnapMirror....</small></li>
</ol></p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://run.tournament.org.il/dont-try-it-at-home-netapp-snapmirror-network-free-seeding/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Oracle VM post-install check list</title>
		<link>http://run.tournament.org.il/oracle-vm-post-install-check-list/</link>
		<comments>http://run.tournament.org.il/oracle-vm-post-install-check-list/#comments</comments>
		<pubDate>Fri, 21 May 2010 22:39:52 +0000</pubDate>
		<dc:creator>ez-aton</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Virtualization]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Xen]]></category>

		<guid isPermaLink="false">http://run.tournament.org.il/?p=515</guid>
		<description><![CDATA[Following my experience with OracleVM, I am adding my post-install steps for your pleasure. These steps are not mandatory, by design, but will help you get up and running faster and easier. These steps are relevant to Oracle VM 2.2, but might work for older (and newer) versions as well. Define bonding You should read [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Following my experience with OracleVM, I am adding my post-install steps for your pleasure. These steps are not mandatory, by design, but will help you get up and running faster and easier. These steps are relevant to Oracle VM 2.2, but might work for older (and newer) versions as well.</p>
<p><span style="text-decoration: underline;">Define bonding</span></p>
<p>You should read more about it in my <a href="http://run.tournament.org.il/oracle-vm-and-network-bonding/" target="_blank">past post</a>.</p>
<p><span style="text-decoration: underline;">Define storage multipathing</span></p>
<p>You can read about it <a href="http://wiki.oracle.com/page/Oracle+VM+Server+configuration:+multiple+networks,+multipathed+SAN+storage" target="_blank">here</a>.</p>
<p><span style="text-decoration: underline;">Define NTP</span></p>
<p>Define NTP servers for your Oracle VM host. Make sure the daemon &#8216;ntpd&#8217; is running, and following an initial time update, via</p>
<blockquote><p>ntpdate -u &lt;server&gt;</p></blockquote>
<p>to set the clock right initially, perform a sync to the hardware clock, for good measures</p>
<blockquote><p>hwclock &#8211;systohc</p></blockquote>
<p>Make sure NTPD starts on boot:</p>
<blockquote><p>chkconfig ntpd on</p></blockquote>
<p><span style="text-decoration: underline;">Install Linux VM</span></p>
<p>If the system is going to be stand-alone, you might like to run your VM Manager on it (we will deal with issues of it later). To do so, you will need to install your own Linux machine, since Oracle supplied image fails (or at least &#8211; failed for me!) for no apparent reason (kernel panic, to be exact, on a fully MD5 checked image). You could perform this action from the command line by running the command</p>
<blockquote><p>virt-install -n linux_machine -r 1024 -p &#8211;nographics -l nfs://iso_server:/mount</p></blockquote>
<p>This directive installs a VM called &#8220;linux_machine&#8221; from nfs iso_server:/mount, with 1GB RAM. You will be asked about where to place the VM disk, and you should place it in /OVS/running_pool/linux_machine , accordingly.</p>
<p>It assumes you have DHCP available for the install procedure, etc.</p>
<p><span style="text-decoration: underline;">Install Oracle VM Manager on the virtual Linux machine</span></p>
<p>This should be performed if you select to manage your VMs from a VM. This is a bit tricky, as you are recommended <span style="text-decoration: underline;">not to do so</span> if you designing HA-enabled server pool.</p>
<p><span style="text-decoration: underline;">Define autostart to all your VMs</span></p>
<p>Or, at least, those you want to auto start. Create a link from <em>/OVS/running_pool/&lt;VM_NAME&gt;/vm.cfg</em> to <em>/etc/xen/auto/</em></p>
<p>The order in which &#8216;ls&#8217; command will see them in <em>/etc/xen/auto/</em> is the order in which they will be called.</p>
<p><span style="text-decoration: underline;">Disable or relocate auto-suspending</span></p>
<p>Auto-suspend is cool, but your default Oracle VM installation has shortage of space under <em>/var/lib/xen/save/</em> directory, where persistent memory dumps are kept.  On a 16GB RAM system, this can get pretty high, which is far more than your space can contain.</p>
<p>Either increase the size (mount something else there, I assume), or edit <em>/etc/sysconfig/xendomains</em> and comment the line  with the directive <em>XENDOMAINS_SAVE=</em> . You could also change the desired path to somewhere you have enough space on.</p>
<p>Hashing this directive will force regular shutdown to your VMs following a power off/reboot command to the Oracle VM.</p>
<p><span style="text-decoration: underline;">Make sure auto-start VMs actually start</span></p>
<p>This is an annoying bug. For auto-start of VMs, you need /OVS up and available. Since it&#8217;s OCFS2 file system, it takes a short while (being performed by ovs-agent).</p>
<p>Since ovs-agent takes a while, we need to implement a startup script after it and before xendomains. Since both are markes &#8220;S99&#8243; (check /etc/rc3.d/ for details), we would add a script called &#8220;sleep&#8221;.</p>
<p>The script should be placed in <em>/etc/init.d/</em></p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p515code5'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p5155"><td class="code" id="p515code5"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># sleep     Workaround Oracle VM delay issues</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># chkconfig: 2345 99 99</span>
<span style="color: #666666; font-style: italic;"># description: Adds a predefined delay to the initialization process</span>
<span style="color: #666666; font-style: italic;">#</span>
&nbsp;
<span style="color: #007800;">DELAY</span>=<span style="color: #000000;">60</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">case</span> <span style="color: #ff0000;">&quot;$1&quot;</span> <span style="color: #000000; font-weight: bold;">in</span>
start<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #007800;">$DELAY</span>
<span style="color: #000000; font-weight: bold;">;;</span>
<span style="color: #000000; font-weight: bold;">esac</span>
<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">0</span></pre></td></tr></table></div>

<p>Place the script as a file called &#8220;sleep&#8221; (omit the suffix I added in this post), set it to be executable, and then run</p>
<blockquote><p>chkconfig &#8211;add sleep</p></blockquote>
<p>This will solve VM startup problems.</p>
<p><span style="text-decoration: underline;">Fix /etc/hosts file</span></p>
<p>If you are into multi-server pool, you will need that the host name would not be defined to 127.0.0.1 address. By default, Oracle VM defines it to match 127.0.0.1, which will result in a poor attempt to create multi-server pool.</p>
<p>This is all I have had in mind for now. It should solve most new-comer issues with Oracle VM, and allow you to make good use of it. It&#8217;s a nice system, albeit it&#8217;s ugly management.</p>
<p><span style="text-decoration: underline;">Update the OracleVM</span></p>
<p>You could use Oracle&#8217;s unbreakable network, if you are a paying customer, or you could use the <a href="http://public-yum.oracle.com/" target="_blank">Public Yum Server</a> for your system.</p>
<p><span style="text-decoration: underline;">Updates to Oracle VM Manager</span></p>
<p>If you won&#8217;t use Oracle Grid Control (Enterprise Manager) to manage the pool, you will probably use Oracle VM Manager. You would need to update the ovs-console package, and you will probably want to add tightvnc-java package, so that IE users will be able to use the web-based VNC services. You would better grub these packages from <a href="http://oss.oracle.com/oraclevm/manager/RPMS/" target="_blank">here</a>.</p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://run.tournament.org.il/oracle-vm-post-install-check-list/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Citrix XenServer and DR</title>
		<link>http://run.tournament.org.il/citrix-xenserver-and-dr/</link>
		<comments>http://run.tournament.org.il/citrix-xenserver-and-dr/#comments</comments>
		<pubDate>Sat, 15 May 2010 23:15:49 +0000</pubDate>
		<dc:creator>ez-aton</dc:creator>
				<category><![CDATA[Scripting/Programing]]></category>
		<category><![CDATA[Virtualization]]></category>

		<guid isPermaLink="false">http://run.tournament.org.il/?p=513</guid>
		<description><![CDATA[Assuming your storage is capable of replication, a bunch of VMs could be happily replicated to an alternate location, where you can start them on will (and on crisis, most likely). This procedure, in theory, is rather simple. I have discovered that it is less so, especially if your system goes into testing once a [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Assuming your storage is capable of replication, a bunch of VMs could be happily replicated to an alternate location, where you can start them on will (and on crisis, most likely).</p>
<p>This procedure, in theory, is rather simple. I have discovered that it is less so, especially if your system goes into testing once a while.</p>
<p>This leaves some &#8220;memories&#8221; with Citrix XenServer, as well as the underlayer OS.</p>
<p>The forums show examples of how to handle iSCSI re-attach, so I am adding here hot to handle fiber channel re-attach operation as well, especially if you&#8217;re using multipath.</p>
<p><span style="text-decoration: underline;">Grab the SCSI ID</span></p>
<p>The SCSI ID is very important, as it is he basic identified of the LUN:</p>
<blockquote><p>xe sr-proble type=lvmohba 2&gt;&amp;1</p></blockquote>
<p>This will show a section (XML-like) under &#8220;SCSIid&#8221; containing the device&#8217;s SCSI ID. Also &#8211; grab the UUID of the device, as XenServer assigns. You could do this with:</p>
<blockquote><p>xe sr-probe type=lvmohba device-config:SCSIid=&lt;Enter SCSI ID here&gt;</p></blockquote>
<p><span style="text-decoration: underline;">Introduce the Device</span></p>
<p>The system needs the device introduced. For that we&#8217;ll use the above captured UUID:</p>
<blockquote><p>xe sr-introduce uuid=&lt;Enter the UUID obtained before&gt; shared=true typb=lvmohba namb-label=&#8221;Imported SR&#8221;</p></blockquote>
<p>Keep the UUID returned by this command. I will reference to it as &#8220;SR UUID&#8221;</p>
<p><span style="text-decoration: underline;">Create PBD for each host in the pool</span></p>
<p>This should be performed for each host, based on the UUID of all hosts:</p>
<blockquote><p>xe pbd-create sr-uuid=&lt;Enter the SR UUID obtained before&gt; device-config=SCSIid=&lt;Enter SCSI ID&gt; host-uuid=&lt;Enter UUID of host&gt;</p></blockquote>
<p>The result value, for each host, is the pbd UUID for that specific host. pbd is a physical Block Device, meaning &#8211; the &#8220;connection&#8221; of the Storage Repository (which is pool-wide) to the specific host.</p>
<p><span style="text-decoration: underline;">Plug PBDs</span></p>
<p>For each of the pbd UUID obtained above, run the following command to plug it in:</p>
<blockquote><p>xe pbd-plug uuid=&lt;pbd UUID as obtained above&gt;</p></blockquote>
<p>That should be all.</p>
<p>For ease of repeat, below is a script to perform these exact actions automatically. It assumes one (1) unallocated LUN at the beginning of the process. It will probably behave differently for more than one.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Download <a href="http://run.tournament.org.il/wp-content/plugins/wp-codebox/wp-codebox.php?p=513&amp;download=re-introduce.sh">re-introduce.sh</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p5137"><td class="code" id="p513code7"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #007800;">SCSIID</span>=<span style="color: #000000; font-weight: bold;">`</span>xe sr-probe <span style="color: #007800;">type</span>=lvmohba <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">1</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-A1</span> SCSIid <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-v</span> SCSIid <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-v</span> vendor <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">tail</span> <span style="color: #660033;">-1</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $NF}'</span><span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;scsi ID: <span style="color: #007800;">$SCSIID</span>&quot;</span>
<span style="color: #007800;">UUID</span>=<span style="color: #000000; font-weight: bold;">`</span>xe sr-probe <span style="color: #007800;">type</span>=lvmohba device-config:<span style="color: #007800;">SCSIid</span>=<span style="color: #007800;">$SCSIID</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-A1</span> UUID <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-v</span> UUID <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-v</span> Devlist <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">head</span> <span style="color: #660033;">-1</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $NF}'</span><span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;SR UUID <span style="color: #007800;">$UUID</span>&quot;</span>
<span style="color: #007800;">SRID</span>=<span style="color: #000000; font-weight: bold;">`</span>xe sr-introduce <span style="color: #007800;">uuid</span>=<span style="color: #007800;">$UUID</span> name-label=<span style="color: #ff0000;">&quot;Imported SR&quot;</span> <span style="color: #007800;">shared</span>=<span style="color: #c20cb9; font-weight: bold;">true</span> <span style="color: #007800;">type</span>=lvmohba<span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;SR UID: <span style="color: #007800;">$SRID</span>&quot;</span>
<span style="color: #007800;">HOSTID</span>=<span style="color: #000000; font-weight: bold;">`</span>xe host-list  <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> uuid <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $NF}'</span><span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #007800;">PBDID</span>=<span style="color: #ff0000;">&quot;&quot;</span>
<span style="color: #000000; font-weight: bold;">for</span> i <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #007800;">$HOSTID</span>
<span style="color: #000000; font-weight: bold;">do</span> 
   <span style="color: #007800;">PBDID</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$PBDID</span> <span style="color: #780078;">`xe pbd-create sr-uuid=$SRID device-config:SCSIid=$SCSIID host-uuid=$i`</span>&quot;</span>
<span style="color: #000000; font-weight: bold;">done</span>
<span style="color: #000000; font-weight: bold;">for</span> i <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #007800;">$PBDID</span>
<span style="color: #000000; font-weight: bold;">do</span>
   xe pbd-plug <span style="color: #007800;">uuid</span>=<span style="color: #007800;">$i</span>
<span style="color: #000000; font-weight: bold;">done</span></pre></td></tr></table></div>



<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://run.tournament.org.il/citrix-xenserver-and-dr/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Oracle VM and network bonding</title>
		<link>http://run.tournament.org.il/oracle-vm-and-network-bonding/</link>
		<comments>http://run.tournament.org.il/oracle-vm-and-network-bonding/#comments</comments>
		<pubDate>Sun, 09 May 2010 06:30:54 +0000</pubDate>
		<dc:creator>ez-aton</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Scripting/Programing]]></category>
		<category><![CDATA[Virtualization]]></category>
		<category><![CDATA[bash]]></category>

		<guid isPermaLink="false">http://run.tournament.org.il/?p=507</guid>
		<description><![CDATA[Oracle VM, out of the box, does not allow network bonds. An excellent guide on how to enable bonding which I have partially followed, has convinced me that changing the relevant scripts would be better. That I have done, and reported in this wiki post. To sum things up &#8211; configure bonding/VLAN tagging as you [...]


Related posts:<ol><li><a href='http://run.tournament.org.il/xen-networking-bonding-with-vlan-tagging/' rel='bookmark' title='Permanent Link: Xen Networking &#8211; Bonding with VLAN Tagging'>Xen Networking &#8211; Bonding with VLAN Tagging</a> <small>The simple scripts in /etc/xen/scripts which manage networking are fine...</small></li>
<li><a href='http://run.tournament.org.il/vlan-tagging-with-bonding-network-interface-on-rhel4/' rel='bookmark' title='Permanent Link: Vlan Tagging with bonding network interface on RHEL4'>Vlan Tagging with bonding network interface on RHEL4</a> <small>This is not a simple task, as there are few...</small></li>
</ol>

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Oracle VM, out of the box, does not allow network bonds. <a href="http://wiki.oracle.com/page/Oracle%20VM%20Server%20Configuration-%20bonded%20and%20trunked%20network%20interfaces" target="_blank">An excellent guide</a> on how to enable bonding which I have partially followed, has convinced me that changing the relevant scripts would be better. That I have done, and reported in this <a href="http://wiki.oracle.com/page/Oracle+VM+Server+Configuration+-+bonded+and+trunked+network+interfaces+-+alternate+view" target="_blank">wiki post</a>.</p>
<p>To sum things up &#8211; configure bonding/VLAN tagging as you would have normally do on any RHEL-based Linux distro, and replace the script /etc/xen/scripts/network-bridges with the modified one mentioned below. This script will define bridge for each network interface node already defined as bridge, or slave of a bond connection, as part of the xend service.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Download <a href="http://run.tournament.org.il/wp-content/plugins/wp-codebox/wp-codebox.php?p=507&amp;download=network-bridges">network-bridges</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p5079"><td class="code" id="p507code9"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash </span>
<span style="color: #666666; font-style: italic;"># </span>
<span style="color: #666666; font-style: italic;"># Runs network-bridge against each ethernet card. </span>
<span style="color: #666666; font-style: italic;"># </span>
&nbsp;
<span style="color: #007800;">dir</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">dirname</span> <span style="color: #ff0000;">&quot;$0&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> 
&nbsp;
run_all_ethernets<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> 
<span style="color: #7a0874; font-weight: bold;">&#123;</span> 
    <span style="color: #007800;">devnum</span>=<span style="color: #000000;">0</span>
    <span style="color: #000000; font-weight: bold;">for</span> f <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">/</span>sys<span style="color: #000000; font-weight: bold;">/</span>class<span style="color: #000000; font-weight: bold;">/</span>net<span style="color: #000000; font-weight: bold;">/*</span>; <span style="color: #000000; font-weight: bold;">do</span> 
        <span style="color: #007800;">netdev</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">basename</span> <span style="color: #007800;">$f</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> 
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$netdev</span> =~ <span style="color: #ff0000;">&quot;^bond[0-9.]+$&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$netdev</span> =~ <span style="color: #ff0000;">&quot;^eth[0-9.]+$&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span> 
		<span style="color: #666666; font-style: italic;"># devnum=${netdev:3} </span>
		<span style="color: #7a0874; font-weight: bold;">unset</span> SLAVE MASTER BRIDGE
		. <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>sysconfig<span style="color: #000000; font-weight: bold;">/</span>network-scripts<span style="color: #000000; font-weight: bold;">/</span>ifcfg-<span style="color: #800000;">${netdev}</span>
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$SLAVE</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">egrep</span> <span style="color: #ff0000;">&quot;yes|YES|1&quot;</span><span style="color: #000000; font-weight: bold;">`</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$BRIDGE</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> ;<span style="color: #000000; font-weight: bold;">then</span>            
			<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Interface <span style="color: #007800;">${netdev}</span> is being defined and claimed by someone else&quot;</span>
		<span style="color: #000000; font-weight: bold;">else</span>	
			<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$netdev</span> =~ <span style="color: #ff0000;">&quot;^((eth)|(bond))[0-9]+\.&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
				<span style="color: #666666; font-style: italic;"># This is vlan tagging, and we want persistent vlan name!</span>
				<span style="color: #007800;">VLAN</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$netdev</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cut</span> <span style="color: #660033;">-f2</span> -d.<span style="color: #7a0874; font-weight: bold;">&#41;</span>
				<span style="color: #666666; font-style: italic;"># Assume tags are unique on a server - no several bridges for a single tag.</span>
				<span style="color: #666666; font-style: italic;"># If you intend on having eth2.3 and eth3.3 to your vms as bridges (and not deal with it</span>
				<span style="color: #666666; font-style: italic;"># on the host level), this script is not for you</span>
				<span style="color: #007800;">$dir</span><span style="color: #000000; font-weight: bold;">/</span>network-bridge <span style="color: #ff0000;">&quot;$@&quot;</span> <span style="color: #ff0000;">&quot;netdev=<span style="color: #007800;">${netdev}</span>&quot;</span> <span style="color: #ff0000;">&quot;bridge=xenbrv<span style="color: #007800;">${VLAN}</span>&quot;</span>
			<span style="color: #000000; font-weight: bold;">else</span>
				<span style="color: #007800;">$dir</span><span style="color: #000000; font-weight: bold;">/</span>network-bridge <span style="color: #ff0000;">&quot;$@&quot;</span> <span style="color: #ff0000;">&quot;netdev=<span style="color: #007800;">${netdev}</span>&quot;</span> <span style="color: #ff0000;">&quot;bridge=xenbr<span style="color: #007800;">${devnum}</span>&quot;</span> 
				<span style="color: #7a0874; font-weight: bold;">let</span> devnum++
			<span style="color: #000000; font-weight: bold;">fi</span>
	  	<span style="color: #000000; font-weight: bold;">fi</span>
        <span style="color: #000000; font-weight: bold;">fi</span>  
    <span style="color: #000000; font-weight: bold;">done</span> 
<span style="color: #7a0874; font-weight: bold;">&#125;</span> 
&nbsp;
run_all_ethernets <span style="color: #ff0000;">&quot;$@&quot;</span></pre></td></tr></table></div>



<p>Related posts:<ol><li><a href='http://run.tournament.org.il/xen-networking-bonding-with-vlan-tagging/' rel='bookmark' title='Permanent Link: Xen Networking &#8211; Bonding with VLAN Tagging'>Xen Networking &#8211; Bonding with VLAN Tagging</a> <small>The simple scripts in /etc/xen/scripts which manage networking are fine...</small></li>
<li><a href='http://run.tournament.org.il/vlan-tagging-with-bonding-network-interface-on-rhel4/' rel='bookmark' title='Permanent Link: Vlan Tagging with bonding network interface on RHEL4'>Vlan Tagging with bonding network interface on RHEL4</a> <small>This is not a simple task, as there are few...</small></li>
</ol></p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://run.tournament.org.il/oracle-vm-and-network-bonding/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>After a very long absence, Changing Linux HVM to PV on Xen</title>
		<link>http://run.tournament.org.il/changing-linux-hvm-to-pv-on-xen/</link>
		<comments>http://run.tournament.org.il/changing-linux-hvm-to-pv-on-xen/#comments</comments>
		<pubDate>Sat, 08 May 2010 01:53:43 +0000</pubDate>
		<dc:creator>ez-aton</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Virtualization]]></category>

		<guid isPermaLink="false">http://run.tournament.org.il/?p=503</guid>
		<description><![CDATA[I have had a stressed time, and had no time to actually write down anything here. This is pity, since I have been doing so many things worth sharing. I will start with a small one now &#8211; how to convert a physical machine into Xen-based VM. I assume you know the drill of how [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>I have had a stressed time, and had no time to actually write down anything here. This is pity, since I have been doing so many things worth sharing.<br />
I will start with a small one now &#8211; how to convert a physical machine into Xen-based VM. I assume you know the drill of how to do P2V in whatever method you like. My preferred method is of booting into a new system (virtual) and then manually building the partitions, LVM, etc, and using &#8216;tar&#8217; with &#8216;nc&#8217; to copy files from the source server to the target server. I might elaborate more about it some time, but this post is about the next phase &#8211; We have now previously physical server which used to use /dev/sdX or /dev/cciss/cXdXpX, or whatever else, and we need to make it Xen-friendly.<br />
This procedure will apply to RedHat&#8217;s Xen-based virtualization, OracleVM or Citrix XenServer.<br />
I assume that the target system maintains LVM settings and mount points as the original one.<br />
These are the steps that need to be performed, manually.<br />
I used CactiEZ image, installed as HVM on Citrix XenServer as my example. This procedure should apply to all Linux systems, with respect to their package manager.</p>
<p><strong>Edit /etc/modprobe.conf</strong></p>
<p>Change eth0,1,whatever alias to xennet</p>
<p>Change/add alias of scsi_hostadapter to xenblk</p>
<p><strong>Edit /etc/blkid.tab</strong></p>
<p>Run the command</p>
<blockquote><p>sed -i &#8216;s/hd/xvd/g&#8217; /etc/blkid.tab</p></blockquote>
<p>to change references if you use labels. These will be used by rc.sysinit later during boot sequence, and we need them configured correctly.</p>
<p><strong>Get Paravirtualized Kernel</strong></p>
<p>yum install kernel-xenU</p>
<p><strong>Edit /etc/securetty</strong></p>
<p>Add the line &#8220;xvc0&#8243; to it. Notice, it&#8217;s zero and not &#8216;o&#8217;</p>
<p><strong>Edit /etc/inittab</strong></p>
<p>Replace tty1 with xvc0</p>
<p><strong>Edit /boot/grub/menu.lst</strong></p>
<p>Change the default entry to be the one with the xenU kernel</p>
<p>Replace &#8216;/dev/sda&#8217; with &#8216;/dev/xvda&#8217;</p>
<p><strong>Edit /boot/grub/device.map</strong></p>
<p>Replace &#8216;/dev/sda&#8217; with &#8216;/dev/xvda&#8217;</p>
<p><strong>Edit /etc/fstab</strong></p>
<p>Verify labels are used (and then &#8211; see changes to blkid.tab above), or devices are renamed to xvd[a-z]</p>
<p><strong>Reboot into PV-enabled VM</strong></p>
<p>This should do it. The VM will attempt to detect new hardware, network MAC changes, etc, but it will work fine.</p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://run.tournament.org.il/changing-linux-hvm-to-pv-on-xen/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NetApp SnapMirror monitor script</title>
		<link>http://run.tournament.org.il/netapp-snapmirror-monitor-script/</link>
		<comments>http://run.tournament.org.il/netapp-snapmirror-monitor-script/#comments</comments>
		<pubDate>Sun, 13 Dec 2009 09:02:18 +0000</pubDate>
		<dc:creator>ez-aton</dc:creator>
				<category><![CDATA[Disk Storage]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[bandwidth limits]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[netapp]]></category>
		<category><![CDATA[replication]]></category>
		<category><![CDATA[storage device]]></category>

		<guid isPermaLink="false">http://run.tournament.org.il/?p=499</guid>
		<description><![CDATA[I have had some work done lately with NetApp SnapMirror. I have snapped-mirrored some volumes and qtrees and I wanted to monitor their use and behavior over the line. As you can expect, site-to-site replication of data is a fragile thing, especially when done on the level of the storage device, which is agnostic to [...]


Related posts:<ol><li><a href='http://run.tournament.org.il/citrix-xenserver-5-0-cannot-cooperate-with-netapp-snapmirror/' rel='bookmark' title='Permanent Link: Citrix XenServer 5.0 cannot cooperate with NetApp SnapMirror'>Citrix XenServer 5.0 cannot cooperate with NetApp SnapMirror</a> <small>It has been a long while, I know. I was...</small></li>
</ol>

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>I have had some work done lately with NetApp SnapMirror. I have snapped-mirrored some volumes and qtrees and I wanted to monitor their use and behavior over the line.</p>
<p>As you can expect, site-to-site replication of data is a fragile thing, especially when done on the level of the storage device, which is agnostic to the data kept on it. When replicating volumes, I should expect the relevant employees to be responsible regarding what&#8217;s placed there, because the storage does not filter out the junk. If someone had decided to add a new DVD image on the DB storage space, well &#8211; the DB won&#8217;t care, as long as there is enough free space, but the storage will attempt to replicate the added data to the alternate site, which means that if you are around your bandwidth limits, which is never a good thing, you will just create a delay gap you would hardly (if at all) be able to close.</p>
<p>For that, and since I don&#8217;t tend to trust people not to do stupid things, I have written this script.</p>
<p><span style="text-decoration: underline;">What does it do?</span></p>
<p>This script will perform the following:</p>
<p><strong>Alerting about non-idle SnapMirror session</strong></p>
<p>Use with &#8216;-m alert&#8217;</p>
<p>Assuming SnapMirror is scheduled to a specific time, the script will alert if a session is active. With the flag &#8216;-a no&#8217;, it will not send an e-mail (if possible, see the configuration section below). With &#8216;-r yes&#8217;, it will react, setting throttle for each non-idle session, but then &#8216;-t VALUE&#8217; should be specified, where VALUE is the numeric throttle in KB/s.</p>
<p><strong>Limiting throttle to a SnapMirror session</strong></p>
<p>Use with &#8216;-m throttle_limit&#8217;</p>
<p>The script will set a throttle for SnapMirror session(s). Setting limit by the flag &#8216;-t VALUE&#8217;, where VALUE is the numeric throttle in KB/s per each session.</p>
<p><strong>Cancelling throttle limit</strong></p>
<p>Use with &#8216;-m throttle_unlimit&#8217;</p>
<p>The script will set unlimited throttle for SnapMirror session(s).</p>
<p><strong>Checking SnapMirror lag</strong></p>
<p>Use with the &#8216;-m check_lag&#8217;</p>
<p>Since replication has a purpose of recovering, the lag of each SnapMirror session would show how far back we are. Use with &#8216;-d VALUE&#8217;, VALUE being numeric time in minutes to set alert threshold. The default threshold delay is one day (1440 minutes).</p>
<p><strong>Checking snapshots size</strong></p>
<p>Use with the &#8216;-m check_size&#8217;</p>
<p>This reports the expected delta to transfer. This can help estimate the success or failure of a future sync of data (snapmirror update) before it begins. Use with &#8216;-l&#8217; flag to set it to log date/time of measure and the expected sizes into a file. By default, in /tmp/target_name.txt, where the target is the SnapMirror target.</p>
<p><strong>General Options</strong></p>
<p>Use with &#8216;-c filename&#8217; for alternate configuration file.</p>
<p>Use with &#8216;-h&#8217; to get general help.</p>
<p>Use with a list target names in the format of storage:/vol/volname/qtree or storage:volname to ignore targets in configuration file and use your own.</p>
<p><strong>Configuration File</strong></p>
<p>The configuration file is rather simple. By default it should be called &#8220;<em>/etc/snapmirror_monitor.conf</em>&#8220;. It consists of two main variables for the system:</p>
<blockquote><p>TGTS=&#8221;storage2:/vol/volname/qtree</p>
<p>storage3:volname2</p>
<p>storage1:/vol/volnew/qtr2&#8243;</p>
<p>EMAIL=&#8221;user@domain.com another_user@domain.com&#8221;</p></blockquote>
<p><strong>Prerequisites</strong></p>
<p>This script will run on any modern Linux machine. For it to communicate with the NetApp devices, you will need SSH enabled on the NetApps, and ssh key exchange so that the Linux would be able to access the NetApp without using passwords.</p>
<p><span style="text-decoration: underline;">The Script</span></p>
<p>Below is the script. You can download it and use it as you like.</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Download <a href="http://run.tournament.org.il/wp-content/plugins/wp-codebox/wp-codebox.php?p=499&amp;download=snapshot_mirror.sh">snapshot_mirror.sh</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p49911"><td class="code" id="p499code11"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #666666; font-style: italic;"># This script will monitor snapmirror status</span>
<span style="color: #666666; font-style: italic;"># Assumption: Access through ssh to root on all storage devices involved</span>
<span style="color: #666666; font-style: italic;"># This will also attempt to detect the diff which is to sync</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Written by Ez-Aton. Check http://run.tournament.org.il for updates or</span>
<span style="color: #666666; font-style: italic;"># additional information</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Modes: </span>
<span style="color: #666666; font-style: italic;"># alert -&gt; alert if snapmirror is still active</span>
<span style="color: #666666; font-style: italic;"># throttle_limit -&gt; Limit throttle to a given number (default or manually set)</span>
<span style="color: #666666; font-style: italic;"># throttle_unlimit -&gt; Open throttle limitation</span>
<span style="color: #666666; font-style: italic;"># check_lag -&gt; Report the snapmirror lage</span>
<span style="color: #666666; font-style: italic;"># check_size -&gt; Report the estimated data size to move</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Global variables</span>
<span style="color: #007800;">CONF</span>=<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>snapmirror_monitor.conf
<span style="color: #007800;">LOG_PREFIX</span>=<span style="color: #000000; font-weight: bold;">/</span>tmp
&nbsp;
test_connection <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
        <span style="color: #666666; font-style: italic;"># Test to see that you can access the storage device</span>
        <span style="color: #666666; font-style: italic;"># Arguments: NetApp name</span>
        <span style="color: #007800;">SSH_OPTS</span>=<span style="color: #ff0000;">&quot;-o ConnectTimeout=2&quot;</span>
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #c20cb9; font-weight: bold;">ssh</span> <span style="color: #007800;">$SSH_OPTS</span> <span style="color: #007800;">$1</span> <span style="color: #c20cb9; font-weight: bold;">hostname</span> <span style="color: #000000; font-weight: bold;">&amp;&gt;/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null
        <span style="color: #000000; font-weight: bold;">then</span>
                <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Cannot communicate via SSH to $1&quot;</span>
                <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
        <span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
abort <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
        <span style="color: #666666; font-style: italic;"># Exit with a predefined error message</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$*</span>
        <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
get_arguments <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
        <span style="color: #666666; font-style: italic;"># Get all arguments and define options</span>
        <span style="color: #666666; font-style: italic;"># Argument: $@</span>
        <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-z</span> <span style="color: #ff0000;">&quot;$1&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #000000; font-weight: bold;">set</span> <span style="color: #660033;">--</span> <span style="color: #660033;">-h</span>
        <span style="color: #000000; font-weight: bold;">while</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;$1&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>
        <span style="color: #000000; font-weight: bold;">do</span>
                <span style="color: #000000; font-weight: bold;">case</span> <span style="color: #ff0000;">&quot;$1&quot;</span> <span style="color: #000000; font-weight: bold;">in</span>
                        -m<span style="color: #7a0874; font-weight: bold;">&#41;</span>     <span style="color: #7a0874; font-weight: bold;">shift</span>
                                <span style="color: #000000; font-weight: bold;">case</span> <span style="color: #ff0000;">&quot;$1&quot;</span> <span style="color: #000000; font-weight: bold;">in</span>
                                        alert<span style="color: #000000; font-weight: bold;">|</span>throttle_limit<span style="color: #000000; font-weight: bold;">|</span>throttle_unlimit<span style="color: #000000; font-weight: bold;">|</span>check_lag<span style="color: #000000; font-weight: bold;">|</span>check_size<span style="color: #7a0874; font-weight: bold;">&#41;</span>     <span style="color: #007800;">MODE</span>=<span style="color: #007800;">$1</span>
                                        <span style="color: #000000; font-weight: bold;">;;</span>
                                        <span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>      abort <span style="color: #ff0000;">&quot;Mode is mandatory. Use -h flag to get list of avialable flags&quot;</span>
                                        <span style="color: #000000; font-weight: bold;">;;</span>
                                <span style="color: #000000; font-weight: bold;">esac</span>
                                <span style="color: #000000; font-weight: bold;">;;</span>
                        -a<span style="color: #7a0874; font-weight: bold;">&#41;</span>     <span style="color: #7a0874; font-weight: bold;">shift</span>
                                <span style="color: #000000; font-weight: bold;">case</span> <span style="color: #ff0000;">&quot;$1&quot;</span> <span style="color: #000000; font-weight: bold;">in</span>
                                        <span style="color: #7a0874; font-weight: bold;">&#91;</span>nN<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span>oO<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>       <span style="color: #007800;">NOMAIL</span>=<span style="color: #000000;">1</span>
                                                        <span style="color: #000000; font-weight: bold;">;;</span>
                                        <span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>              <span style="color: #007800;">NOMAIL</span>=<span style="color: #000000;">0</span>
                                                        <span style="color: #000000; font-weight: bold;">;;</span>
                                <span style="color: #000000; font-weight: bold;">esac</span>
                                <span style="color: #000000; font-weight: bold;">;;</span>
                        -r<span style="color: #7a0874; font-weight: bold;">&#41;</span>     <span style="color: #7a0874; font-weight: bold;">shift</span>
                                <span style="color: #000000; font-weight: bold;">case</span> <span style="color: #ff0000;">&quot;$1&quot;</span> <span style="color: #000000; font-weight: bold;">in</span>
                                        <span style="color: #7a0874; font-weight: bold;">&#91;</span>yY<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span>eE<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span>sS<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>   <span style="color: #007800;">REACT</span>=<span style="color: #000000;">1</span>
                                                        <span style="color: #000000; font-weight: bold;">;;</span>
                                        <span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>              <span style="color: #007800;">REACT</span>=<span style="color: #000000;">0</span>
                                                        <span style="color: #000000; font-weight: bold;">;;</span>
                                <span style="color: #000000; font-weight: bold;">esac</span>
                                <span style="color: #000000; font-weight: bold;">;;</span>
                        -d<span style="color: #7a0874; font-weight: bold;">&#41;</span>     <span style="color: #7a0874; font-weight: bold;">shift</span>
                                <span style="color: #7a0874; font-weight: bold;">declare</span> <span style="color: #660033;">-i</span> DELAY_TMP
                                <span style="color: #007800;">DELAY_TMP</span>=<span style="color: #007800;">$1</span>
                                <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$DELAY_TMP</span>&quot;</span> <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;$1&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> abort <span style="color: #ff0000;">&quot;Delay needs to be a number in minutes&quot;</span>
                                <span style="color: #007800;">DELAY</span>=<span style="color: #007800;">$DELAY_TMP</span>
                                <span style="color: #000000; font-weight: bold;">;;</span>
                        -t<span style="color: #7a0874; font-weight: bold;">&#41;</span>     <span style="color: #7a0874; font-weight: bold;">shift</span>
                                <span style="color: #7a0874; font-weight: bold;">declare</span> <span style="color: #660033;">-i</span> THROTTLE_TMP
                                <span style="color: #007800;">THROTTLE_TMP</span>=<span style="color: #007800;">$1</span>
                                <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$THROTTLE_TMP</span>&quot;</span> <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;$1&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> abort <span style="color: #ff0000;">&quot;Throttle needs to be a number&quot;</span>
                                <span style="color: #007800;">THROTTLE</span>=<span style="color: #007800;">$THROTTLE_TMP</span>
                                <span style="color: #000000; font-weight: bold;">;;</span>
                        -c<span style="color: #7a0874; font-weight: bold;">&#41;</span>     <span style="color: #7a0874; font-weight: bold;">shift</span>
                                <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-f</span> <span style="color: #ff0000;">&quot;$1&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">||</span> abort <span style="color: #ff0000;">&quot;Cannot find specified conf file&quot;</span>
                                <span style="color: #007800;">CONF</span>=<span style="color: #ff0000;">&quot;$1&quot;</span>
                                <span style="color: #000000; font-weight: bold;">;;</span>
                        -l<span style="color: #7a0874; font-weight: bold;">&#41;</span>     <span style="color: #007800;">LOG</span>=<span style="color: #000000;">1</span>
                                <span style="color: #000000; font-weight: bold;">;;</span>
                        -h<span style="color: #7a0874; font-weight: bold;">&#41;</span>     <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Usage: $0 -m [alert|throttle_limit|throttle_unlimit|check_lag|check_size] (-c CONF_FILE) [tgt_filer:volume tgt_filer:/vol/vol/qtree]&quot;</span>
                                <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Alert if SnapMirror is still running: $0 -m alert [-a no] (-r yes) [tgt_filer:volume tgt_filer:/vol/vol/qtree]&quot;</span>
                                <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Alert and throttle (react): $0 -m alert [-a no] -r yes -t [throttle_in_kb] [tgt_filer:volume tgt_filer:/vol/vol/qtree]&quot;</span>
                                <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Throttle a running SnapMirror: $0 -m throttle_limit -t throttle_in_kb [tgt_filer:volume tgt_filer:/vol/vol/qtree]&quot;</span>
                                <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Unlimit SnapMirror throttle: $0 -m throttle_unlimit [tgt_filer:volume tgt_filer:/vol/vol/qtree]&quot;</span>
                                <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;To check lag: $0 -m check_lag -d delay_in_minutes (-a no) [tgt_filer:volume tgt_filer:/vol/vol/qtree]&quot;</span>
                                <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;To check delta: $0 -m check_size [tgt_filer:volume tgt_filer:/vol/vol/qtree]&quot;</span>
                                <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">0</span>
                                <span style="color: #000000; font-weight: bold;">;;</span>
                        <span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>      <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-z</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$MODE</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> abort <span style="color: #ff0000;">&quot;$0 mode required&quot;</span>
                                <span style="color: #007800;">TGTS</span>=<span style="color: #ff0000;">&quot;$*&quot;</span>
                                <span style="color: #000000; font-weight: bold;">;;</span>
                <span style="color: #000000; font-weight: bold;">esac</span>
                <span style="color: #7a0874; font-weight: bold;">shift</span>
        <span style="color: #000000; font-weight: bold;">done</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
notify <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
        <span style="color: #666666; font-style: italic;"># Send an e-mail notification</span>
        <span style="color: #666666; font-style: italic;"># Arguments: $@ - the subject</span>
        <span style="color: #666666; font-style: italic;"># Contents are empty</span>
        <span style="color: #666666; font-style: italic;"># And yes - one e-mail per event</span>
        mail <span style="color: #660033;">-s</span> <span style="color: #ff0000;">&quot;$@&quot;</span> <span style="color: #007800;">$EMAIL</span> <span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
idle <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
        <span style="color: #666666; font-style: italic;"># Check if transaction is idle</span>
        <span style="color: #666666; font-style: italic;"># Arguments: Target name (example: storage:/vol/volname/qtree</span>
&nbsp;
        <span style="color: #666666; font-style: italic;"># Get the storage name out</span>
        <span style="color: #007800;">NETAPP</span>=<span style="color: #800000;">${1%%:*}</span>
        test_connection <span style="color: #007800;">$NETAPP</span> <span style="color: #666666; font-style: italic;">#Verify this netapp is accessible</span>
        <span style="color: #c20cb9; font-weight: bold;">ssh</span> <span style="color: #007800;">$NETAPP</span> snapmirror status <span style="color: #007800;">$1</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">tail</span> <span style="color: #660033;">-1</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> Idle$ <span style="color: #000000; font-weight: bold;">&amp;&gt;/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null <span style="color: #666666; font-style: italic;">#Checks if the snapmirror is idle. If so, return true</span>
        <span style="color: #7a0874; font-weight: bold;">return</span> <span style="color: #007800;">$?</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
set_throttle <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
        <span style="color: #666666; font-style: italic;"># Sets throttle for target</span>
        <span style="color: #666666; font-style: italic;"># Arguments: $1 Target name (example: storage:/vol/volname/qtree)</span>
        <span style="color: #666666; font-style: italic;"># Arguments: $2 throttle value (number)</span>
&nbsp;
        <span style="color: #666666; font-style: italic;"># Get the storage name out</span>
        <span style="color: #007800;">NETAPP</span>=<span style="color: #800000;">${1%%:*}</span>
        test_connection <span style="color: #007800;">$NETAPP</span> <span style="color: #666666; font-style: italic;">#Verify this netapp is accessible</span>
        <span style="color: #c20cb9; font-weight: bold;">ssh</span> <span style="color: #007800;">$NETAPP</span> snapmirror throttle <span style="color: #007800;">$2</span> <span style="color: #007800;">$1</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
get_lag <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
        <span style="color: #666666; font-style: italic;"># Gets the lag of snapmirror relationship in minutes</span>
        <span style="color: #666666; font-style: italic;"># Arguments: Target name (example: storage:/vol/volname/qtree)</span>
&nbsp;
        <span style="color: #666666; font-style: italic;"># Get the storage name out</span>
        <span style="color: #007800;">NETAPP</span>=<span style="color: #800000;">${1%%:*}</span>
        test_connection <span style="color: #007800;">$NETAPP</span> <span style="color: #666666; font-style: italic;">#Verify this netapp is accessible</span>
        <span style="color: #007800;">LAG</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">ssh</span> <span style="color: #007800;">$NETAPP</span> snapmirror status <span style="color: #007800;">$1</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">tail</span> <span style="color: #660033;">-1</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $4}'</span><span style="color: #000000; font-weight: bold;">`</span>
        <span style="color: #666666; font-style: italic;"># LAG is in hh:mm:ss. We need to transfer it to minutes only</span>
        <span style="color: #007800;">H</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$LAG</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cut</span> <span style="color: #660033;">-f</span> <span style="color: #000000;">1</span> <span style="color: #660033;">-d</span> :<span style="color: #000000; font-weight: bold;">`</span>
        <span style="color: #007800;">M</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$LAG</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cut</span> <span style="color: #660033;">-f</span> <span style="color: #000000;">2</span> <span style="color: #660033;">-d</span> :<span style="color: #000000; font-weight: bold;">`</span>
        <span style="color: #7a0874; font-weight: bold;">let</span> <span style="color: #007800;">M</span>=<span style="color: #007800;">$M</span>+<span style="color: #007800;">$H</span><span style="color: #000000; font-weight: bold;">*</span><span style="color: #000000;">60</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$M</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
check_size <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
        <span style="color: #666666; font-style: italic;"># Checks the size of the snapshot to copy (diff)</span>
        <span style="color: #666666; font-style: italic;"># Arguments: Target name (example: storage:/vol/volname/qtree)</span>
&nbsp;
        <span style="color: #666666; font-style: italic;"># Get the storage name out</span>
        <span style="color: #007800;">NETAPP</span>=<span style="color: #800000;">${1%%:*}</span>
        test_connection <span style="color: #007800;">$NETAPP</span> <span style="color: #666666; font-style: italic;">#Verify this netapp is accessible</span>
        <span style="color: #666666; font-style: italic;"># Get source storage name and path</span>
        <span style="color: #007800;">SRC</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">ssh</span> <span style="color: #007800;">$NETAPP</span> snapmirror status <span style="color: #007800;">$1</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">tail</span> <span style="color: #660033;">-1</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $1}'</span><span style="color: #000000; font-weight: bold;">`</span>
        <span style="color: #666666; font-style: italic;"># Get the source filer and vol name from that</span>
        <span style="color: #007800;">NETAPP</span>=<span style="color: #800000;">${SRC%%:*}</span>
        <span style="color: #007800;">SPATH</span>=<span style="color: #800000;">${SRC##*:}</span>
        <span style="color: #007800;">SPATH</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$SPATH</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sed</span> s<span style="color: #000000; font-weight: bold;">/</span><span style="color: #ff0000;">'\/vol\/'</span><span style="color: #000000; font-weight: bold;">//`</span>
        <span style="color: #007800;">SPATH</span>=<span style="color: #800000;">${SPATH%%/*}</span>
&nbsp;
        test_connection <span style="color: #007800;">$NETAPP</span> <span style="color: #666666; font-style: italic;"># Verify the target NetApp is accessible</span>
        <span style="color: #007800;">SNAP</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">ssh</span> <span style="color: #007800;">$NETAPP</span> snap list <span style="color: #660033;">-n</span> <span style="color: #007800;">$SPATH</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> snapmirror <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">tail</span> <span style="color: #660033;">-1</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $4}'</span><span style="color: #000000; font-weight: bold;">`</span>
        <span style="color: #007800;">DELTA</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">ssh</span> <span style="color: #007800;">$NETAPP</span> snap delta <span style="color: #007800;">$SPATH</span> <span style="color: #007800;">$SNAP</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">tail</span> <span style="color: #660033;">-2</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">head</span> <span style="color: #660033;">-1</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $5}'</span><span style="color: #000000; font-weight: bold;">`</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Snap delta for $1 is <span style="color: #007800;">$DELTA</span> KB&quot;</span>  
        <span style="color: #007800;">LOG_TARGET</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$1</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">tr</span> <span style="color: #000000; font-weight: bold;">/</span> _<span style="color: #000000; font-weight: bold;">`</span>.txt
        <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$LOG</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;<span style="color: #780078;">`date`</span> <span style="color: #007800;">$DELTA</span>&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$LOG_PREFIX</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$LOG_TARGET</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;">### MAIN ###</span>
get_arguments $<span style="color: #000000; font-weight: bold;">@</span>
. <span style="color: #007800;">$CONF</span> <span style="color: #000000; font-weight: bold;">&amp;&gt;/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null
<span style="color: #666666; font-style: italic;"># if e-mail is not set, don't try to send</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-z</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$EMAIL</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #007800;">NOMAIL</span>=<span style="color: #000000;">1</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-z</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$TGTS</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> abort <span style="color: #ff0000;">&quot;You need at least one snapmirror target&quot;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">case</span> <span style="color: #007800;">$MODE</span> <span style="color: #000000; font-weight: bold;">in</span>
        alert<span style="color: #7a0874; font-weight: bold;">&#41;</span>  <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$REACT</span>&quot;</span> == <span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>
                <span style="color: #000000; font-weight: bold;">then</span>
                        <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-z</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$THROTTLE</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> abort <span style="color: #ff0000;">&quot;When setting 'react' flag, you must specify throttle&quot;</span>
                <span style="color: #000000; font-weight: bold;">fi</span>
                <span style="color: #000000; font-weight: bold;">for</span> i <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #007800;">$TGTS</span>
                <span style="color: #000000; font-weight: bold;">do</span>
                        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #000000; font-weight: bold;">!</span> idle <span style="color: #007800;">$i</span>
                        <span style="color: #000000; font-weight: bold;">then</span>
                                <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$i</span> is not idle. &quot;</span>
                                <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$NOMAIL</span>&quot;</span> <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> notify <span style="color: #ff0000;">&quot;<span style="color: #007800;">$i</span> is not idle&quot;</span>
                                <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$REACT</span>&quot;</span> == <span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>
                                <span style="color: #000000; font-weight: bold;">then</span>
                                        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;We are set to react. Limiting throttle&quot;</span>
                                        set_throttle <span style="color: #007800;">$i</span> <span style="color: #007800;">$THROTTLE</span>
                                <span style="color: #000000; font-weight: bold;">fi</span>
                                <span style="color: #7a0874; font-weight: bold;">echo</span>
                        <span style="color: #000000; font-weight: bold;">fi</span>
                <span style="color: #000000; font-weight: bold;">done</span>
                <span style="color: #000000; font-weight: bold;">;;</span>
        throttle_limit<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-z</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$THROTTLE</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> abort <span style="color: #ff0000;">&quot;Throttle requires throttle value&quot;</span>
                        <span style="color: #000000; font-weight: bold;">for</span> i <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #007800;">$TGTS</span>
                        <span style="color: #000000; font-weight: bold;">do</span>
                                <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Setting throttle for <span style="color: #007800;">$i</span> to <span style="color: #007800;">$THROTTLE</span>&quot;</span>
                                set_throttle <span style="color: #007800;">$i</span> <span style="color: #007800;">$THROTTLE</span>
                        <span style="color: #000000; font-weight: bold;">done</span>
                        <span style="color: #000000; font-weight: bold;">;;</span>
        throttle_unlimit<span style="color: #7a0874; font-weight: bold;">&#41;</span>       <span style="color: #000000; font-weight: bold;">for</span> i <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #007800;">$TGTS</span>
                                <span style="color: #000000; font-weight: bold;">do</span>
                                        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Setting throttle for <span style="color: #007800;">$i</span> to unlimited&quot;</span>
                                        set_throttle <span style="color: #007800;">$i</span> <span style="color: #000000;">0</span>
                                <span style="color: #000000; font-weight: bold;">done</span>
                        <span style="color: #000000; font-weight: bold;">;;</span>
        check_lag<span style="color: #7a0874; font-weight: bold;">&#41;</span>      <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-z</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$DELAY</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #007800;">DELAY</span>=<span style="color: #000000;">1440</span>
                        <span style="color: #000000; font-weight: bold;">for</span> i <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #007800;">$TGTS</span>
                        <span style="color: #000000; font-weight: bold;">do</span>
                                <span style="color: #007800;">LAG</span>=<span style="color: #000000; font-weight: bold;">`</span>get_lag <span style="color: #007800;">$i</span><span style="color: #000000; font-weight: bold;">`</span>
                                <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$LAG</span>&quot;</span> <span style="color: #660033;">-gt</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$DELAY</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>
                                <span style="color: #000000; font-weight: bold;">then</span>
                                        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Failure: The delay for <span style="color: #007800;">$i</span> is <span style="color: #007800;">$LAG</span> minutes&quot;</span>
                                        <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$NOMAIL</span>&quot;</span> <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> notify <span style="color: #ff0000;">&quot;<span style="color: #007800;">$i</span> is lagged <span style="color: #007800;">$LAG</span> minutes, above the threshold <span style="color: #007800;">$DELAY</span>&quot;</span>
                                <span style="color: #000000; font-weight: bold;">else</span>
                                        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Normal: The delay for <span style="color: #007800;">$i</span> is <span style="color: #007800;">$LAG</span> minutes&quot;</span>
                                <span style="color: #000000; font-weight: bold;">fi</span>
                        <span style="color: #000000; font-weight: bold;">done</span>
                        <span style="color: #000000; font-weight: bold;">;;</span>
        check_size<span style="color: #7a0874; font-weight: bold;">&#41;</span>     <span style="color: #000000; font-weight: bold;">for</span> i <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #007800;">$TGTS</span>
                        <span style="color: #000000; font-weight: bold;">do</span>
                                check_size <span style="color: #007800;">$i</span>
                        <span style="color: #000000; font-weight: bold;">done</span>
                        <span style="color: #000000; font-weight: bold;">;;</span>
        <span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>      <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Option <span style="color: #007800;">$MODE</span> is not implemented yet&quot;</span>
                <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">0</span>
                <span style="color: #000000; font-weight: bold;">;;</span>
<span style="color: #000000; font-weight: bold;">esac</span></pre></td></tr></table></div>



<p>Related posts:<ol><li><a href='http://run.tournament.org.il/citrix-xenserver-5-0-cannot-cooperate-with-netapp-snapmirror/' rel='bookmark' title='Permanent Link: Citrix XenServer 5.0 cannot cooperate with NetApp SnapMirror'>Citrix XenServer 5.0 cannot cooperate with NetApp SnapMirror</a> <small>It has been a long while, I know. I was...</small></li>
</ol></p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://run.tournament.org.il/netapp-snapmirror-monitor-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rapid-guide &#8211; Updating RedHat initrd</title>
		<link>http://run.tournament.org.il/rapid-guide-updating-redhat-initrd/</link>
		<comments>http://run.tournament.org.il/rapid-guide-updating-redhat-initrd/#comments</comments>
		<pubDate>Sat, 05 Dec 2009 21:46:09 +0000</pubDate>
		<dc:creator>ez-aton</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[boot loader]]></category>
		<category><![CDATA[initrd]]></category>
		<category><![CDATA[storage drivers]]></category>

		<guid isPermaLink="false">http://run.tournament.org.il/?p=497</guid>
		<description><![CDATA[Warning: This is not the recommended method if you&#8217;re not sure you know what you&#8217;re doing. Linux Initial Ram Disk (initrd) is a mechanism to perform disk-independent actions before attempting to mount the &#8216;/&#8217; disk. These actions usually include loading disk drivers, setting up LVM or software RAID, etc. The reason these actions are performed within initrd [...]


Related posts:<ol><li><a href='http://run.tournament.org.il/quick-and-dirty-modifying-boel-initrd-files-manually/' rel='bookmark' title='Permanent Link: Quick and dirty &#8211; modifying Boel initrd files manually'>Quick and dirty &#8211; modifying Boel initrd files manually</a> <small>Boel initrd files are actually compressed cramfs files. This is...</small></li>
</ol>

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Warning: This is not the recommended method if you&#8217;re not sure you know what you&#8217;re doing.</p>
<p>Linux Initial Ram Disk (initrd) is a mechanism to perform disk-independent actions before attempting to mount the &#8216;/&#8217; disk. These actions usually include loading disk drivers, setting up LVM or software RAID, etc.</p>
<p>The reason these actions are performed within initrd is that it is all based on Ram Disk loaded by the boot loader, and thus it breaks the loop of &#8220;how would I load storage drivers without storage access?&#8221;</p>
<p>It happens that due to some special even we need to modify it manually. To do so we need first to open it, and then to close it back in, replacing (backup the old one, will you?) the previous one.</p>
<p>This is rather simple. The tools used by us will be &#8216;gzip&#8217; and &#8216;cpio&#8217;.</p>
<p>Lets begin.</p>
<p>First &#8211; create a temporary directory:</p>
<blockquote><p>mkdir /tmp/initrd</p></blockquote>
<p><span style="text-decoration: underline;">Extracting</span></p>
<p>We have our temporary directory, so now, we need to extract the initrd into it. I assume the name of the file is /boot/initrd.img. You should replace my line with whatever the name of your initrd file:</p>
<blockquote><p>cd /tmp/initrd</p>
<p>cat /boot/initrd.img | gzip -dc |  cpio -id</p></blockquote>
<p>This will extract the contents of the initrd into /tmp/initrd.</p>
<p>Now you can edit its contents directly.</p>
<p><span style="text-decoration: underline;">Package</span></p>
<p>To package initrd back in, we will need to perform the following actions.</p>
<p>Warning &#8211; before you do it, make sure you have an available copy of your original initrd file, in case you have created some damage.</p>
<blockquote><p>cd /tmp/initrd</p>
<p>find . | cpio -o -H newc | gzip -9 &gt; /boot/initrd.img</p></blockquote>
<p>This line packages the initrd, and replaces the old one.</p>
<p>That&#8217;s all for today <img src='http://run.tournament.org.il/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>


<p>Related posts:<ol><li><a href='http://run.tournament.org.il/quick-and-dirty-modifying-boel-initrd-files-manually/' rel='bookmark' title='Permanent Link: Quick and dirty &#8211; modifying Boel initrd files manually'>Quick and dirty &#8211; modifying Boel initrd files manually</a> <small>Boel initrd files are actually compressed cramfs files. This is...</small></li>
</ol></p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://run.tournament.org.il/rapid-guide-updating-redhat-initrd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quickly install Xen Community Linux VM</title>
		<link>http://run.tournament.org.il/quickly-install-xen-community-linux-vm/</link>
		<comments>http://run.tournament.org.il/quickly-install-xen-community-linux-vm/#comments</comments>
		<pubDate>Sat, 05 Dec 2009 21:35:01 +0000</pubDate>
		<dc:creator>ez-aton</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Virtualization]]></category>
		<category><![CDATA[provisioning]]></category>
		<category><![CDATA[Xen]]></category>

		<guid isPermaLink="false">http://run.tournament.org.il/?p=494</guid>
		<description><![CDATA[On RHEL-type of systems, with virt-manager (libvirt), you can make use of virt-manager to easy your life. I, for myself, prefer to work with &#8216;xm&#8216; tools, but for the initial install, virt-manager is the quickest and most simple available tool. To install a new Linux VM, all you need to follow this flow Create an [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>On RHEL-type of systems, with virt-manager (libvirt), you can make use of virt-manager to easy your life. I, for myself, prefer to work with &#8216;<em>xm</em>&#8216; tools, but for the initial install, virt-manager is the quickest and most simple available tool.</p>
<p>To install a new Linux VM, all you need to follow this flow</p>
<p>Create an LV for your VM (I use LVs because it&#8217;s easier to manage). If not LV, use a file. To create an LV, run the following command</p>
<blockquote><p>lvcreate -L 10G -n new_vm1 VolGroup00</p></blockquote>
<p>I assume that the name you wish to grant is &#8216;new_vm1&#8242; (better maintain order there, else you will find yourself with hundreds of small LVs you have no idea what to do with), and that the name of the volume group is &#8216;VolGroup00&#8242;. Change to different values to match your environment.</p>
<p>Next, make sure you have your ISO contents unpacked (you can use loop device) and exported via NFS (my favorite method).</p>
<p>To mount a CD/DVD ISO, you should use &#8216;mount&#8217; command with the &#8216;loop&#8217; options. This would look like this:</p>
<blockquote><p>mount -o loop my_iso.iso /mnt/temp</p></blockquote>
<p>Again, I assume the name of the ISO is my_iso.iso and that the target directory /mnt/temp is available.</p>
<p>Now, export your newly created directory. If you have NFS already running, you can either add to /etc/exports the newly mounted directory /mnt/temp and restart the &#8216;nfs&#8217; service, or you could use &#8216;exportfs&#8217; to add it:</p>
<p>exportfs -o no_root_squash *:/mnt/temp</p>
<p>would probably do the trick. I added &#8216;no_root_squash&#8217; to make sure no permission/access problems present themselves during the installation phase. Test your export to verify it&#8217;s working.</p>
<p>Now you could begin your installation. Run the following command:</p>
<blockquote><p>virt-install -n new_vm1 -r 512 -p -f /dev/VolGroup00/new_vm1 &#8211;nographics nfs://nfs_server:/mnt/temp</p></blockquote>
<p>The name follows the &#8216;-n&#8217; flag. The amount of RAM to give is 512MB. The -p means it&#8217;s paravirtualized. The -f shows which device will be the block device, and the last argument is the source of the installation. Do not use local files, as the VM installer should be able to access the installation source.</p>
<p>Following that, you should have a very nice TUI installation experience.</p>
<p>Now &#8211; let&#8217;s make this machine &#8216;xm&#8217; compatible.</p>
<p>Currently, the VM is virt-manager compatible. It means you need virt-manager to start/stop it correctly. Since I prefer &#8216;xm&#8217; commands, I will show you how to convert this machine to VM.</p>
<p>First &#8211; export its XML file:</p>
<blockquote><p>virsh dumpxml new_vm1 &gt; /tmp/new_vm1.xml</p>
<p>virsh domxml-to-native xen-xm /tmp/new_vm1.xml &gt; /etc/xen/new_vm1</p></blockquote>
<p>This should do the trick.</p>
<p>Now you can turn the newly created VM off, and remove the VM from virt-manager using</p>
<blockquote><p>virsh undefine new_vm1</p></blockquote>
<p>and you&#8217;re back to &#8216;xm&#8217;-only interface.</p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://run.tournament.org.il/quickly-install-xen-community-linux-vm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iSCSI persistent configurations agains us all</title>
		<link>http://run.tournament.org.il/iscsi-persistent-configurations-agains-us-all/</link>
		<comments>http://run.tournament.org.il/iscsi-persistent-configurations-agains-us-all/#comments</comments>
		<pubDate>Thu, 19 Nov 2009 08:47:49 +0000</pubDate>
		<dc:creator>ez-aton</dc:creator>
				<category><![CDATA[Disk Storage]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[iSCSI]]></category>
		<category><![CDATA[multipath]]></category>

		<guid isPermaLink="false">http://run.tournament.org.il/?p=492</guid>
		<description><![CDATA[Using iSCSI with dm-multipath is rather common setup. With iSCSI running over Ethernet cables, which are too easy to disconnect (either on purpose or by mistake), being cheap and common technology &#8211; multipath becomes a must. If you have multiple network links, this is only expected that you use multipath for your iSCSI configuration. It&#8217;s [...]


Related posts:<ol><li><a href='http://run.tournament.org.il/persistent-raw-devices-for-oracle-rac-with-iscsi/' rel='bookmark' title='Permanent Link: Persistent raw devices for Oracle RAC with iSCSI'>Persistent raw devices for Oracle RAC with iSCSI</a> <small>Using udev to set persistent raw devices for iscsi in...</small></li>
<li><a href='http://run.tournament.org.il/iscsi-targetclient-for-linux-in-5-whole-minutes/' rel='bookmark' title='Permanent Link: iSCSI target/client for Linux in 5 whole minutes'>iSCSI target/client for Linux in 5 whole minutes</a> <small>I was playing a bit with iSCSI initiator (client) and...</small></li>
</ol>

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Using iSCSI with dm-multipath is rather common setup. With iSCSI running over Ethernet cables, which are too easy to disconnect (either on purpose or by <a href="http://run.tournament.org.il/correct-rack-wiring-tips-tricks-with-pictures/" target="_blank">mistake</a>), being cheap and common technology &#8211; multipath becomes a must. If you have multiple network links, this is only expected that you use multipath for your iSCSI configuration. It&#8217;s cheap, it&#8217;s easy and it works.</p>
<p>This, however, comes with a price tag. Not money &#8211; the components are cheap and common, but there are configuration acts which should take place.</p>
<p>It is easy to find info either in the open-iscsi documentations, the Internet, whatever, and I will go over them just below, but there are some catches which one should be aware of.</p>
<p>Per the common documentation, unlike regular iSCSI communication, when dealing with multipath, you would like iSCSI to fail rather quickly and let the SCSI layer handle the errors, thus letting dm-multipath handle the errors and do its work.</p>
<p>The configuration directives are rather simple. In the iscsid.conf file (on RHEL5 located in /etc/iscsi/iscsid.conf ), you need to change the value</p>
<blockquote>
<pre><a id="d0e2106">node.session.timeo.replacement_timeout =</a></pre>
</blockquote>
<p>To a very short period of time. By default, it is set to 120 seconds, which are two minutes before anyone will notify the SCSI subsystem of any disk IO errors. A good value would be 5 seconds, which should allow for very short network disconnection (which could happen) and still &#8211; let the dm-multipath manage errors fast enough so that applications would not fail on disk timeouts.</p>
<p>Another two parameters which should be defined are the following (read the comments above them in the config file):</p>
<blockquote>
<pre><a id="d0e2010">node.conn[0].timeo.noop_out_interval =
<pre>node.conn[0].timeo.noop_out_timeout =</pre>
<p></a></pre>
</blockquote>
<p>These values control the interval in which the iSCSI layer tests communication to the targets.</p>
<p>Also, in multipath.conf you will need to set the following feature, so that IOPs will not be lost:</p>
<blockquote>
<pre><a id="d0e1975">features		"1 queue_if_no_path"</a></pre>
</blockquote>
<p>These configuration directives can be found in these two pages from RedHat:</p>
<p><a href="http://www.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/html/Online_Storage_Reconfiguration_Guide/iscsi-modifying-link-loss-behavior-dmmultipath.html" target="_blank">iscsi-modifying-link-loss-behavior-dmmultipath</a></p>
<p><a href="http://www.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/html/Online_Storage_Reconfiguration_Guide/iscsi-replacements_timeout.html" target="_blank">iscsi-replacements_timeout</a></p>
<p>This is nice and pretty. However, if you have failed to do so at start, and defined your iSCSI targets based on the default configurations, you will notice that it still takes very long for iSCSI to notify the SCSI subsystem of the errors. You could check the values used by iSCSI through running the command:</p>
<blockquote><p>iscsiadm -m node -T &lt;target name&gt;</p></blockquote>
<p>Check out especially the line called <em>node.session.timeo.replacement_timeout</em>. Its value is the one which decides the actual behavior of iSCSI.</p>
<p>To change it, there are several methods. One of them is to clean up the iSCSI persistent configurations, located in /var/lib/iscsi and then re-login to the iSCSI targets. Only then you will have the new target configuration.</p>
<p>Check again with iscsiadm as described above, and check that this value matches.</p>


<p>Related posts:<ol><li><a href='http://run.tournament.org.il/persistent-raw-devices-for-oracle-rac-with-iscsi/' rel='bookmark' title='Permanent Link: Persistent raw devices for Oracle RAC with iSCSI'>Persistent raw devices for Oracle RAC with iSCSI</a> <small>Using udev to set persistent raw devices for iscsi in...</small></li>
<li><a href='http://run.tournament.org.il/iscsi-targetclient-for-linux-in-5-whole-minutes/' rel='bookmark' title='Permanent Link: iSCSI target/client for Linux in 5 whole minutes'>iSCSI target/client for Linux in 5 whole minutes</a> <small>I was playing a bit with iSCSI initiator (client) and...</small></li>
</ol></p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://run.tournament.org.il/iscsi-persistent-configurations-agains-us-all/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>XenServer &#8220;Internal error: Failure&#8230; no loader found&#8221;</title>
		<link>http://run.tournament.org.il/xenserver-internal-error-failure-no-loader-found/</link>
		<comments>http://run.tournament.org.il/xenserver-internal-error-failure-no-loader-found/#comments</comments>
		<pubDate>Sat, 24 Oct 2009 11:42:13 +0000</pubDate>
		<dc:creator>ez-aton</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Virtualization]]></category>
		<category><![CDATA[grub]]></category>
		<category><![CDATA[troubleshooting]]></category>
		<category><![CDATA[Xen]]></category>
		<category><![CDATA[XenServer]]></category>

		<guid isPermaLink="false">http://run.tournament.org.il/?p=489</guid>
		<description><![CDATA[It has been long since I had the time to write here. I have recently been involved more and more with XenServer virtualization, as you might see in the blogs, and following a solution to a rather common problem, I have decided to post it here. The problem: When attempting to boot a Linux VM [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>It has been long since I had the time to write here. I have recently been involved more and more with XenServer virtualization, as you might see in the blogs, and following a solution to a rather common problem, I have decided to post it here.</p>
<p>The problem: When attempting to boot a Linux VM on XenServer (5.0 and 5.5), you get the following error message:</p>
<blockquote><p>Error: Starting VM &#8216;Cacti&#8217; &#8211; Internal error: Failure(&#8220;Error from xenguesthelper: caught exception: Failure(\\\&#8221;Subprocess failure: Failure(\\\\\\\&#8221;xc_dom_linux_build: [2] xc_dom_find_loader: no loader found\\\\\\\\n\\\\\\\&#8221;)\\\&#8221;)&#8221;)</p></blockquote>
<p>This is very common with Linux VMs which were converted from physical (or other, non-PV virtualization) to XenServer.</p>
<p>This will probably either happen during the P2V process, or after a successful update to the Linux VM.</p>
<p>The cause is that the original kernel, non PV-aware one, has not been removed, and GRUB likes to load from it. XenServer will use the GRUB menu, but will not display it to us to select our desired kernel.</p>
<p>With no chance to intervene, XenServer will attempt to load a PV-enabled machine using non-PV kernel, and will fail.</p>
<p>Preventing the problem is quite simple &#8211; remove your non-PV kernel (non-xen) so that future updates will not attempt to update it as well and set it to be the default kernel. Very simple.</p>
<p>Solving the problem in less than two minutes is a bit more tricky. Let&#8217;s see how to solve it.</p>
<p>All operations are performed from within the control domain. This guide does not apply to StorageLink or NetApp/Equalogic devices, as they behave differently. This applies only to LVM-over-something, whatever it may be.</p>
<p>First, we will need to find the name of the VDI we are to work on. Use xe in the following manner, using the VM&#8217;s name:</p>
<blockquote><p>xe vbd-list vm-name-label=Cacti</p>
<p>uuid ( RO)             : 128f29dc-4a14-1a2d-75d1-8674d3d2403b<br />
vm-uuid ( RO): eae053de-4a20-28a5-f335-f5a18dd79993<br />
vm-name-label ( RO): Cacti<br />
vdi-uuid ( RO): <strong>90524af4-5b20-4412-9bfe-f1fe27f220b1</strong><br />
empty ( RO): false<br />
device ( RO): xvda</p>
<p>uuid ( RO)             : de177727-b28a-8b79-e73e-d08366d56277<br />
vm-uuid ( RO): eae053de-4a20-28a5-f335-f5a18dd79993<br />
vm-name-label ( RO): Cacti<br />
vdi-uuid ( RO): &lt;not in database&gt;<br />
empty ( RO): true<br />
device ( RO): xvdd</p></blockquote>
<p>It is very common that xvdd is used for CDROM, so we can safely ignore the second section. The first section is the more interesting one. There is a correlation between the name of the VDI and the name of the LVM on the disk. We can find this specific LV using the following command. Notice that the name of the VDI is used here as the argument for the &#8216;grep&#8217; command:</p>
<blockquote><p>lvs | grep <strong>90524af4-5b20-4412-9bfe-f1fe27f220b1 </strong></p>
<p>LV-90524af4-5b20-4412-9bfe-f1fe27f220b1 VG_XenStorage-4aa20fc2-fd92-20c2-c549-bed2597c622b -wi-a-  10.00G</p></blockquote>
<p>We now have our LV path! As you can see, its status is offline. We need to set it to online state. Using both the LV and the VG name, we can do it like that:</p>
<blockquote><p>lvchange -ay /dev/VG_XenStorage-4aa20fc2-fd92-20c2-c549-bed2597c622b/LV-90524af4-5b20-4412-9bfe-f1fe27f220b1</p></blockquote>
<p>Now we can access the volume. We can actually check that the problem is the one we look for, using pygrub:</p>
<blockquote><p>pygrub /dev/VG_XenStorage-4aa20fc2-fd92-20c2-c549-bed2597c622b/LV-90524af4-5b20-4412-9bfe-f1fe27f220b1</p></blockquote>
<p>We should now see the GRUB menu of the VM at question. If you don&#8217;t see any menu, either you have missed a step or used the wrong disk.</p>
<p>The menu should show you all the list of kernels. The default one is the one highlighted, and if it doesn&#8217;t include the word &#8220;xen&#8221; with it, most likely that we have found the problem.</p>
<p>We now need to change to a PV-capable kernel. We will need to access the &#8220;/boot&#8221; partition of the Linux VM, and change GRUB&#8217;s options there.</p>
<p>First we map the disk to a loop device, so we can access its partitions:</p>
<blockquote><p>losetup /dev/loop1 /dev/VG_XenStorage-4aa20fc2-fd92-20c2-c549-bed2597c622b/LV-90524af4-5b20-4412-9bfe-f1fe27f220b1</p></blockquote>
<p>Notice that you need to use the entire path to the LV, that the LV is online, and that loop1 is not in use. If it is, you will have a message saying something like &#8220;LOOP_SET_FD: Device or resource busy&#8221;</p>
<p>Now we need to access its partitions. We will map them using &#8216;kpartx&#8217; to /dev/mapper/ devices. Notice we&#8217;re using the same loop device name:</p>
<blockquote><p>kaprtx -a /dev/loop1</p></blockquote>
<p>Now, new files present themselves in /dev/mapper:</p>
<blockquote><p>ls -la /dev/mapper/<br />
total 0<br />
drwxr-xr-x  2 root root     220 Oct 24 12:39 .<br />
drwxr-xr-x 14 root root   16560 Oct 24 12:31 ..<br />
crw&#8212;&#8212;-  1 root root  10, 62 Sep 29 10:15 control<br />
brw-rw&#8212;-  1 root disk 252,  5 Oct 24 12:39 <strong>loop1p1</strong><br />
brw-rw&#8212;-  1 root disk 252,  6 Oct 24 12:39 <strong>loop1p2</strong><br />
brw-rw&#8212;-  1 root disk 252,  7 Oct 24 12:39 <strong>loop1p3</strong></p></blockquote>
<p>Usually, the first partition represents /boot, so we can now mount it and work on it:</p>
<blockquote><p>mount /dev/mapper/loop1p1 /mnt</p></blockquote>
<p>All we need to do is edit /mnt/grub/menu.lst to match our requirements, and then wrap everything back up:</p>
<blockquote><p>umount /mnt</p>
<p>kpartx -u /dev/loop1</p>
<p>losetup -d /dev/loop1</p></blockquote>
<p>We don&#8217;t have to change the LV to offline, because the XenServer will activate it if it&#8217;s not, however, we could do it, to be on the safe side:</p>
<blockquote><p>lvchange -an /dev/VG_XenStorage-4aa20fc2-fd92-20c2-c549-bed2597c622b/LV-90524af4-5b20-4412-9bfe-f1fe27f220b1</p></blockquote>
<p>Now we can activate the VM, and see it boot successfully.</p>
<p>This whole process takes several minutes the first time, and even less later.</p>
<p>I hope this helps.</p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://run.tournament.org.il/xenserver-internal-error-failure-no-loader-found/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
