Paul Belanger be0a0c99f3
Fix exception when using boot_from_volume for create_server
It is possible for create_server to accept a dict for image, however
_get_boot_from_volume_kwargs did expect that. This created the following exception:

 Traceback (most recent call last):
   File "/opt/stack/new/nodepool/nodepool/nodepool.py", line 358, in _run
     self._launchNode()
   File "/opt/stack/new/nodepool/nodepool/nodepool.py", line 290, in _launchNode
     volume_size=self._label.volume_size)
   File "/opt/stack/new/nodepool/nodepool/provider_manager.py", line 235, in createServer
     return self._client.create_server(wait=False, **create_args)
   File "<decorator-gen-6>", line 2, in create_server
   File "/opt/stack/new/nodepool-venv/local/lib/python2.7/site-packages/shade/_utils.py", line 393, in func_wrapper
     return func(*args, **kwargs)
   File "/opt/stack/new/nodepool-venv/local/lib/python2.7/site-packages/shade/openstackcloud.py", line 5517, in create_server
     volumes=volumes, kwargs=kwargs)
   File "/opt/stack/new/nodepool-venv/local/lib/python2.7/site-packages/shade/openstackcloud.py", line 5333, in _get_boot_from_volume_kwargs
     cloud=self.name, region=self.region_name))
 OpenStackCloudException: Image {'id': u'1cb47019-08a4-4b9c-ae62-737b547648b6'} is not a valid image in devstack:RegionOne

Now, check if image is a dictonary, like we did in create_server. Also
add an ansible test for os_server so we additional code coverage.

Change-Id: If58cd96b0b9ce4569120d60fbceb2c23b2f7641d
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2017-05-13 15:50:55 -04:00
..
2017-01-11 16:42:25 +05:30

This directory contains a testing infrastructure for the Ansible
OpenStack modules. You will need a clouds.yaml file in order to run
the tests. You must provide a value for the `cloud` variable for each
run (using the -e option) as a default is not currently provided.

If you want to run these tests against devstack, it is easiest to use
the tox target. This assumes you have a devstack-admin cloud defined
in your clouds.yaml file that points to devstack. Some examples of
using tox:

    tox -e ansible

    tox -e ansible keypair security_group

If you want to run these tests directly, or against different clouds,
then you'll need to use the ansible-playbook command that comes with
the Ansible distribution and feed it the run.yml playbook. Some examples:

    # Run all module tests against a provider
    ansible-playbook run.yml -e "cloud=hp"

    # Run only the keypair and security_group tests
    ansible-playbook run.yml -e "cloud=hp" --tags "keypair,security_group"

    # Run all tests except security_group
    ansible-playbook run.yml -e "cloud=hp" --skip-tags "security_group"