<?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>Miljan Karadzic &#187; Python</title>
	<atom:link href="http://www.miljan.org/main/category/python/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.miljan.org/main</link>
	<description>Wisdom is the key</description>
	<lastBuildDate>Tue, 25 Jan 2011 22:01:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>Solaris MPxIO: LUN distribution</title>
		<link>http://www.miljan.org/main/2011/01/25/solaris-mpxio-lun-distribution/</link>
		<comments>http://www.miljan.org/main/2011/01/25/solaris-mpxio-lun-distribution/#comments</comments>
		<pubDate>Tue, 25 Jan 2011 22:01:28 +0000</pubDate>
		<dc:creator>miljan</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[Storage]]></category>
		<category><![CDATA[UNIX]]></category>

		<guid isPermaLink="false">http://www.miljan.org/main/?p=326</guid>
		<description><![CDATA[Lately my work tasks are leading me to learn a lot about Solaris storage configuration. I have a &#8220;test&#8221; environment with 13 HP ProLiant servers, Solaris x86 and HP EVA8400 storage. EVA8400 is advertised as an active-active (AA) storage &#8211; a LUN can be accessed via both controllers. But if you look at the small [...]]]></description>
			<content:encoded><![CDATA[<p>Lately my work tasks are leading me to learn a lot about Solaris storage configuration. I have a &#8220;test&#8221; environment with 13 HP ProLiant servers, Solaris x86 and HP EVA8400 storage. </p>
<p>EVA8400 is advertised as an active-active (AA) storage &#8211; a LUN can be accessed via both controllers. But if you look at the small letters you will see that it is actually asymmetric AA storage (AAA), which is a cheaper class of AA storages. While all LUNs can still be accessed via both controllers, LUNs still have owning controller. If I/O request comes to a non-owning controller it will be transfered to the owner and only then performed. This of course has impact on the performance. To avoid this EVA monitors the requests, and if more than 60% of requests are coming through non-owning controller ownership is changed.</p>
<p>Preferred method of access for AAA storages is using asymmetric logical unit access (ALUA) &#8211; method that enables target (storage system) to set different access characteristics to different paths based on the owning controller (this is known as target port group support (TPGS)). For example, if Controller_A owns LUN_1, all paths for LUN_1 to Controller_A will be marked as Active/Optimized, while all paths to Controller_B will be marked as Active/NonOptimized. </p>
<p>Knowing all this, it is only obvious that ideal setup for AAA storages is when one half of LUNs is owned by one controller and the other half by second controller. This enables us to balance the load on both controllers and get the maximum performance out of the storage.</p>
<p>Now, on the client side some systems have Veritas suite installed, but there are a couple of servers that are using Solaris native MPxIO as a multipathing solution. By specification MPxIO is ALUA aware plus it comes with a nice feature to balance the traffic across all Active paths. EVA8400 controllers have 4 x 4Gbps fibre channel ports each, while my servers have 2 x 8Gbps HBAs. Spreading the traffic across all 4 target ports would help me get needed performance.</p>
<p>Everything sounds perfect in theory, but I&#8217;m having problems to make this work in practice. For some reason MPxIO does all the I/O over Controller A and, since with MPxIO path priority can  not be set manually, after a while all LUNs are moved to this controller leaving second controller idle. Since TPGS specification is vendor specific there seems to be some incompatibility between HP and Sun implementation. Or maybe there are some hidden undocumented options that have to be set &#8211; so far I had no luck in finding these. :-/</p>
<p>During the tests and in order to see how the LUNs were spread I wrote a script that counts Active paths per target port. Maybe someone else will find it useful. Download can be found <a href="http://www.miljan.org/download/get_san_paths.py">here</a>. And here is how it looks in action:</p>
<p class="code"><b>root@xdb1-ora:~# get_san_paths.py</b><br />
Initiator ports found:&nbsp;&nbsp;&nbsp;&nbsp;2<br />
Target ports found:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;8<br />
LUNs found:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;87<br />
&nbsp;<br />
Path \ LUNs:<br />
&nbsp;&nbsp;50001fe150229f78: 77 LUNs<br />
&nbsp;&nbsp;50001fe150229f79: 77 LUNs<br />
&nbsp;&nbsp;50001fe150229f7c: 10 LUNs<br />
&nbsp;&nbsp;50001fe150229f7d: 10 LUNs<br />
&nbsp;&nbsp;50001fe150229f7a: 77 LUNs<br />
&nbsp;&nbsp;50001fe150229f7b: 77 LUNs<br />
&nbsp;&nbsp;50001fe150229f7e: 10 LUNs<br />
&nbsp;&nbsp;50001fe150229f7f: 10 LUNs</p>
]]></content:encoded>
			<wfw:commentRss>http://www.miljan.org/main/2011/01/25/solaris-mpxio-lun-distribution/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SVC lsmigrate</title>
		<link>http://www.miljan.org/main/2010/10/06/svc-lsmigrate/</link>
		<comments>http://www.miljan.org/main/2010/10/06/svc-lsmigrate/#comments</comments>
		<pubDate>Wed, 06 Oct 2010 09:04:51 +0000</pubDate>
		<dc:creator>miljan</dc:creator>
				<category><![CDATA[IBM]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Storage]]></category>
		<category><![CDATA[UNIX]]></category>

		<guid isPermaLink="false">http://www.miljan.org/main/?p=238</guid>
		<description><![CDATA[A year or so ago, I got annoyed by the ugly and unreadable output of IBM SVC lsmigrate command so I sat down and wrote a short script that will provide much nicer and more informational output. Output includes information about the VDisk that is being migrated (name, ID and size), destination MDisk group and [...]]]></description>
			<content:encoded><![CDATA[<p>A year or so ago, I got annoyed by the ugly and unreadable output of IBM SVC lsmigrate command so I sat down and wrote a short script that will provide much nicer and more informational output. Output includes information about the VDisk that is being migrated (name, ID and size), destination MDisk group and migration information (number of threads and progress). If started in verbose mode, information about the source MDisk group is printed as well.</p>
<p>Non-verbose mode:</p>
<p class="code">$ ./svc_lsmigrate.py -H svccluster<br />
#&nbsp;(ID&nbsp;&nbsp;)&nbsp;Vdisk&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Size&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(ID&nbsp;)&nbsp;Mdisk Group&nbsp;&nbsp;&nbsp; Threads Progress<br />
======================================================================<br />
1&nbsp;(67&nbsp;&nbsp;)&nbsp;esx_srvf05_d&nbsp;&nbsp;1000.00GB&nbsp;(8&nbsp;&nbsp;)&nbsp;DS482_5r10_SK1&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;48 %<br />
2&nbsp;(157&nbsp;)&nbsp;esx_srvf06_g&nbsp;&nbsp;1000.00GB&nbsp;(5&nbsp;&nbsp;)&nbsp;DS483_8r5_2SK3&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;96 %<br />
3&nbsp;(118&nbsp;)&nbsp;esx_srvf01_h&nbsp;&nbsp;1022.00GB&nbsp;(1&nbsp;&nbsp;)&nbsp;DS482_8r5_SK3&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;63 %<br />
4&nbsp;(117&nbsp;)&nbsp;esx_srvf01_g&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1.00TB&nbsp;(1&nbsp;&nbsp;)&nbsp;DS482_8r5_SK3&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;63 %<br />
5&nbsp;(120&nbsp;)&nbsp;esx_srvf01_i&nbsp;&nbsp;1023.00GB&nbsp;(1&nbsp;&nbsp;)&nbsp;DS482_8r5_SK3&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;63 %<br />
6&nbsp;(39&nbsp;&nbsp;)&nbsp;tsm_disk4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;5.00GB&nbsp;(10 )&nbsp;DS484_9r5_1SK2&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;98 %<br />
7&nbsp;(19&nbsp;&nbsp;)&nbsp;oracode_tunis&nbsp;&nbsp;800.00GB&nbsp;(5&nbsp;&nbsp;)&nbsp;DS483_8r5_2SK3&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;59&nbsp;%</p>
<p>If you find the script useful, you can download it <a href="http://www.miljan.org/download/svc_lsmigrate.py">here</a>.</p>
<p><strong>Note</strong>: in order for script to work, you need to have SVC connection parameters set in your SSH config file. Example could be:</p>
<p class="code">$ grep -p svccluster ~/.ssh/config<br />
Host svccluster<br />
&nbsp;&nbsp;Hostname 192.168.1.34<br />
&nbsp;&nbsp;User admin<br />
&nbsp;&nbsp;IdentityFile ~/.ssh/admin.key</p>
<p><strong>Note #2</strong>: Script was tested on SVC software levels 4.3 and 5.1.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.miljan.org/main/2010/10/06/svc-lsmigrate/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pidgin status v2</title>
		<link>http://www.miljan.org/main/2008/10/10/pidgin-status-v2/</link>
		<comments>http://www.miljan.org/main/2008/10/10/pidgin-status-v2/#comments</comments>
		<pubDate>Fri, 10 Oct 2008 19:34:58 +0000</pubDate>
		<dc:creator>miljan</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Pidgin]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.miljan.org/main/?p=64</guid>
		<description><![CDATA[As requested by bleketux, I made some modifications to pidgin_status.py script. Main news is that now it is possible to change Pidgin status message periodically. Script will go to background (it is a real daemon now :P), change the status, and wait for the set time interval until it changes the message again, and then [...]]]></description>
			<content:encoded><![CDATA[<p>As requested by bleketux, I made some modifications to pidgin_status.py script.</p>
<p>Main news is that now it is possible to change Pidgin status message periodically. Script will go to background (it is a real daemon now :P), change the status, and wait for the set time interval until it changes the message again, and then all over again, wait-change-wait-change.</p>
<p>To change status message every 5 minutes with a random line from file /home/miljan/quotes/dusko_radovic.txt:</p>
<p class="code">pidgin_status.py -d -t 5 -f /home/miljan/quote/dusko_radovic.txt</p>
<p>And in Pidgin you would get something like this every five minutes:<br />
<a href="http://www.miljan.org/main/wp-content/uploads/2008/10/status.png"><img class="alignnone size-full wp-image-63" title="status" src="http://www.miljan.org/main/wp-content/uploads/2008/10/status.png" alt="" width="264" height="88" /></a></p>
<p>To show the song you are listening to as status message:</p>
<p class="code">pidgin_status.py -s &#8220;Mukeka di Rato &#8211; Kustapassaaessedrmobral&#8221;</p>
<p>And in Pidgin it would look like:</p>
<p><a href="http://www.miljan.org/main/wp-content/uploads/2008/10/status1.png"><img class="alignnone size-full wp-image-65" title="status1" src="http://www.miljan.org/main/wp-content/uploads/2008/10/status1.png" alt="" width="267" height="90" /></a></p>
<p>You can see all possible options by running script with -h argument for help.</p>
<p>bleketux, I hope you are still around to enjoy this. ;)</p>
<p class="download"> Download: <a href="/download/pidgin_status_v2.py">pidgin_status_v2.py</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.miljan.org/main/2008/10/10/pidgin-status-v2/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Setting Pidgin Status with Python or How to Waste Perfectly Good Saturday</title>
		<link>http://www.miljan.org/main/2008/03/09/setting-pidgin-status-with-python-or-how-to-waste-perfectly-good-saturday/</link>
		<comments>http://www.miljan.org/main/2008/03/09/setting-pidgin-status-with-python-or-how-to-waste-perfectly-good-saturday/#comments</comments>
		<pubDate>Sat, 08 Mar 2008 23:53:24 +0000</pubDate>
		<dc:creator>miljan</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Pidgin]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.miljan.org/main/2008/03/09/setting-pidgin-status-with-python-or-how-to-waste-perfectly-good-saturday/</guid>
		<description><![CDATA[I was very bored today. Tired from working on Ratuus (don&#8217;t go there, site is under heavy construction :)) I needed something to help me take my mind off everything. And what better way to do it, than playing with Python, Pidgin and D-BUS. :D To cut the long story short, I needed something that [...]]]></description>
			<content:encoded><![CDATA[<p>I was very bored today. Tired from working on <a href="http://www.ratuus.org/">Ratuus</a> (don&#8217;t go there, site is under heavy construction :)) I needed something to help me take my mind off everything. And what better way to do it, than playing with Python, Pidgin and D-BUS. :D</p>
<p>To cut the long story short, I needed something that will update my Pidgin status message with the information about the current song I am listening. Till recently I was using Rhythmbox player and there is a perfect little Pidgin plugin called Current Track that worked with this player. Last week I discovered <a href="http://squentin.free.fr/gmusicbrowser/gmusicbrowser.html">gmusicbrowser</a> and fell in love immediately. It is fast, rich with functionalities but still simple to use. Exactly what I want from audio player. (Hm, I just noticed it is written in PERL. Now when Python is used for everything this comes as a big surprise.)</p>
<p>gmusicbrowser already has a plugin called NowPlaying. It will trigger some command whenever song is changed. I just needed to write this command that will inform Pidgin about the change. So, this seemed like a perfect exercise for slow Saturday. :)</p>
<p>Quick search on Pidgin and D-BUS showed extensive documentation about <a href="http://developer.pidgin.im/wiki/DbusHowto">Pidgin API accessible through D-BUS</a>. There is even a working example of how to change the status message! :)</p>
<p>But that was too simple, so I got another idea. Some time ago, I wrote a small daemon in C that will bind to a specific port and display random bofh-excuses fortune messages when someone would telnet to it. (Seems like I have a lot of spare time. I should really find some hobby!) Something similar to telnet bofh.jeffballard.us 666 (<a href="http://pages.cs.wisc.edu/~ballard/bofh/">here</a> for more information). So I was thinking about implementing the same for my Pidgin status. Random BOFH excuses in your status message! How <del>cool</del> geeky is that!</p>
<p>The result of all that is short (~60 lines of code) Python script that will set your Pidgin status message to:</p>
<p>a) you current song</p>
<p class="code">pidgin_status.py -m The Real McKenzies &#8211; Outta Scotch</p>
<p>b) random line from a file</p>
<p class="code">pidgin_status.py -f /usr/local/share/bofh-example</p>
<p>c) anything you give as the command line argument</p>
<p class="code">pidgin_status.py Some very interesting and funny status message</p>
<p>Only difference between a) and c) is the type of the icon that will be shown. In example a) there will be a small musical note, while in example b) and c) nice arrow pointing to right side will be show.</p>
<p>In the middle of testing I noticed this strange message:</p>
<p><img src="http://www.miljan.org/gallery/blog/bofh-rofl.png" /></p>
<p>Being from Serbia myself, I find this extremely funny. Although, I didn&#8217;t know Serbian hackers are so notorious! :)</p>
<p>I hope someone will find it useful. In any case, I am accepting donations for some long and adventurous vacation. As you can see, I really need it! :D</p>
<p class="download"><a href="http://www.miljan.org/download/pidgin_status.py">pidgin_status.py</a><br />
<a href="http://www.miljan.org/download/bofh-excuses">bofh-excuses</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.miljan.org/main/2008/03/09/setting-pidgin-status-with-python-or-how-to-waste-perfectly-good-saturday/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
	</channel>
</rss>

