Converting VMware image to QEMU

After a short power blackout last week (which luckily do not happen often here), my server at home did not want to start up anymore. After some detailed investigations I found a hardware error on one of the local hard drives. Taking both the necessicty of changing the disk and the age of the OS installation (it still had been a the current vmware-any-any-patches properly on the current FC12’s kernel. I was about to give up, but then I remembered that there were two other virtual machine solutions available: QEMU and XEN.

XEN

First having tried to port to XEN, I soon had to realise that this is not possible. As of recent Fedora Cores, there is currently no support for the so-called dom0 part of XEN which means that the current host kernels do not have the necessary adjustments in place for allowing XEN clients (irrespectively of the guests OS) to run. You would need special kernel versions which are flagged as testing. Although I am no coward and I would not consider this system to be “in a productive environment”, I still did not want to install that one. So I decided to give QEMU a try.

QEMU

There, I immediately crashed into a very popular problem apparently: My guest OS, which I was not able to boot any more (because my very oldish VMware installation was already gone), had been installed with a SCSI drive (lsilogic) as the master disk where the guest OS had been installed. QEMU, however, normally only supports integration of IDE disks for booting the operating system. Fortunately, I learned how to deal with this from a blog post at geekyfacts.com which is for xen machines. Nevertheless, the first two sections are still valid for a conversion from VMWare to QEMU. Seeing the trick with Microsoft’s KB article and the neccesity of adjusting the registry, I was forced to install a VMware version (on some other host) temporarily. During the installation I read the blog post of Ian about to exchange the HAL possibility. Out of this I feared that I would also have to do this, because my previous installation (of the host OS) was not ACPI-enabled. His article, unfortunately, is somewhat vague under which conditions an exchange of the HAL is necessary or not. After having made the adjustments, I was lucky to see that I did not have to exchange the HAL in my case.

Trouble with Network in Bridging Mode

However, still the system did not boot up yet. The system was able to find its boot device again, but during startup the system was hanging at “Computer is starting”. It took me several hours to determine that this is related to the fact that not just the boot device had changed but also the virtual network adapter. As the ActiveDirectory of a Windows Server OS is using the MAC address for certain operations (to have a unique value) the exchange of the network adapter which also was not connected to a physical LAN (yet) caused that the network adapter was not receiving any IP address via DHCP (that is the default on any new network adapter). Booting in the guest OS in Safe Mode I was able to set an IP address manually. This made the system boot up again, but still I wanted a plain bridge mode. A NAT approach does not make sense to me, because the (virtual) server shall be available to the entire local network without restriction. At that time I was using Redhat’s virt-manager. As of today the latest version available with the FC12 distribution is revision 0.8.2. There I was not able to figure out how to set the virtual machine’s network adapter into bridge mode: When configurating a network adapter I always only got the option of “Virtual network ‘default’: NAT” which is exactly the way that I don’t want to have it (I read a blog article about version 0.8.3 which should enhance the UI there). I therefore returned back to the command line and checked for the TUN/TAP approach. There is a magnificant blog post by Alan Tan on the topic of QEMU TAP bridge configuration which I liked very much. However, there is one point in there which I considered too complex: the TAP device is being created during boot up. With recent QEMU versions there is the opportunity to specify a qemu-tap-up and a qemu-tap-down script for example like this:

qemu -net nic -net tap,name=tap0,script=/srv/qemu-tap-up,downscript=/srv/qemu-tap-down

These scripts are being called on startup and on shutdown of the virtual machine to do necessary adjustments for the TAP devices. My idea here simply is to let my local network card always run in bridge mode (i.e. I configure a bridge br0 with one single physical device eth0 assigning the IP address to the br0 device) and assigning and deassign the newly created tap device to that bridge via the scripts above. The fact that qemu passes the name of the currently used TAP device to the up- and down script as first argument comes in handy as well. Therefore my qemu-tap-up script reads as follows:

#!/bin/bash

ifconfig $1 up
brctl addif br0 $1

whereas qemu-tap-down is as simple as that:

#!/bin/bash

brctl delif br0 $1
ifconfig $1 down

And here is the abbreviated version of my /etc/sysconfig/network-scripts/ifcfg-eth0 file:

DEVICE=eth0
HWADDR=00:xx:yy:zz:aa:bb
ONBOOT=yes
BOOTPROTO=none
TYPE=Ethernet
IPV6INIT=no
USERCTL=no
NM_CONTROLLED=no
PREFIX=25
NAME="System eth0"
BRIDGE=br0

I added a new /etc/sysconfig/network-scripts/ifcfg-br0 file which now contains the DHCP part of my local network:

DEVICE=br0
TYPE=Bridge
BOOTPROTO=none
ONBOOT=yes
DELAY=0
IPV6INIT=no
USERCTL=no
IPADDR=xx.yy.zz.aa
NETMASK=255.255.255.0
NM_CONTROLLED=no

Et voilà: The beast is running fine!
Thanks to all the blog posts which saved me many many hours!

Mismatch_cnt is not Zero

After having repotted a Fedora Core 12 installation I was challenged with the apparently quite well-known warning message

/etc/cron.weekly/99-raid-check:

WARNING: mismatch_cnt is not 0 on /dev/md0

which came from Anacron into my inbox (The subject line starts with Anacron job ‘cron.weekly’). I remembered that I solved this problem on that Fedora server before, Continue reading ‘Mismatch_cnt is not Zero’ »

Structured Source Code as the Truth

Working on my recent projects I once again cursed about the flat structure of my source code file. In modern source code editors it is quite common to be able to “fold” block of coding to enhance readability and overview, but nobody seemed to have cared about comments here: In almost all cases, source code editors just allow to collapse the comment block itself. Thinking about this I came up to the point that source code is not that “flat” as the plain text file might suggest. The same way as you collapse a block in the source code editor, you often do it when browsing through the content of an XML file. That brought me to the idea of structuring source code with the help of XML. Continue reading ‘Structured Source Code as the Truth’ »

Repotting Fedora Core 12 on Software RAID

Last weekend I had to change the size of the root partition of a Fedora Core 12 system. Reason for it was a) the size of the partition where the root file system is located is too large and b) the remaining free space shall be used in another partition (for a different purpose). Due to the circumstances it was not an option to use the disk space within the same partition. Continue reading ‘Repotting Fedora Core 12 on Software RAID’ »

Testing Hotswapping on Java with Apache Felix’ OSGi Tutorial

About half a year ago I stumbled over the problem that Java does not allow certain types of changes on compiled coding on the fly (for good reason BTW). It is even not possible when using the debugger interface (see also JDPA for more details on this). On the other hand, however, I know from the ABAP/4 world that generating coding might be a very good idea sometimes, because in most cases it impacts performance less compared to writing generic coding (for example by using introspection or reflection). In this situation you often want to automize the generation thus immediately having to struggle with the problem that you need to reload changed compiled codes “on the fly” (during the runtime of the virtual machine) for example to correct errors or to deploy a new version. Since that time I was searching for some alternative which could work around many restrictions Java currently poses here. Looking around with Google I found that already some people before me had thought about this problem. I stumbled – for example – over the following papers:

Finally, I read in a forum that the OSGi standard (besides some other things) would provide such a feature. Reading a bit more at their website I figured out that this is not just about hotswapping Java Byte Code, but an entire approach of implementing a certain component model coming from the embedded device world. I was quite eager getting to know more about it and planned to conduct a more thorough practical look at an implementation of the standard some time.

First Steps with Felix

Within the last weeks I found this opportunity and had a closer look at Apache Felix, one of the major implementations of the OSGi standard. Continue reading ‘Testing Hotswapping on Java with Apache Felix’ OSGi Tutorial’ »

Using Subversion+Apache Webserver as Backup Storage

For more than two years I am furious about what standard backup programs deliver today. Yes, they provide you safety by making copies of your data reoccuringly ensuring that you can copy it back upon necessity. But when you have a closer look at what they really do especially in the sense of versioning it suddently turns into a surprise. I stumbled over that when I investigated the following scenario more thoroughly:

Scenario

For several years now I administer a local network with some workstations and two servers. For historical reasons one of the server is a Linux box (LinS) which is mainly responsible for doing the internet-related routing and similar stuff whilst the Windows Server (WinS) acts as simple file share server for the core application. Safety of the data is considered key in this situation – especially concerning the Windows Server (loosing the internet access for a day or two is also not eligible, but survivable). Still both servers feature a RAID1 system. Previously, backup of data for the Windows Server was done via DVD+RW with a simple commercial backup software. As the RAID1 array in the WinS already ensured that ongoing failures did not cause an unrevokable data loss, still “pushing the DEL button” on the keyboard could cause an entire data loss (this is also the reason why “only backing up your data on a RAID array” is never a good idea alone). Consequently, the major task in this situation for this commercial software was to provide differential backups such that – if required – it would be possible to restore a previous state (to be also immune against data that was garbled some days before).

Continue reading ‘Using Subversion+Apache Webserver as Backup Storage’ »

Preview: Apache Felix Tutorial Additions

The last few days I am playing around with Apache Felix, an implementation of the OSGi standard after having stumbled over the problem that it is not so trivial to exchange Java coding while the Java Virtual Machine still is running. At their documentation’s page the implementors of Felix have a very nice tutorial which I had a walk-through the last few days. On addition to this I did some enhanced tests with it which I would like to report on in the next couple of posts.
Stay tuned!