Eudyptula Challenge

The Eudyptula Challenge is a series of programming exercises for the Linux kernel, that start from a very basic “Hello world” kernel module, moving on up in complexity to getting patches accepted into the main Linux kernel source tree.

More info in:

http://eudyptula-challenge.org/

This challenge consists in 20 tasks and I’ve recently got to task 09, let’s see how far I can make it.

How about you? Don’t miss the chance to learn more things about the Linux kernel!

Automatize OpenStack deployments with TryStack

Last few days I was trying TryStack and I’ve created a simple script in order to automatize my test deployments, feel free to use it.

First of all at least we need to install neutron and nova clients, for example, via pip:

pip install python-novaclient
pip install python-neutronclient

And then just run a script like this one:

#!/bin/bash
export OS_USERNAME=<id>
export OS_PASSWORD=<pwd>
export OS_TENANT_NAME=<tname>
export OS_AUTH_URL=http://x86.trystack.org:5000/v2.0
neutron net-create net1
neutron subnet-create net1 <x.x.x.0/24> --name subnet1
neutron router-create router1
neutron router-gateway-set router1 external
neutron router-interface-add router1 subnet1
nova keypair-add --pub-key <path/id_rsa.pub> key1
nova secgroup-create sg sg
nova secgroup-add-rule sg icmp -1 -1 0.0.0.0/0
nova secgroup-add-rule sg tcp 1 65535 0.0.0.0/0
nova secgroup-add-rule sg udp 1 65535 0.0.0.0/0
nova secgroup-add-rule sg tcp 22 22 0.0.0.0/0
nova boot vm1 --flavor m1.medium --image "Fedora 20 x86_64" --key-name key1 --security-groups sg
nova boot vm2 --flavor m1.medium --image "Fedora 20 x86_64" --key-name key1 --security-groups sg
nova boot vm3 --flavor m1.medium --image "Fedora 20 x86_64" --key-name key1 --security-groups sg
neutron floatingip-create external
neutron floatingip-create external
neutron floatingip-create external
neutron floatingip-create external
nova floating-ip-list
nova floating-ip-associate vm1 <fip>
nova floating-ip-associate vm2 <fip>
nova floating-ip-associate vm3 <fip>

Just take into account to replace your personal information and to choose your private network and finally to assign your personal floating ip to the VMS.

Also my security group is quite redundant but I wanted to play around with the API.

For further reference here’s the API URLs:

* Compute http://8.21.28.222:8774/v2
* Network http://8.21.28.4:9696/
* S3 http://8.21.28.222:8080
* Image http://8.21.28.222:9292
* Metering http://8.21.28.222:8777
* Cloudformation http://8.21.28.222:8000/v1
* Volume http://8.21.28.222:8776/v1
* EC2 http://8.21.28.222:8773/services/Cloud
* Orchestration http://8.21.28.222:8004/v1
* Object Store http://8.21.28.222:8080/v1
* Identity http://8.21.28.222:5000/v2.0

Nested RHEV-H 3.x and VMware ESXi 5.5

I was trying to setup a RHEV laboratory in my ESXi but I wasn’t unable to approve my host.

In RHEVM appeared an error in the GUI like this one (check your Events tab):

Command returned failure code 1 during SSH session '[email protected]'

But in RHEVM logs there was another latent issue, checking /var/log/ovirt-engine/engine.log :

2014-04-27 12:17:20,814 ERROR [org.ovirt.engine.core.bll.InstallerMessages] (VdsDeploy) Installation x.x.x.x: Failed to execute stage 'Setup validation': Hardware does not support virtualization
...
2014-04-27 12:18:48,555 ERROR [org.ovirt.engine.core.bll.InstallVdsCommand] (pool-4-thread-49) [1c11a8d3] Host installation failed for host 4eba0c68-4370-4223-8271-831cccf3a64e, x.x.x.x.: java.io.IOException: Command returned failure code 1 during SSH session '[email protected]'

So in order to enables nested virtualization of RHEV-H in VMware ESXi 5.5u1 we have to add 2 new values in our vmx file:

featMask.vm.hv.capable = "Min:1"
vhv.enable = "TRUE"

After adding them I was able to approve the host without any further issues.

Full backup with Duplicity and DropBox

Some days ago I needed a dirty full backup of a VM, a nice solution that I’ve found out is to install duplicity and back it up via DropBox.

In order to do that first we need to install duplicity and DropBox Python SDK vi pip:

apt-get install -y python-pip duplicity
pip install dropbox
duplicity full / dpbx:///test --exclude=/sys --exclude=/dev --exclude=/proc --exclude=/run

A few notes to take into account:

* We need to approve duplicity via DropBox, an oAuth link will prompted during execution.

* If it doesn’t work and “NameError: global name ‘rest’ is not defined” shows up, please apply this patch.

* If test path is not found and this error show ups: “ErrorResponse: [404] u”Path ‘/test’ not found”
It means that you have to create a test directory in Dropbox inside /Apps/duplicity path, otherwise duplicity won’t find where to store our data.

Upgrading RHEV-M 3.3 to RHEV-M 3.4 Beta

In order to update RHEV Manager from 3.3 to 3.4 beta we can follow this procedure:

yum-config-manager --enable rhel-6-server-rhevm-3-beta-rpms
yum-config-manager --enable rhel-6-server-beta-rpms
yum-config-manager --enable rhel-6-server-rhevh-beta-rpms
engine-upgrade-check
yum update rhevm-setup -y
engine-setup
yum update rhevm-dwh rhevm-reports -y
engine-setup
yum update rhev-hypervisor6 -y

If upgrading rhevm-reports fails is due to this bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1086003

As a workaround first we need to upgrade jasper reports server and install openjdk dev rpm and re-run engine-setup once more:

yum update jasperreports-server-pro -y
yum install java-1.7.0-openjdk-devel.x86_64 -y
engine-setup

VMware heartbleed – ESXi 5.5 U1 and vCSA 5.5 U1

VMware has already released patches (19/4/2013) for ESXi and vCSA 5.5U1, newest versions are:

VMware vCenter Server Appliance – 5.5.0 U1a – 5.5.0.10100 Build 1750781
VMware ESXi – 5.5.0 U1 – VMware ESXi 5.5.0 build-1746018

VMkernel esxi 5.5.0 #1 SMP Release build-1746018 Apr 15 2014 02:08:35 x86_64 GNU/Linux

More info in: https://www.vmware.com/security/advisories/VMSA-2014-0004.html

Did you already upgrade them? Let’s keep our private keys private ūüôā

Enable btrfs storage driver with Docker and Fedora 20

In order to enable btrfs storage driver instead of AUFS in Fedora 20 we have to:

1) Create a partition or logical volume with btrfs and mount it in /var/lib/docker, for example in my case:

 # yum install -y btrfs-progs
 # lvcreate -l 100%FREE -n docker fedora
 # mkfs.btrfs /dev/fedora/docker
 # echo '/dev/mapper/fedora-docker /var/lib/docker                   btrfs    defaults        1 2' >> /etc/fstab 

2) Install Docker

# yum -y install docker-io
# mount -a
# vi /usr/lib/systemd/system/docker.service
  ...
  ExecStart=/usr/bin/docker -d -s btrfs
  ...
# systemctl start docker
# systemctl enable docker

3) Check that Docker is using btrfs as storage driver

# docker info
Containers: 0
Images: 4
Storage Driver: btrfs
Execution Driver: native-0.1
Kernel Version: 3.13.9-200.fc20.x86_64

Upgrade BeagleBone Black to Debian 7.4 and kernel 3.14

First we need to download lastest eMMC image and dump it to our micro SD card:

$ wget --no-check-certificate https://s3.amazonaws.com/beagle-debian/BBB-eMMC-flasher-debian-7.4-2014-03-04-2gb.img.xz
$ unxz BBB-eMMC-flasher-debian-7.4-2014-03-04-2gb.img.xz
$ md5sum BBB-eMMC-flasher-debian-7.4-2014-03-04-2gb.img
  6c8fe30763170969db97a31200a72828  BBB-eMMC-flasher-debian-7.4-2014-03-04-2gb.img
$ sudo dd bs=1M if=BBB-eMMC-flasher-debian-7.4-2014-03-04-2gb.img of=/dev/disk2

If we want to know process status of dd:

$ sudo kill -INFO <dd pid>

Afterwards, while holding down the USER BOOT button (the one next to the micro SD cad slot), plug in the power cord for the BBB and release it when all 4 LEDs are lit.

Wait for 30min (more or less) until all four LEDs are lit again and not blinking!

Default username/password:

* debian/temppwd
* root/root

If everything fails and we can boot from SD card you can write manually the eMMC by running this script in your BBB:

$ /opt/scripts/tools/beaglebone-black-eMMC-flasher.sh

Upgrading to a 3.14 kernel is easy as following these steps:

$ wget --no-check-certificate https://rcn-ee.net/deb/wheezy-armhf/v3.14.0-rc8-bone0/install-me.sh
$ chmod +x install-me.sh
$ ./install-me.sh
$ reboot
$ uname -a
Linux beaglebone 3.14.0-rc8-bone0 #1 SMP Sat Mar 29 00:25:15 UTC 2014 armv7l GNU/Linux

Soyoustart – How to upgrade VMware ESXi 5.5 to latest patch?

1) Download ESXi patch from VMware site:

https://my.vmware.com/group/vmware/patch#search

2) Put your ESXi patch in your datastore (ex: datastore02)

3) SSH to ESXi and list profiles in our patch

~ # esxcli software sources profile list -d=[datastore02]/00-isos/ESXi550-201312001.zip
Name                              Vendor        Acceptance Level
--------------------------------  ------------  ----------------
ESXi-5.5.0-20131204001-no-tools   VMware, Inc.  PartnerSupported
ESXi-5.5.0-20131204001-standard   VMware, Inc.  PartnerSupported
ESXi-5.5.0-20131201001s-standard  VMware, Inc.  PartnerSupported
ESXi-5.5.0-20131201001s-no-tools  VMware, Inc.  PartnerSupported

4) Install your new profile

~ # esxcli software profile install -d=[datastore02]/00-isos/ESXi550-201312001.zip -p "ESXi-5.5.0-20131204001-standard" --ok-to-remove

5) Set your acceptance level to CommunitySupported

~ # esxcli software acceptance set --level=CommunitySupported

6) Install custom vib driver for our Intel NIC 82579V

~ # esxcli software vib install -v http://files.v-front.de/net-e1001e-1.0.0.x86_64.vib
Installation Result
Message: The update completed successfully, but the system needs to be rebooted for the changes to be effective.
Reboot Required: true
VIBs Installed: Chilly_bootbank_net-e1001e_1.0.0
VIBs Removed:
VIBs Skipped:

7) Reboot and cross your fingers

~ # reboot

8) Check if our build number has been upgraded!

~ # uname -a
VMkernel xxxx 5.5.0 #1 SMP Release build-1331820 Sep 18 2013 23:08:31 x86_64 GNU/Linux
~ # uname -a
VMkernel xxxx 5.5.0 #1 SMP Release build-1474528 Dec 11 2013 03:54:09 x86_64 GNU/Linux