In Deriva

A blog left alone

Adding new paths to an existing SR that is configured for Device Mapper Multipath (DMP) is as simple as it gets. First you need to scan the bus, the simplest way is to write a string “- - -” (3 dashes) on the scan node of your controller/HBA. A quick and dirty script to scan all controller BUSes for new IO Paths or new Luns:

for controller in `ls -1 /sys/class/scsi_host/`;
do
    echo "- - -" > $controller/scan
done

After this is done executing, you can see your new paths by running ‘fdisk -l’ or in /proc/scsi/scsi. The next step is to inform the multipath new paths or LUNs have been added:

/opt/xensource/sm/mpathutil.py add [SCSIId]

Needless to say, aside from the last step, this is also valid for Linux 2.6 kernels.

E-MU 0404 USB in Linux

For sometime that I’ve been listening to music on Linux with hiss and artifacts. Today I found in this thread in the Ubuntu forums, the much obvious solution to my problem and I can now listen to music as retentive as a stereofile that I am!

The solution is to force the libasound to “re-sample” at 41Khz instead of the soundcard’s default of 48Khz. Without further ado, here’s the solution:

pcm.!default {
type rate
slave {
pcm “plughw:0,0″
rate 44100
}
}

Slap those lines in your /etc/asound.conf or ~/.asoundrc (not sure about the latter, though). Now playing Porcupine Tree to celebrate having good sound again! The only thing left for me to figure out, is why the flash plugin on a Debian Lenny x86-64 crashes when playing SWFs with audio, after this one is figured out, I’ll have no excuses to switch back and forth between OSes.

Update: After “fixing” the sample rate the flash based movies containing audio frames no longer crash my browser.

  • 0 Comments
  • Filed under: General, Tech
  • London

    Since my stay in Cambridge last year for work purposes that my will to visit London has since increased and finally I had the chance to take a break from work and enjoy 4 days in the company of my flatmate Priscila and, of course, Ricardo and Ania, who kindly allowed us to do some couch surfing in their great new flat in Canary Wharf.    Typically I enjoy spending my holiday time sitting on my ass, however, I was in a new country and in a new city with a lot of story and cultural places to visit and explore.    First thing that I felt was that it was no different than Dublin in terms of population. I didn’t feel myself like a stranger in a strange land, but more like another local. The reason for this is mainly due to the fact that a great part of the people living in Dublin and in London are not locals. It’s easy to find someone speaking our native language in the streets. In terms of size, the city is far bigger than Dublin. I walked a lot during these days, but I also made extensive use of The Original Bus Tour tickets that we bought accidentally. Oh, and speaking about transports, I never heard myself complaining so much as when I had to make use of the underground in London. To begin with, given that I am 6″8 tall, I could not stand straight not even in the middle of it, to add the fact that I am slightly claustrophobic, all the trains were pretty much packed all the time and the smell in the underground corridors was something that would make a homeless feel happy about his own smell. But not everything was bad, we found a coffee shop called “Caffe & Vida” (iirc?) on the Regent Street selling Pasteis de Nata and guess from where they were imported from?  Pasteis de Belem (one of Portugal most renowned factories).

    Another thing I quite enjoyed was the Japanese Canteen (as Ricardo puts it) that we were brought to. I am not a fan of  Japanese food per se, in the sense of eating raw fish, but it was far from nausea-provoking. The Katsu-Don on this restaurant was incredible though, to the point of making me want to go there the next day.   We heard a lot about the Chicago Musical, the theater representation of the Movie and we decided to take a shot, albeit a quite expensive one, as the tickets were running as short as 75£, but we were lucky to find a discount sale as we bought tickets to other attractions which adjusted it’s end price to 37£ for the two us which, while still expensive was acceptable. The way to the show was the best part of the trip, I totally loved the Convent Garden. The jugglers there were some of the best. The scenery was very pleasant! All in all, the best part of trip. At the end of this, we also took a trip from  Victorian Bridge (? argh, been 2 weeks already!) down to The Fortress of London.

    Now back onto the unpleasant sides… Madame Tussauds was a major waste of time and money. I expected the wax models to be a slight bit conforming to reality, if not in the colors, at least in terms of sizing. Camden Town, the punk neighbourhood, was quite uninteresting too. Aside from a tshirt with a quote “Fsck Google, ask me!” and the Cyber Dog store. Other than that, nothing really amusing or eye catching.    To conclude, next time I visit London, I will not try to visit as much places as possible and will balance the sightseeing with the resting as much as I can :-)

  • 0 Comments
  • Filed under: General
  • mysql “truncate all” in Python

    While writing a script to process a XML file and load it into a database, I felt the need to truncate all tables in a database during each run cycle to validate whether the data was actually being processed appropriately. I looked around to see if there was already some work done (e.g a mysql function, stored procedure or even a python snippet) and was unable to find (must say I have not put enough effort into it) so I decided to write one myself. Here it goes to whoever may come across the same need as me.

    import MySQLdb
     
    def truncateAll(db):
        dbhandle = MySQLdb.connect(host="localhost", user="root", db)
        c = dbhandle.cursor()
        c.execute("select table_name from  \
          INFORMATION_SCHEMA.tables where table_schema = %s", db)
     
        truncatables = []
        for row in c.fetchall():
            truncatables.append(row[0])
     
        for table in truncatables:
            c.execute("truncate " + table)
  • 0 Comments
  • Filed under: python
  • The Bugalyze is coming :-)

    After spending the whole weekend writing the plugin system for bugalyze, I am pretty much confident that my initial ideas of automating bugball sanity checking via pluggable drop-in module/packages is going to be a reality and by the end of this week I should already have an internal release ready. Enough testing later and some optimism to go along with, a handful of plugins written too.

    On the less-than-amusing side, I have spent a shitload of time trying to track a few issues in python’s zipfile and going through PKWare’s ZIP Format specs and ended up resorting to external unzipping tools, which is only of concern on Windows platforms and that is not bothering me much as I am leaving portability to Windows in last on my ToDo list.

    After spending sometime tracking some weird bugs in my script related to the creation of directories to hold the files contained in the zip file archive, I decided to the check the contents of the ziplib.py. At first, my assumptions were that I could do something similar to:

    (Please, don’t complain if the snippet doesn’t work, I haven’t tested it, only for interpretation purposes)

    ...
    import zipfile
     
    zf = zipfile.ZipFile("file.zip")
    for archive in zf.namelist():
        if archive.endswith('/'):
            os.makedirs(archive)
    ...

    But apparently, this trivial script expects the zip file to contain a list of all folders for files listed in the ZIP’s Central Directory (table of contents in human lingo) but that is far fetched, given the ZIP file doesn’t seem to contain the notion of a folder in the first place so if by any chance you see a directory mentioned there, you may just give the lord a bless. Not even the extractAll from the zipfile in Python 2.6 does work to the expected extent with my testcases (Maybe I am being too picky here). I had a couple more interesting notes on the zipfile module to post, but I think they’ve slipped off of my mind. I will certainly remember them once I find sometime to start fixing the problems in it, so I can use it in the bugalyze.

    On a side note, I just noticed that there was a clear light coming thru my window which made me look at the clock to find it’s 5AM. Is it me, or Ireland dawns early than Portugal, eventhough the timezone is the same?

    Rough times…Good times!

    Me and Carla we decided to separate from each other, the decision was not easy for neither of us but that’s as hard as it gets.

    On the positive side, I had the fabulous visit from a long-time friend Ricardo and his lovely polska girlfriend, Ania. I must say that I had some fun that I haven’t had in a long time while here in Dublin with these two nice fellas!

    We have been through the normal and typical sightseeing of Dublin, although the climacteric  conditions weren’t the best, so we had to change our plans and stay closer to the city centre. We bought 3 day tickets for the Dublin Tourbus and followed through almost the entire circuit, being our first stop the Guiness Storehouse.

    I had been there before with my colleagues on a “Remote Desktop and Terminal Services” training/overview from Microsoft, so there wasn’t a lot of new things to look at. It was good to enjoy the panoramic view of the city once again, but not worth the money paid, IMO. The day was rather cool, we ended up getting some Mongolian food from the Mongolian BBQ - nothing fancy but a slightly different concept than that what you are most likely used to, from a self-service /  barbecue point of view. And if you consider you can spend a whole night eating as much food as you want for only 23€, I think you’ll surely not regret it.

    Last saturday we had some great time at Ruben and Joana’s place, too. Not to mention the food, Ruben got some fantastic cooking skills. The thing I really liked, was the Polish Vodka shots that we were forced to take after each x-box karaoke match! All in all, an excellent time spent with some fine guys and gals.

    Now that Ricardo and Anya gone to United Kingdom again, I feel slightly lonely, but as time passes by, some confidence and reassurance of where I want to be, helps me get through it all. Just the other day, I was reading about a book  written by a lady, whose name slipped my mind since I read the advert which focused on a real story about the writer who used a positive belief to overcome a tragic event and make her self a much better person. I think this is the kind of books I would enjoy at the moment reading, as I feel like I need to sparkle my life and find myself.

  • 1 Comment
  • Filed under: fallback
  • The Crisis of Credit Visualized.

    This is quite an interesting video which clearly explains the what’s, who’s and why’s of our global financial crisis, as explained by Jonathan Jarvis.

  • 0 Comments
  • Filed under: Economy, General
  • Citrix XenServer 5 Hotfix 2 is OUT.

    The hugely waited hotfix 2 for XenServer is finally out. You can download it from here. It’s a cumulative install, so there’s no problem if you don’t have hotfix 1 installed and if you’re meant to upgrade for some bug, consider going straight to the hotfix2. Happy Virtualization.

    OCAML..Here I go again!

    The last week was xentensive. As a negative result, my efforts to learn OCAML dropped considerably, mostly because I spent most of my time troubleshooting FC storage, HA and performance cases and haven’t been able to catch up with the ‘my precious‘ build environment.

    However, my goal of learning OCAML is still alive and some days ago I went out looking for information on OCAML and came across this book Pratical Ocaml after reading this interview with the author, in the, quite curious, “On Ruby” blog. After I was done with the interview, I felt like This could be exactly what I’m in need of. So let’s recap: The guy used to be a System Administrator and he used to write most of his tools in OCAML instead of PERL or C, that can only mean something - either the language is far too good and easy or the author does not know what he’s talking of about”, were my thoughts. It was then that I decided to visit  this book on amazon and to my dismay, the book is fairly badly ratedly (C)’ly. To save up some time and frustration from reading all the comments, I decided to finally take a look into the ocaml tutorial and where I’ve learned the basics of the language so far. It’s definitely a very good tutorial which I whole-heartedly recommend to anyone starting.

    Here’s the simple Hello, World.

    open Printf
     
    let s = "World" ;;
     
    Printf.printf "Hello, %s\n" s
  • 0 Comments
  • Filed under: OCAML, XenServer
  • Week Rundown

    After 7 days without sucking any nicotine other than the one provided by the patches I’ve been wearing, I could say today was the best (or the less addictive) day. It’s my 7th day and it hasn’t been very easy, especially after lunch or dinner time, to be honest. It really kills me.

    However, just as I was sitting on the Courtesy Bus that leaves from Eastpoint Business Park to the DART station, a mature lady was coming in after smoking and the smell of her breath in the air annoyed me quite a bit in the sense of “This boldly sucks”. Oddly enough I’ve never really felt this smell before, except when waking up next to a duster, of course. Anyway, guess I still have a long way to go…but I will get there!

  • 0 Comments
  • Filed under: General, fallback