Posts Tagged ‘Python’

LLXC: My little python3-lxc based project

// September 29th, 2012 // 6 Comments » // Free Software

My foray into the world of LXC and RLXC

A few months ago, I started trying out LXC (Linux Containers). Before that I used to use OpenVZ, which is an older and more mature contextualization implementation. I was pleased with how well LXC worked and started replacing my personal OpenVZ hosts with LXC.

It worked great, but it had a few quirks. While LXC itself works well, the user scripts that ship with it has some space for improvement. The lxc-list command lists anything that’s a directory in /var/lib/lxc, so if you have a lost+found directory, it will list it as a container (This has since been fixed upstream). Also, in some cases it would list containers twice or not at all. I was a bit annoyed with that, since OpenVZ’s “vzlist” tool prints out a nice table of your containers along with their IP addresses and other information. Since it’s very trivial to implement what I want in a shell script, I went ahead and did just that and called it RLXC.

I also missed the “vzctl exec <containername> command” to execute commands in containers and “vzctl enter <containername>” to gain a shell inside the container, so I added some more functionality to it so that I could configure ssh keys for these containers and use “rlxc enter” and “rlxc exec” like I used to do with the OpenVZ tools, but by using SSH.

I also realised that there are others too who wanted similar improvements in the LXC scripts and decided to continue improving RLXC and making it public.

Enter LLXC

I spoke to Stéphane about my ideas at the time and he introduced me to python3-lxc that he introduced on his blog yesterday. It provides Python bindings for liblxc, so I took the advantage of that and mostly re-implemented RLXC in Python and called it LLXC. The name doesn’t particularly mean anything, I’m open to suggestions for what to call it, if anyone cares.

Here are some screenshots that explains some of it better than I could do in words:

How to get it

As Stéphane mentioned in the python3-lxc blog entry, the API hasn’t yet been finalized and llxc itself is in an early state and many changes are planned, so it’s definitely not meant for production use yet, but since we believe in “release early, release often” in the free software community, here goes…

Currently, llxc.py itself is *very* Ubuntu specific and its only been tested on Ubuntu 12.04, but that will be fixed once more of its kinks have been ironed out. Some people are also working on getting python3-lxc on other distributions, which will help a lot.

The llxc.py script itself is hosted on Github: https://github.com/highvoltage/llxc

For python3-lxc and friends, you need to enable Stéphane’s experimental PPA: https://launchpad.net/~stgraber/+archive/experimental

You will then need to install the following packages: lxc, python3-lxc, python3-crypto, lvm, btrfs-tools

To generate the ssh keys used for ssh interaction between the containers, you need to run “llxc gensshkeys”.  The “enter” and “exec” commands also rely on your containers being in dns or in your /etc/hosts file, at least for now, which you may have to configure manually.

The Future

There is a lot that I’m planning to add, mostly to scratch my own itches. These include:

  • Awareness of other hosts, so that the list command can show you all containers in the “awareness”. You’d also be able to clone, move, etc containers between hosts.
  • Easily modify container configuration
  • Hooks everywhere, and at least one hook for configuring a configuration management system such as salt, bcfg2, puppet or chef.
  • More checks and tips everywhere. Is the host running low on memory? Disk space? Perhaps list available resources on variable hosts and make some suggestions based on that.
  • There a not-very-descriptive ROADMAP file in the distribution, check that for more details.

I’ll have some packaging for this available soon and work on making more things work right out of the box, updates will follow. Also, feedback and patches are very welcome!

SociBook del.icio.us Digg Facebook Google Yahoo Buzz StumbleUpon

Edubuntu Live Welcome

// January 10th, 2011 // 2 Comments » // Education, Free Software

Simple Greeter for Live Systems

During the last development cycle we launched Edubuntu WebLive, which uses a Drupal module to create remote users on an application server and connect the user via NX. We thought of popping up a web page when the user logs in, explaining what it is that they have logged in to and how to get around.

We then moved to make it a bit more simpler with a Webkit/PythonGTK interface that displays the slides on login. It loads a bit faster than a full browser and there are less buttons and things that could potentially get in the way.

We need some nice slides

The messages we want to convey, as seen in the screenshots above are quite simple, but as you can see in these screenshots they are quite crude and definitely early work. I seem to be running low on creative juices on this and have asked for feedback on the edubuntu-devel mailing list but haven’t gotten much response yet, so I thought I’d post this to Planet Ubuntu and try to get some wider feedback. If you have some ideas or would like to propose some slides (it doesn’t have to be anything like mine), feel free to do so. Natty’s artwork hasn’t been finalised yet, which also makes it a bit harder, but it would be nice to get it right at least in concept for now. Feel free to comment here or through the usual Edubuntu contact points, or submit a patch!

SociBook del.icio.us Digg Facebook Google Yahoo Buzz StumbleUpon

Geekdinner Cape Town: Quarrelsome Quince

// November 27th, 2009 // No Comments » // Project Mayhem

Last night I attended the Quarrelsome Quince Geekdinner (wow it’s the end of November already!?). It was ok. The talks were good, Adrianna Pinska (aka confluence) did very well on the kareoke slideshow which was titled something like “The Winners of Safety at Work” which was a bunch of funny slides of people improvising at work mostly doing dangerous things. She did a great job since the slides were almost too easy since they were funny on their own, but she managed to be really quick on her feet and make up some really good stuff.

DSCN1633_web DSCN1634_web DSCN1638_web

The food at Cafe Max were great and Delheim sponsored the wine. Even though the food and wine was good, I go to the geekdinners more for the geek part than the dinner part. I spent some time catching up with Andy about everything from off-line Wikipedia, tuXlabs, Ubuntu-NGO, Quebec, Canada and the French. I also got some mini-photography lessons from Joe and played with his nice Canon camera (which is why I haven’t took too many shots) but I’m sure he’ll have them up soon. After the geekdinner was officially finished I sat with Jeremy, Simon, Adrianna and Michael a bit, we looked through Jeremy’s xkcd book which was quite cool, besides having all the strips from the xkcd site, it also has lots of cool little puzzles that all fit together. Not sure what happens when you solve them all, but I want one of those books too now! They also talked about some of the problems in their Pyweek game called Rinkhals and somehow listening to them talking about problems in Python is always interesting even when I don’t completely understand. I have a lot going on this weekend but I’ll try to get to the CTPUG meeting tomorrow, I’ve only been to two of the CTPUG meetings before but I’ve always wanted to get more involved.

Oops, drifting a bit off-topic there, the next Geekdinner is at the end of January and if you’re interested you can subscribe to the announce mailing list where the details will be announced. Thanks to all the people who organised it!

SociBook del.icio.us Digg Facebook Google Yahoo Buzz StumbleUpon

Political Tendencies

// September 28th, 2008 // 12 Comments » // Free Software, Jonathan, Politics, Project Mayhem

The Stereotype

Recently, Jordan Mantha blogged about being excited about Palin joining McCain‘s campaign. Some of the comments were quite harsh, some even suggesting that it’s wrong to support the Republicans, being a free software developer and affiated with the Ubuntu project. I will admit that I was quite surprised to see his support for the McCain myself- from the vast majority of posts I’ve seen on Planet Ubuntu, Planet Debian and Planet Gnome so far, most free software supporters seem to support Obama and the Democratic party. Being a supporter of free software (or Ubuntu) shouldn’t imply what kind of political tendencies you have. Statistics might show that most free software supporters might choose something, that doesn’t mean that everyone has to.

The Political Compass

In CLUG, many of the people in our IRC channel participated in the Political Compass test. It asks you a series of questions and then gives you co-ordinates on where you stand politically. Michael Gorven put together a Python script that takes the results from Spinach (our channel bot) and plots it on a graph using Gnuplot:

In the graph above, it’s clear that everyone in our LUG that participated landed in the Libertarian quadrants, and not a single person in the Authoritarian quadrants. Most people are in the Left-wing Libertarian quadrant, with quite a few in the Right-wing Libertarian quadrant. In this case, the graph supports the stereotype that free software supporters may be more inclined to be left-wing libertarians. There are other things that this graph doesn’t bring into account though. Everyone in our IRC channel are also South Africans. Could that perhaps have an effect on our choices and tendencies? We also discuss *everything* on our IRC channel, and we mostly read each other’s blogs. Could it also be that we shape each other’s political views, if only we sway it by the tiniest bit on a continuous basis?

I think it’s natural of humans to make assumptions about other people and the world around them. I think it’s wrong of people to take offence when these assumptions and generalisations do not fit into their little view of the world. While we’re not all unique little snowflakes, we are all different, and tolerance and acceptance goes a long, long way.

See also:

Other Cluggers who have blogged on the political compass:

SociBook del.icio.us Digg Facebook Google Yahoo Buzz StumbleUpon

Python Magazine

// October 7th, 2007 // 3 Comments » // Free Software

I just subscribed to Python magazine, who have just released their first issue. The first issue is available at no cost, and future issues will be available at different costs depending on how you’d like to read it.

I wasn’t sure whether it’s the right thing to do to buy a Python magazine, considering that there are so much good free material out there, but the quality of the first issue seems very good, and if it will improve my skills, then I think it’s certainly worth while.

SociBook del.icio.us Digg Facebook Google Yahoo Buzz StumbleUpon

Kusasa Analytical Education

// May 10th, 2007 // 1 Comment » // Education, Free Software, Gadgets

Previously, I mentioned the Shuttleworth Foundation‘s Classroom Coders project. It seems that it may soon be a reality under the Kusasa Analytical Education project. Kusasa is real innovation, it fundamentally changes some of the few 100 years old teaching methods we still use in classrooms.

Kusasa screenshot

It makes use of Mathland, Squeak and Python to achieve this. From the Kusasa site:

The idea is not that learners gain tools they use for the rest of their lives. That’s not realistic. We don’t use any specific theorems or other mathematics constructs from school today. Learners should use tools at school which help them develop a general ability to learn new tools. This general ability is the skill of analysis. It is the ability to break a complex problem into pieces, identify familiar patterns in the pieces, solve them using existing tools, and synthesize the results into a view or answer. We want to ensure that learners graduate with this ability, making them effective, successful, productive and fulfilled members of society.

Kusasa is a Zulu word that means “tomorrow”. Take a peak at the Kusasa website for more information. I think it could potentially be a good educational program to run with OLPC/Classmate type PC’s, and even more importantly, have a major influence on the way the future generations learn.

SociBook del.icio.us Digg Facebook Google Yahoo Buzz StumbleUpon

Python in Cape Town

// September 9th, 2006 // 4 Comments » // Free Software

Today I attended the first ever Cape Town Python Users Group Meeting (CTPUG). I didn’t attend the entire event, which is a pity because I missed a talk on Turbogears, which is possibly not all that bad since I decided to go with Django (time-wise I can’t really afford to change my mind :) )

The day looked very well planned. there were several talks and while a huge amount of it went over my head, it’s good to know that there’s now a very knowledgeable local Python community that I can tap into when I get stuck. There were a surprisingly large amount of people there. 95 people registered for the day, and it seems that it was an accurate account of the amount of people that were there.

Props to Jan Groenewald and Neil Blakey-Milner for setting this up! I hope the CT Python community gets nicely cemented, the same way that CLUG has .

CTPUG Meeting

SociBook del.icio.us Digg Facebook Google Yahoo Buzz StumbleUpon