Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

Why Testing of a Release Artifact Matters

For an apache project, a VOTE on a release candidate is a very important process.  By voting (particularly for PPMC PMC members and committers), you are saying to the world that "yes, I have download, verified and tested using the project's procedure for testing".  Your +1, 0 or -1 vote is an indication of the success of the steps listed.  The more time that each individual spends reviewing the artifacts, the higher confidence we can have in both the release itself and our ability to pass an IPMC vote later on.  Remember, we, as a podling, are going to be held to a higher standard for our releases!  The IPMC (and our mentors) are looking for us to show that we understand what it means to have a high quality release.

Test with source code release

To setup an environment for CloudStack, usually it will take a while, e.g install a hypervisor host, install Mysql server etc. Here we'll use DevCloud2 to simplify the test procedure.  

Note

Following steps are tested on Mint 13, should work on ubuntu 12.04.  The same basic workflow should also work on Mac 10.7, with different specific commands for the prerequisite setup steps.  For Windows, you will need to run in cygwin and rename the genisoimage.exe file to mkisofs.

Note

Unless specified specifically, instruction steps should be assumed to be run from your local machine, not from within the DevCloud VM.  The DevCloud VM is the target runtime environment of the tests, but the instructions will push the code to that VM at the right time.

Setup environment

Install the devcloud VM image.

Note

DevCloud is a 1.5 GB download. It is a VM image running Ubuntu 12.04, including an installation of the Xen Hypervisor. We use DevCloud as a "cloud in a box" environment for basic functional testing of CloudStack.

...

...

  • Open VirtualBox, File->Import Appliance->choose DevCloud.ova
  • NOTE: Change the memory to 2046
  • NOTE: please do NOT select "re-initialize the MAC address of all network cards"

...

DevCloud VM image via the instructions on the DevCloud wiki page.


Install your required development tools (if not already available)

Warning

These pre-requisite development tools are not part of the release validation itself. The instructions are being provided for those testers that may not normally have these tools installed on their test system, and want to perform the expected tests. The pre-requisites listed may be not be 100% complete (for example, we assume you have git, tar, etc... installed).  If you run into any issues, please ask on the dev@cloudstack.apache.org mailing list.

Setup Pre-requisites on an Ubuntu 12.04 or Mint 13 machine

Code Block

sudo aptitude install openjdk-6-jdk ant
sudo apt-getaptitude update
sudo apt-getaptitude install python-software-properties
sudo add-apt-repository ppa:natecarlson/maven3
sudo aptitude update
sudo aptitude install maven3

Install JSch:

Code Block

wget http://downloads.sourceforge.net/project/jsch/jsch.jar/0.1.48/jsch-0.1.48.jar
sudo cp jsch-0.1.48.jar /usr/share/ant/lib/

Install Boto (assumes you have Python and Setup Tools installed):

Code Block

sudo easy_install boto

Setup Pre-requisites on OSX

...

Unpack the archive, and run:

Code Block

sudo cp lib/ant-jsch.jar /usr/share/ant/lib

Install Boto (assumes you have Python and Python Setup Tools already installed):

Code Block

sudo easy_install boto

Test the Build

...

Download the artifacts:

Code Block

mkdir /tmp/cloudstack; cd /tmp/cloudstack
wget --no-check-certificate https://dist.apache.org/repos/dist/release/cloudstack/KEYS
wget --no-check-certificate https://dist.apache.org/repos/dist/dev/cloudstack/4.13.0/apache-cloudstack-4.13.0-src.tar.bz2
wget --no-check-certificate https://dist.apache.org/repos/dist/dev/cloudstack/4.13.0/apache-cloudstack-4.13.0-src.tar.bz2.asc
wget --no-check-certificate https://dist.apache.org/repos/dist/dev/cloudstack/4.13.0/apache-cloudstack-4.13.0-src.tar.bz2.md5
wget --no-check-certificate https://dist.apache.org/repos/dist/dev/cloudstack/4.13.0/apache-cloudstack-4.13.0-src.tar.bz2.sha

Install gpg (if needed): sudo apt-get install gpg

...

Verify signatures and hash files:

Code Block

gpg --verify apache-cloudstack-4.13.0-src.tar.bz2.asc

This command should return "Good Signature".

Code Block

gpg --print-md MD5 apache-cloudstack-4.13.0-src.tar.bz2 | diff - apache-cloudstack-4.13.0-src.tar.bz2.md5
gpg --print-md SHA512 apache-cloudstack-4.13.0-src.tar.bz2 | diff - apache-cloudstack-4.13.0-src.tar.bz2.sha

Each of these commands should return no output. If there is any output from them, then there is a difference between the hash you generated locally and the hash that has been pulled from the server.

...

Create two new temporary directories:

Code Block

mkdir /tmp/cloudstack/git
mkdir /tmp/cloudstack/tree

Pull down the git repo:

Code Block

git clone https://git-wip-us.apache.org/repos/asf/cloudstack.git /tmp/cloudstack/git
cd /tmp/cloudstack/git
git archive --format=tar --prefix=/tmp/cloudstack/tree/ <commit-hash> | tar Pxf -

Unpack the release artifact:

Code Block

cd /tmp/cloudstack
tar xvfj apache-cloudstack-4.13.0-src.tar.bz2

Compare the contents of the release artifact with the contents pulled from the repo:

Code Block

diff -r /tmp/cloudstack/apache-cloudstack-4.13.0-src /tmp/cloudstack/tree

...

Verify the Code's License Headers

Code Block

cd /tmp/cloudstack/apache-cloudstack-4.13.0-src
mvn --projects='org.apache.cloudstack:cloudstack' org.apache.rat:apache-rat-plugin:0.8:check

...

Note: If you're on Ubuntu and using the PPA:natecarlson/maven3 (viz. Installing tools above), you've to use mvn3 instead of mvn, so mvn3 -P deps

Code Block

mvn -P developer,systemvm clean install
mvn -P developer -pl developer,tools/devcloud -Ddeploydb
mvn -pl :cloud-client-ui jetty:run

Configure CloudStack management server

Note
Need to set router.version.check to false in the global configuration page, after management server is up to workaround a devcloud issue, and then restart management server.

Once the management server starts on your local machine, execute the following commands to bring up a basic zone using the devcloud2 VM:

Deploy DevCloud (make sure mysql-connector-python is installed and that the management server is running)

Code Block

$ mvn -P developer,systemvm clean install
 -pl tools/devcloud -Ddeploysvr

Or, if the above does not work, maybe you're running mvn in debug mode using some MAVEN_OPTS, try marvin:

Code Block
$ cd tools/devcloud; python ../marvin/marvin/deployDataCenter.py -i devcloud.cfg

The above will deploy a zone with settings defined in tools/devcloud/devcloud.cfg which sets some global settings and will take some time. After this, you should restart management server and destroy any system vms which may have started for the global settings to take effect.

Validate the UI

Access web UI: http://localhost:8080/client, and login with admin/password. You can tell if the SSVM has been started by navigating to the Infrastructure page, and clicking on System VMs.  There should be 2 listed, and their status needs to be displayed as "Started".

...

  • In the first step of "Add instance " wizard, select template,
  • In step 2, select "tiny Linux"
  • In step 3, select "tinyOffering"
  • In step 4, select "No thanks"
  • Skip step 5 and 6.
  • Launch VM

Set some Global Settings

In the UI, set the following global settings:

  • expunge.interval = 120
  • expunge.delay = 120
  • enable.ec2.api = true

Now CTL-C your rdebug, and then "ant rdebug" again (to restart the management server).  This step is critical!

Additional Testing

Go to the instances list, click on the name of your new instance, and then click on the "show console" button.  The console of the VM should appear in a new window.

Stop the instance

Destroy the instance.

Wait for at least 2 minutes for the instance to be expunged (you can confirm that it has, by ssh'ing into devcloud and running xe vm-list to see if it's no longer listed).

Destroying the instance is important, and confirming that it was expunged prior to trying to test the EC2 API. This is due to the resource constraints on the DevCloud image.

EC2 testing

  • Under Accounts, generate keys for the admin user in the admin account (save these for future use)
  • Under service offerings, rename tinyOffering as m1.small
  • In your Virtual Box settings, forward port 7080 to local port 7080
  • In your local machine, cd into the awsapi-setup/setup folder of the source
  • Use the python script cloudstack-aws-api-register to register the user. Like so:
Code Block

python cloudstack-aws-api-register --apikey=JdTxDI2rOZ0RDZdgF1O_ZxfISxNuema9gQ3NyE4z5psX4sgSxE4ueEBohG3bfqWHr7BYP6_sAghXTIvm3noqkw --secretkey=fVT0r5lETIJThRGyec-Eg4WFm9_IN5tNIut7Ac5BJW0VExFGdRZEqA_JFvxdTFDH2ZeRcbO25xPQcyxt0VRWKg --cert=/tmp/cert.pem --url=http://localhost:7080/awsapi

In case you don't have a X509 ssl certificate, this is how you can generate one:

Code Block

openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /path/to/private_key.pem -out /path/to/cert.pem
Note

You can specify an empty file as cert but use the keys generated in the GUI (ex: touch /tmp/cert.pem). Executing this with an empty cert file will result in an error that can be ignored for this test. Regardless of this error, if the registration works you should see the credentials in the cloudbridge database in the usercredentials table.

Within the DevCloud VM (as root):
mysql cloudbridge
select * from usercredentials;

You should see your account as the only row in that table.

  • Use a python script similar as below (change the keys) to launch an instance:

Test other functionality, to suite your tastes (and perhaps using non-DevCloud infrastructure.

Validate AWSAPI interface

In a separate terminal run:

Code Block
mvn -Pawsapi -pl :cloud-awsapi jetty:run

Via the UI:
1. Destroy any running instances
2. Rename the tinyoffering compute offering 'm1.small'

Then using the access key and secret key of your admin user run the following python script:

Code Block
Code Block

#!/usr/bin/env python

import sys
import os
import boto
import boto.ec2

accesskey="2IUSA5xylbsPSnBQFoWXKg3RvjHgsufcKhC1SeiCbeEc0obKwUlwJamB_gFmMJkFHYHTIafpUx0pHcfLvt-dzw"
secretkey="oxV5Dhhk5ufNowey7OVHgWxCBVS4deTl9qL0EqMthfPBuy3ScHPo2fifDxw1aXeL5cyH10hnLOKjyKphcXGeDA"
 
region = boto.ec2.regioninfo.RegionInfo(name="ROOT", endpoint="localhost")
apikey='JiKIBbp6GRe3-7Ma-KF_pJl69BAsv2smJEA3So4DLfG0JCa9u5VnGeS5qsSo6cHiArzu8pRwEr4DkGy6M5inTw'
secretkey='x9iMD9XY0xsnLy_1EZQi6lOXAY5hH-O6S2z_VFVTWMO5_GAIdeSm93tNk09rb56cB1bAQKZ0vSOztBrusZRu6g'

def main():
        '''Establish connection to EC2 cloud'''
        conn = boto.connect_ec2(aws_access_key_id=apikey,
                      accesskey, aws_secret_access_key=secretkey,
                       is_secure=False,
                       region=region,
                       port=7080,
                       path="/awsapi",
                       api_version="20102012-1108-15")

        '''Get list of images that I own'''
        images = conn.get_all_images()
        print images
        myimage

res = images[0]
        '''Pick an instance type'''
        vm.run(instance_type='m1.small'
        reservation = myimage.run(instance_type=vm_type,security_groups=['default'])

if __name__ == '__main__':
        main()

...

If the keys have changed, using the above script verbatim won't work. Make sure to update the keys.

End!

If we made it this far, the release has at least been reasonably "smoke tested".