VirtualBox -> KVM

I made the switch today to move from VirtualBox to KVM on my Fedora 13 workstation. At first I thought I would have to reinstall all of my guests, then I found this blog on how to convert VirtualBox guests to work in KVM: Convert Virtualbox vid to KVM qcow.

I left them as raw images (not sure if that’s good or bad, but it works) 🙂

First, convert your VirtualBox vdi files to raw format:

VBoxManage clonehd --format RAW fedora13.vdi fedora13.img

Notice I did NOT pass in the path to the vdi file. VBoxManage will magically know where to find it.

Then I moved the .img file to /var/lib/libvirt/images:

sudo mv .VirtualBox/HardDisks/fedora13.img /var/lib/libvirt/images/

Once I had the images copied, I started virt-manager to create my guests. Click the New button and follow along in the wizard.

First give your VM a name, and select Import existing disk image, press Forward.

Next, set the OS type and Version (not sure if this is required). Enter the path to the image or use the Browse button.

Find the image in the list, select it, press Choose Volume.

Now you have a storage configured, click Forward to finish creating your guest.

Set the desired Memory (RAM) and CPUs, followed by clicking Forward button.

Click Finish to add it to the list of guests.

Select the guest from the list, press Run button, and watch it start.

There you go a running KVM guest that started life as a VirtualBox guest.

Oops

I love using Google Chrome, but I find it funny how it’s not always the best browser when viewing Google sites. 🙂

Is all this really necessary?

Apparently maven clean is a lot more than rm -rf target/.

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Unnamed - foo:foo:jar:1.0.37
[INFO]    task-segment: [clean]
[INFO] ------------------------------------------------------------------------
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-compiler-plugin/2.3.2/maven-compiler-plugin-2.3.2.jar
       
Downloading: http://repo1.maven.org/maven2/org/apache/maven/maven-project/2.0/maven-project-2.0.pom
      
Downloading: http://www.ibiblio.org/maven2//org/apache/maven/maven-profile/2.0/maven-profile-2.0.pom
1K downloaded  (maven-profile-2.0.pom)
Downloading: http://www.ibiblio.org/maven2//org/apache/maven/maven-model/2.0/maven-model-2.0.pom
2K downloaded  (maven-model-2.0.pom)
Downloading: http://www.ibiblio.org/maven2//org/apache/maven/maven-artifact-manager/2.0/maven-artifact-manager-2.0.pom
1K downloaded  (maven-artifact-manager-2.0.pom)
Downloading: http://www.ibiblio.org/maven2//org/apache/maven/maven-repository-metadata/2.0/maven-repository-metadata-2.0.pom
1K downloaded  (maven-repository-metadata-2.0.pom)
Downloading: http://www.ibiblio.org/maven2//org/apache/maven/wagon/wagon-provider-api/1.0-alpha-5/wagon-provider-api-1.0-alpha-5.pom
4K downloaded  (wagon-provider-api-1.0-alpha-5.pom)
Downloading: http://repo1.maven.org/maven2/org/apache/maven/shared/file-management/1.2/file-management-1.2.pom
      
Downloading: http://repo1.maven.org/maven2/org/apache/maven/shared/maven-shared-components/8/maven-shared-components-8.pom
      
Downloading: http://www.ibiblio.org/maven2//org/apache/maven/shared/maven-shared-io/1.1/maven-shared-io-1.1.pom
3K downloaded  (maven-shared-io-1.1.pom)
Downloading: http://www.ibiblio.org/maven2//org/apache/maven/maven-artifact/2.0.2/maven-artifact-2.0.2.pom
765b downloaded  (maven-artifact-2.0.2.pom)
Downloading: http://www.ibiblio.org/maven2//org/apache/maven/maven/2.0.2/maven-2.0.2.pom
12K downloaded  (maven-2.0.2.pom)
Downloading: http://www.ibiblio.org/maven2//org/apache/maven/maven-artifact-manager/2.0.2/maven-artifact-manager-2.0.2.pom
1K downloaded  (maven-artifact-manager-2.0.2.pom)
Downloading: http://www.ibiblio.org/maven2//org/apache/maven/wagon/wagon-provider-api/1.0-alpha-6/wagon-provider-api-1.0-alpha-6.pom
588b downloaded  (wagon-provider-api-1.0-alpha-6.pom)
Downloading: http://www.ibiblio.org/maven2//org/apache/maven/wagon/wagon/1.0-alpha-6/wagon-1.0-alpha-6.pom
6K downloaded  (wagon-1.0-alpha-6.pom)
Downloading: http://www.ibiblio.org/maven2//org/codehaus/plexus/plexus-utils/1.4.6/plexus-utils-1.4.6.pom
2K downloaded  (plexus-utils-1.4.6.pom)
Downloading: http://www.ibiblio.org/maven2//org/codehaus/plexus/plexus-container-default/1.0-alpha-9/plexus-container-default-1.0-alpha-9.pom
1K downloaded  (plexus-container-default-1.0-alpha-9.pom)
Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.pom
     
Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.jar
Downloading: http://repo1.maven.org/maven2/org/apache/maven/shared/file-management/1.2/file-management-1.2.jar
        
       
Downloading: http://www.ibiblio.org/maven2//org/apache/maven/shared/maven-shared-io/1.1/maven-shared-io-1.1.jar
38K downloaded  (maven-shared-io-1.1.jar)
[INFO] [clean:clean {execution: default-clean}]
[INFO] Deleting directory /home/joedeveloper/dev/foo/target
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 15 seconds
[INFO] Finished at: Mon Oct 04 13:24:00 EDT 2010
[INFO] Final Memory: 8M/76M
[INFO] ------------------------------------------------------------------------

Cause for aneurysm

I think working with maven is going to give me an aneurysm. Say you want to compile your code for Java 1.6. Seems like a simple task. In most build systems it is actually trivial, except in maven.

In ant, you add two attributes to the javac tag.

<javac destdir="${target.dir}/classes"
           ...
           source="1.6"
           target="1.6"
           ...>

In buildr, it’s even simpler.

compile.options.target = '1.6'

But what about maven you ask? Yes you knew it was coming. It’s
completely obnoxious what you have to do.

  <build>
    ...
    <plugins>
      ...
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.6</source>
          <target>1.6</target>
        </configuration>
      </plugin>
    </plugins>
  </build>

pom.xml files are just painful. Maven I hate you.