...
The zone(), pod(), cluster(), host()
are plain objects that carry just attributes. For instance a zone consists of the attributes - name, dns entries, network type
etc. Within a zone I create pod()s
and append them to my zone object, further down creating cluster()s
in those pods and appending them to the pod and within the clusters finally my host()s
that get appended to my cluster object. Once I have defined all that is necessary to create my cloud I pass on the described configuration to the generate_setup_config()
method which gives me my resultant configuration in JSON format.
You don't always want to describe one hosts configurations in python files so we've included some common examples in the Marvin tarball under the sandbox
directory. In the sandbox are configurations of a single host advanced and a sing single host basic zone that can be tailored to your environment using a simple properties file. The property file, setup.properties
is contains editable name, value (name=value
) pairs that you can change to the IPs, hostnames etc that you have in your environment. The properties file when passed to the python script will generate the JSON configuration for you.
Sample setup.properties:
Code Block | ||
---|---|---|
| ||
[globals |
...
] secstorage.allowed.internal.sites=10.147.28.0/24 |
...
[environment] dns=10.147.28.6 |
...
mshost=localhost |
...
mysql.host=localhost |
...
mysql.cloud.user=cloud |
...
mysql.cloud.passwd=cloud |
...
[cloudstack] private.gateway=10.147.29.1 |
...
private.pod.startip=10.147.29.150 |
...
private.pod.endip=10.147.29.159 |
And generate the JSON config as follows:
Code Block | ||
---|---|---|
| ||
root@cloud:~/incubator-cloudstack/tools/marvin/marvin/sandbox/advanced# python advanced_env.py -i setup.properties -o advanced.cfg |
...
root@cloud:~/incubator-cloudstack/tools/marvin/marvin/sandbox/advanced# head -10 advanced.cfg |
...
{ "zones": |
...
[ { "name": "Sandbox-XenServer", |
...
"guestcidraddress": "10.1.1.0/24", |
...
... <snip/> ... |
Nose extends unittest to make testing easier. Nose comes with plugins that help integrating your regular unittests into external build systems, coverage, profiling etc. Marvin comes with its own nose plugin for this so you can use nose to drive CloudStack tests. The plugin can be installed by simply running setuptools in your marvin source directory. Running nosetests -p will show if the plugin registered successfully.
Code Block | ||
---|---|---|
| ||
$ cd /usr/local/lib/python2.7/site-packages/marvin |
...
$ easy_install . |
...
Processing . |
...
Running setup.py -q bdist_egg --dist-dir |
...
Installed /usr/local/lib/python2.7/dist-packages/marvin_nose-0.1.0-py2.7.egg |
...
Processing dependencies for marvin-nose==0.1.0 |
...
Finished processing dependencies for marvin-nose==0.1.0 |
...
$ nosetests -p |
...
Plugin xunit |
...
Plugin multiprocess |
...
Plugin capture |
...
Plugin logcapture |
...
Plugin coverage |
...
Plugin attributeselector |
...
Plugin doctest |
...
Plugin profile |
...
Plugin collect-only |
...
Plugin isolation |
...
Plugin pdb |
...
Plugin marvin |
...
# Usage and running tests |
...
$ nosetests --with-marvin --marvin-config=/path/to/basic_zone.cfg --load /path/to/tests |
The smoke tests and component tests contain attributes that can be used to filter the tests that you would like to run against your deployment. You would use nose's attrib plugin for this. Currently zone models are
Examples of tests with more backend verification and complete integration of suites for network, snapshots, templates etc can be found in the test/integration/smoke
directory. Almost all of these test suites use common library wrappers written around the test framework to simplify writing tests. These libraries are found under test/integration/lib
. You may start using these libraries at your convenience but there's no better way than to write the complete API call yourself to understand its behaviour.
The libraries take advantage of the fact that every resource - VirtualMachine, ISO, Template, PublicIp etc follows the pattern of
For any feedback, typo corrections please email Prasanna Santhanam
...