A little over a year ago, I was planning a datacentre move for
Anchor. This was overall a very challenging experience, because our
target was to move 8 racks of equipment in one night, from the
outskirts of the city into the middle of the CBD. Making sure that
went as smoothly as possible meant writing new tools to assist the
planning work.
So, a little over a year ago, I hacked up some python code that
rendered some nice vector graphics of our planned rack layout; a
graphviz-like file format let me place our
switches, rackmounts, shelves, and minitowers in racks, and then I’d
generate a bunch of EPS files, and do this many many times to make
sure all the equipment was going to fit. This also made collaborating
with my bosses very easy, because we could draw on printouts, take the
sheets down to the DC and make notes about positions of network ports,
serial cables, and so on.
This code got called fengshui
, because it involved a lot of
pseudoscience to get the balance and harmony of the new DC to maximise
chi flow :)
After the move, the diagrams stagnated; I hacked a bit on the code and
broke it, and since then the diagrams have been left unused, too hard
to update with changes on the racks, and so what was once a useful
reference for provisioning space turned to rot.
This last week I started playing with the code again, and now with
less pressure to deliver, have chucked out the old EPS and SVG
generation code and replaced it with cairo
as the rendering engine, and made the input file format less suckful,
chucking out the parser, perhaps 50% of the total LOC, replacing
it with an XML format. (Yes, if I’ve made it less suckful with XML,
imagine how awful it must have been before!)
The cairo renderer is totally awesome: in the space of about 5 minutes
I refactored the generator interface to allow me to pass in a cairo
context, and then patched in the widget from the pycairo clock
example,
and I have a GTK viewer for rack diagrams. I’m still trying to find
parts of my jaw that have since snapped off when it dropped to the
floor.
Anyway, check it out, if you’re
a sysadmin or netops guy, it may come in useful. Patches always
welcome :)