Nova instance custom name

Asked by Rajeev

Hi,

I'm running Rally benchmark scenarios related to nova on my openstack setup. Every time it creates an instance with randomly generated name.

I modified the JSON file to have "name" as parameter within "args" which is as shown below:
"args": {
      "flavor": {
        "name": "m1.tiny"
      },
      "auto_assign_nic": true,
      "image": {
        "name": "cirros"
      },
      "name": "s_random"

When i executed the scenario, I'm getting the following error:

test scenario NovaServers.boot_and_delete_server
args position 0
args values:
{
  "runner": {
    "type": "constant",
    "concurrency": 1,
    "times": 1
  },
  "args": {
    "flavor": {
      "name": "m1.tiny"
    },
    "auto_assign_nic": true,
    "image": {
      "name": "cirros"
    },
    "name": "s_random"
  },
  "context": {
    "users": {
      "users_per_tenant": 2,
      "project_domain": "default",
      "user_choice_method": "random",
      "user_domain": "default",
      "tenants": 3,
      "resource_management_workers": 20
    },
    "network": {
      "network_create_args": {},
      "subnets_per_network": 1,
      "start_cidr": "10.2.0.0/24",
      "dns_nameservers": null,
      "networks_per_tenant": 2
    }
  }
}

--------------------------------------------------------------------------------
 Task 228e18ee-d63e-45fa-9e41-147af9dc241d has 1 error(s)
--------------------------------------------------------------------------------

TypeError: create() got multiple values for keyword argument 'name'

Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/rally/task/runner.py", line 67, in _run_scenario_once
    getattr(scenario_inst, method_name)(**scenario_kwargs)
  File "/usr/lib/python2.7/site-packages/rally/plugins/openstack/scenarios/nova/servers.py", line 99, in boot_and_delete_server
    server = self._boot_server(image, flavor, **kwargs)
  File "/usr/lib/python2.7/site-packages/rally/task/atomic.py", line 84, in func_atomic_actions
    f = func(self, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/rally/plugins/openstack/scenarios/nova/utils.py", line 141, in _boot_server
    server_name, image_id, flavor_id, **kwargs)
TypeError: create() got multiple values for keyword argument 'name'

I have edited the "rally/plugins/openstack/scenarios/nova/utils.py" file to get the server_name from the JSON file and the code snippet is as below:

changes made in "_boot_server" sub-routine:

def _boot_server(self, image_id, flavor_id,
                     auto_assign_nic=False, **kwargs):
        """Boot a server.

        Returns when the server is actually booted and in "ACTIVE" state.

        If multiple networks created by Network context are present, the first
        network found that isn't associated with a floating IP pool is used.

        :param image_id: int, image ID for server creation
        :param flavor_id: int, flavor ID for server creation
        :param auto_assign_nic: bool, whether or not to auto assign NICs
        :param kwargs: other optional parameters to initialize the server
        :returns: nova Server instance
        """
        #server_name = self.generate_random_name()
        server_name = kwargs["name"]

Can some one please let me know whether the approach which i have followed is correct or not. If not, please advice.

Thanks,
Rajeev

Question information

Language:
English Edit question
Status:
Expired
For:
Rally Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Andriy Kurilin (andreykurilin) said :
#1

Hi!
Why you need to specify custom name? Rally doesn't allow to specify custom names for all entities. Such restriction bases on the fact that Rally should know what to cleanup after workload, so we need to create resources with known names.

Revision history for this message
Rajeev (rsomayaj) said :
#2

Hi,

I don't want to name my instances s_rally_XXXX_XXXX. I want it to be more user friendly ones. Even if I specify with a custom name, i believe its not going to affect the cleanup procedure. Instead of searching the name with s_rally.., I will modify the script to search with a pre-defined nova instance name format.

example: I'll create all nova instances starting with "nova_instance_". I just need to search all the instances starting with the specified value and then cleanup the resource.

I hope its going to work. Whats your take on this?

Regards,
Rajeev

Revision history for this message
Launchpad Janitor (janitor) said :
#3

This question was expired because it remained in the 'Open' state without activity for the last 15 days.