Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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:
Code Block

#!/usr/bin/env python

import sys
import os
import boto
import boto.ec2

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,
                       aws_secret_access_key=secretkey,
                       is_secure=False,
                       region=region,
                       port=7080,
                       path="/awsapi",
                       api_version="2010-11-15")

        '''Get list of images that I own'''
        images = conn.get_all_images()
        print images
        myimage = images[0]
        '''Pick an instance type'''
        vm_type='m1.small'
        reservation = myimage.run(instance_type=vm_type,security_groups=['default'])

if __name__ == '__main__':
        main()

...

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

End!

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