Jump to: navigation, search

Difference between revisions of "Rally/HowToExtendRally"

m (Add Deploy engines)
(Extend Rally functionality: Info about adding server providers)
Line 3: Line 3:
  
 
==Add Deploy engines==
 
==Add Deploy engines==
Implementing your own deploy engines allows you to employ custom OpenStack platforms. You can see the list of already available Deploy engines [[Rally/DeployEngines|here]].
+
Implementing your own deploy engines allows you to employ custom OpenStack platforms. You can see the list of already available deploy engines [[Rally/DeployEngines|here]].
  
 
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:
 
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:
Line 34: Line 34:
 
             ''# Cleanup the deployment here, e.g.''
 
             ''# Cleanup the deployment here, e.g.''
 
             self._vm_provider.destroy_vms()
 
             self._vm_provider.destroy_vms()
 +
 +
  
 
==Add Server providers==
 
==Add Server providers==
Stay tuned.
+
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]].
 +
 
 +
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==
 
==Add Benchmark scenarios==
 
Stay tuned.
 
Stay tuned.

Revision as of 12:27, 15 October 2013

Extend Rally functionality

Add Deploy engines

Implementing your own deploy engines allows you to employ custom OpenStack platforms. You can see the list of already available deploy engines here.

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. You can see the list of already available server providers here.

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.