Xen, amd64 and a lot of fun

Date Tags xen

Yesterday we basically reinstalled the main host for the cduce and mancoosi projects. The Problem was that the machine (a power edge 2950) was installed with a 32 bits system while the Xeon processors are 64 bits. To cut the story short we decided to re-install the system.

First we installed a generic 64 bits kernel. Debian ships this kernel in the i386 repository, so it was as simple as apt-get install. After we reboot the machine, we had to add a new lvm partition for the new 64 installation and debootstrap a new system in it.

The new system worked straightaway, so we did a bit of data shuffling and we end up with a working 64 bits system.

Now the hard part. We run 4 guest os on this machine. These guest Oses were all 32 bits system and we find out the hard way that is not possible to run a 32 bit Os on a 64 bit system without using a new Xen (3.3) and the HVM emulation layer.

After a few desperate experiments we decided to re-install the guest Oses as 64 bits system. After xen-create all these images and a bit more of lvm shuffling and renaming, we were ready to re-configure our machines.

Using the old dpkg —get-selections trick we were able pretty quickly to re-install the needed software. Of course I had to fight a bit with apt-get to manually solve a few dependencies problems.

Now the big mistake. I thought that the vserver image had to be installed on each guest machine. This is wrong ! Installing the vserver image is not necessary and actually this move gave me quite an headache as it pulled in also udev.

Never, ever install udev on a xen emulated os ! Well, after a bit of googling, I got the right brain wave, I di-installed udev and all machines booted just fine.

Ldap: the problem is that is the to copy an ldap database, is necessary to dump the db in a text file and the upload it again in a new fresh db. Needless to say I forgot to back the ldap db. So to save the day, I installed ldap on my (32 bits) machine, dump the db and then with a old good ldif file in my hand I was able to re start ldap without loosing anything.

Mysql was a bit the same problem. It seems that the InnoDB tables don’t like to be moved around. In order to get mysql running again I had to dump the bd, remove everything and upload the data back again. This was less painful, but still a bit time consuming.

the last hurdle was about uids. Re-installing the system I didn’t realized that numeric ids are not fixed, but given sequentially (well, of course I knew it ! just didn’t think about this problem …) so the uids on the old images were different from the uids on the new images. It took only a few minutes and a find script to fix the problem.

Now everything seems up and running. We see 8Gb of memory as we should and we apart for other minor quirks that I’m sure will come up soon, I’m quite happy about the move. I said it was a 30 mins job, it took 8 hs, but still pretty good time !


migration in progress

Date

We almost finished to move our servers from ens to pps. In the next few days we should have the mailing lists back online. The host web-cduce.pps.jussieu.fr is now dead.

http://www.cduce.org/cgi-bin/viewcvs.cgi/

svn co svn+ssh://brome.pps.jussieu.fr/svn/

anon checkout: svn co https://svn.cduce.org

https://plomb.pps.jussieu.fr/gosa/password.php


cdata section in cduce

Date Tags cduce

I wrote a small patch to manipulate cdata section in cduce as follow:

abate@zed.fr:~/Projects/cduce-ocaml-3.10$ledit ./cduce
        CDuce version 0.5.0

# cdata_of ;;
- : String -> String = <fun>

#  type a = <tag>Cdata ;;
Characters 6-7:
Capture variable not allowed: Cdata

# type a = <tag>String ;;
# let b : a = <tag>(cdata_of "ggg>>" );;
val b : a = <tag> 'ggg>>'
# print_xml b ;;
- : Latin1 = "<tag><![CDATA[ggg>>]]></tag>"

# let [ c ] = map [ b ] with c -> c ;;
val c : a = <tag> ggg>>
# print_xml c;;
- : Latin1 = "<tag><![CDATA[ggg>>]]></tag>"

the code in in the svn repository: http://cduce.org/cgi-bin/viewcvs.cgi/cduce/trunk/?root=svn


darcs repo fixed

Date

I’ve fixed my darcs repo: http://web-cduce.pps.jussieu.fr/cgi-bin/darcsweb.cgi

Now I’ve the old one (broken) that I’ll remove soon, a working one based on cduce 0.4.2 where I keep my patches and a repo of cduce 0.5.0 without my patches, that I’ll hopefully merge soon.

I’ll keep working with cduce 0.4.2 for the moment as cduce 0.5.0 requires the ocaml 3.10 that is still in experimental in debian.


using xslproc to output not well formed xml

Date Tags hacking

After few attempt with cduce, in the end I resorted to xslt to convert the cduce manual to a more drupal-friendly format.

Drupal uses the geshi filter to do syntax highlighting. The problem with this filter is that it does not understand CDATA sections and its input is not well-formed xml.

The cduce manual is written in a well-formed xml and uses CDATA sections for cduce code. For example:

<sample><![CDATA[
let f (x : Int) : Int = g x
let g (x : Int) : Int  = x + 1
]]></sample>

My problem was to remove the cdata declaration and output something of the form:

<blockcode>
let f (x : Int) : Int = g x
let g (x : Int) : Int  = x + 1
</blockcode>

After a bit of document reading and research this was my solution:

    <xsl:template name="normalize">
        <xsl:param name="input"/>
        <xsl:param name="mode">normal</xsl:param>
        <xsl:choose>
            <xsl:when test="$mode = 'escape'">
                <xsl:value-of disable-output-escaping="yes" select="$input"/>
            </xsl:when>
            <xsl:otherwise>
                <xsl:value-of select="$input"/>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>

This template is effectively a function that is invoked with two parameters input and mode.

Input contains the text to be printed, while the mode is a boolean to decide whether to encode the input or not. Using <xsl:copy-of ... or xsl:text... with disable-output-escaping does not give the same result.

I’m not sure if this is a bug/feature or xsltproc or something written in the xslt standard.

The function to invoke the above function is as follows:

    <xsl:template match="sample">
        <blockcode lang="ocaml">
            <xsl:call-template name="normalize">
                <xsl:with-param name="input">
                    <xsl:value-of select="."/>
                </xsl:with-param>
                <xsl:with-param name="mode">escape</xsl:with-param>
            </xsl:call-template>
        </blockcode>
    </xsl:template>