Monthly Archives: May 2014

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.