Skip to content

Instantly share code, notes, and snippets.

@jtaleric
Created November 18, 2015 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jtaleric/da89226b2096e19b09c6 to your computer and use it in GitHub Desktop.
Save jtaleric/da89226b2096e19b09c6 to your computer and use it in GitHub Desktop.
{% set flavor_name = flavor_name or "m1.small" %}
{
"NeutronPlugin.create_network_nova_boot": [
{
"args": {
"flavor": {
"name": "{{flavor_name}}"
},
"image": {
"name": "centos7"
},
"network_create_args": {},
},
"runner": {
"type": "serial",
"times": 5,
},
"context": {
"users": {
"tenants": 1,
"users_per_tenant": 1
},
},
}
]
}
from rally.task import atomic
from rally.task import scenario
from rally.plugins.openstack.scenarios.nova import utils as nova_utils
from rally.plugins.openstack.scenarios.neutron import utils as neutron_utils
from rally.task import types
from rally.task import utils as task_utils
from rally.task import validation
class NeutronPlugin(neutron_utils.NeutronScenario,
nova_utils.NovaScenario,
scenario.Scenario):
#
# Create network
# Attach guest to new network
# List
#
@scenario.configure()
@types.set(image=types.ImageResourceType,
flavor=types.FlavorResourceType)
@validation.image_valid_on_flavor("flavor", "image")
@validation.required_openstack(users=True)
@scenario.configure(context={"cleanup": ["nova"]})
def create_network_nova_boot(self,image,flavor,network_create_args=None,**kwargs):
print "Image: %s" % image
print "Flavor: %s" % flavor
# _create_network_and_subnets - creates a tuple.
network = self._create_network_and_subnets(network_create_args or {})
kwargs["nics"] = [{ 'net-id': network[0]['network']['id']}]
self._boot_server(image, flavor, **kwargs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment