Jump to: navigation, search

Difference between revisions of "Rally/HowToExtendRally"

m (Add Deploy engines: Reformulated)
m (Add Server providers: Reformulated)
Line 36: Line 36:
  
 
==Add Server providers==
 
==Add Server providers==
Implementing your own server providers allows you to use custom hardware/software configurations as well as virtualization strategies. You can see the list of already available server providers [[Rally/ServerProviders|here]].
+
Implementing your own server providers allows you to use custom hardware/software configurations as well as virtualization strategies. Before starting to implement your own server provider, take a look at  [[Rally/ServerProviders|the already available server providers]].
  
 
To implement a custom server provider, you need to create a subclass of ''rally.serverprovider.provider.ProviderFactory'' and implement 5 methods, namely ''__init__()'', ''upload_image()'', ''destroy_image()'', ''create_vms()'' and ''destroy_vms()'':
 
To implement a custom server provider, you need to create a subclass of ''rally.serverprovider.provider.ProviderFactory'' and implement 5 methods, namely ''__init__()'', ''upload_image()'', ''destroy_image()'', ''create_vms()'' and ''destroy_vms()'':
Line 67: Line 67:
 
             """Destroy already created vms by vm_uuids."""
 
             """Destroy already created vms by vm_uuids."""
 
             ''# Destroy VMs''
 
             ''# Destroy VMs''
 
 
  
 
==Add Benchmark scenarios==
 
==Add Benchmark scenarios==
 
Stay tuned.
 
Stay tuned.

Revision as of 12:30, 15 October 2013

Extend Rally functionality

Add Deploy engines

Implementing your own deploy engines allows you to employ custom OpenStack platforms. Before starting to implement your own deploy engine, take a look at the already available deploy engines.

To implement a custom deploy engine, you need to create a subclass of rally.deploy.engine.EngineFactory and implement the __init__(), deploy() and cleanup() methods:

   from rally.deploy import engine
   from rally.serverprovider import provider
   class MyEngine(engine.EngineFactory):
       def __init__(self, task, config):
           self.task = task
           self._config = config
           self._vms = []
           provider_config = config['provider']
           self._vm_provider = provider.ProviderFactory.get_provider(provider_config)
           # Perform further initialization here
       def deploy(self):
           self._vms = self._vm_provider.create_vms()
           for vm in self._vms:
               # Deploy OpenStack on each VM here
           # Return the endpoints
           return {
               'identity': {
                   'url': 'http://$IDENTITY_HOST/',
                   'uri': 'http://$IDENTITY_HOST:5000/v2.0/',
                   'admin_username': '$ADMIN',
                   'admin_password': '$PASSWORD',
                   'admin_tenant_name': '$TENANT',
               }
           }
       def cleanup(self):
           # Cleanup the deployment here, e.g.
           self._vm_provider.destroy_vms()

Add Server providers

Implementing your own server providers allows you to use custom hardware/software configurations as well as virtualization strategies. Before starting to implement your own server provider, take a look at the already available server providers.

To implement a custom server provider, you need to create a subclass of rally.serverprovider.provider.ProviderFactory and implement 5 methods, namely __init__(), upload_image(), destroy_image(), create_vms() and destroy_vms():

   from rally.serverprovider import provider
   class MyProvider(provider.ProviderFactory):
       def __init__(self, config):
           self._config = config
           # Perform further initialization here
       def upload_image(self, file_path, disk_format, container_format):
           """Upload image that could be used while creating new vms.
           :file_path: Path to the image file
           :disk_format: qcow, qcow2, iso, ...
           :container_format: bare, ovf, aki, ...
           :returns: ImageDTO instance
           """
           # Upload image
       def destroy_image(self, image_uuid):
           """Destroy image by image indentificator."""
           # Destroy image
       def create_vms(self, image_uuid=None, type_id=None, amount=1):
           """Create VMs with chosen image.
           :param image_uuid: Indetificator of image
           :param type_id: Vm type identificator
           :param amount: amount of required VMs
           :returns: list of ServerDTO instances.
           """
           # Create VMs
       def destroy_vms(self, vm_uuids):
           """Destroy already created vms by vm_uuids."""
           # Destroy VMs

Add Benchmark scenarios

Stay tuned.