lauantai 13. heinäkuuta 2013

Aborting export of VMs with Ovirt 3.1

I was going to upgrade Ovirt from 3.1 to 3.2, and in prepration, I started to export VMs. I thought that I had enough space on export -domain, but it seems that the thinly provisioned disks will use all the space they've been assigned. So I needed to abort exporting.

Exporting locks the images, so I was a little bit afraid that aborting export with good old 'kill' would leave them into that state. After finding, I decided to bit the bullet and just kill the processes. Ovirt actually worked very well, and all images became unlocked automatically. Hooray for proper error handling.

Try at your own risk, though.

tiistai 25. kesäkuuta 2013 in Gerrit 2.6, fixing " error: Incomplete arguments"

Trivial rebase detection had some changes when Gerrit 2.6.0 was released, and my previous patchsets-created hook didn't work anymore. In logs, there was

[2013-06-25 12:05:33,916] INFO : hook[patchset-created] output: error: Incomplete arguments

To fix this, I modified my patchset-created hook to following (original came from some discussion list, and I was extremely stupid and didn't write down where I got it :( ):


use strict;
use warnings;
use Getopt::Long;

my $gerritHome="/home/gerrit2";
my $gerritRoot=$gerritHome."/review_site";
my $hookDir=$gerritHome."/scripts";

my $change;
my $project;
my $commit;
my $patchset;
my $changeurl;
# Not really needed, but without these error_log will have entries like
# INFO : hook[patchset-created] output: Unknown option:
my $branch;
my $uploader;
my $isdraft;

my $result = GetOptions("change=s" => \$change,
"project=s" => \$project,
"branch=s" => \$branch,
"commit=s" => \$commit,
"patchset=s" => \$patchset,
"change-url=s" => \$changeurl,
"is-draft=s" => \$isdraft,
"uploader=s" => \$uploader);

"--project", $project,
"--commit", $commit,
"--patchset", $patchset,
"--change-url", $changeurl,
"--private-key-path", $gerritRoot."/etc/ssh_host_dsa_key");

To use this, must be in /home/gerrit2/scripts/ and it must be executable by gerrit2 user.

torstai 20. kesäkuuta 2013

Git subtrees and contributing upstream

I needed Puppetlabs Apache -module, so I added it into my vagrant training repository with following command

git-subtree add --squash --prefix=puppet/modules/apache master

As I started to use this module, I spotted a minor commenting error: one class parameter was removed, but it was still
used in comments. This seemed to be a good place to train to contrinute into upstream repository using github workflow.

First I cloned the puppetlabs/puppetlabs-apache in github, and then I tried to pull it as subtree

git subtree pull --prefix=puppet/modules/apache --squash

Didn't actually do anything, as puppetlabs/puppetlabs-apache.git and jyrkiput/puppetlabs-apache.git were both at same commit. So I'm not sure if this was actually needed.

I did just a minor fix, git add -u and git commit, then

git subtree push --prefix=puppet/modules/apache #21262

Some counting happened, and then the commit was transferred to github. Branch name #21262 is ticket number from Puppet Labs issue tracker.

Then I made a pull request to puppetlabs-apache, which got merged in few days. When I got a message telling me that the pull request had been merged, I wanted to see how I could pull changes back. So I tried

git-subtree pull --prefix=puppet/modules/apache master

But this caused a lot of conflict. But adding --squash removed those.

git-subtree pull --squash --prefix=puppet/modules/apache master

I'm don't know if usage of --squash was a mistake, or should I have gotten the whole history? Anyway, I managed to go contribute into upstream project using subtrees.

sunnuntai 16. kesäkuuta 2013

Converting Git submodules to subtrees

While learning to use Vagrant, I've been using git submodules. But git subtrees seems to be a lot better choice, so I wanted to start using them.

So, in my repository, which can be found from, I had following .gitmodules:
[submodule "puppet/modules/jenkins"]
path = puppet/modules/jenkins
url =
[submodule "puppet/modules/java"]
path = puppet/modules/java
url =
[submodule "puppet/modules/stdlib"]
path = puppet/modules/stdlib
url =
[submodule "puppet/modules/firewall"]
path = puppet/modules/firewall
url =
[submodule "puppet/modules/apt"]
path = puppet/modules/apt
url =
And with Git installed from with Homebrew (

Unregister all submodules with git submodule deinit
git submodule deinit .
This removes submodule configurations, so each module must be removed. So for each module
git rm puppet/modules/[modulename]
git rm puppet/modules/jenkins
Commit your changes
git commit -m "Removed submodules"
Add modules as subtrees, so for each module
git-subtree add --prefix=path/to/subtree --squash repository master
git-subtree add --prefix=puppet/modules/jenkins --squash master
git-subtree will make a commit when a subtree is added, so these are now in your repository

Finally remove .gitmodules for cleaning up things.

The man page of git subtree was really helpful when finding out what to do, and it contains a lot more information.