[openstack-dev] [rally]how can I give admin role to rally

Andrey Kurilin akurilin at mirantis.com
Tue Feb 23 09:33:03 UTC 2016


Hi!
Since I don't found such scenario in our upstream repo, I assume that this
is your custom plugin and I can propose you several solutions:

1) `nova evacuate` is allowed only for admin user, so you can use admin
client in your scenario without changing roles for users. Also,
`required_openstack` validator will check for you that admin client is
specified for your deployment. An example:

from rally.plugins.openstack import scenario


class MyPlugin(scenario.OpenStackScenario):
    """My awesome plugin."""

    @validation.required_openstack(admin=True, users=True)
    @scenario.configure()
    def some_scenario(self):
        # do something with nova via simple user
        user_novaclient = self.clients("nova")
        server = user_novaclient.servers.boot(...)

        # do something with nova via admin user
        admin_novaclient = self.admin_clients("nova")
        admin_novaclient.servers.evacuate(...)


2) Rally supports "roles" context, which can assign roles to users. If you
specify your task as below, self.clients("nova") will return novaclient
initialized by user with "admin" and "another_name_of_role_if_needed" roles:

---
  MyPlugin.some_scenario:
    -
      runner:
        type: "constant"
        times: 10
        concurrency: 2
      context:
        users:
          tenants: 2
          users_per_tenant: 3
        roles:
          - "admin"
          - "another_name_of_role_if_needed"




On Tue, Feb 23, 2016 at 8:20 AM, Wu, Liming <wulm.fnst at cn.fujitsu.com>
wrote:

> Hi
>
>   When I run a scenario about "nova evacuate **",  error message was
>   Show as follows.  How can I give the admin role to rally user.
>
> 2016-02-23 09:18:25.631 6212 INFO rally.task.runner [-] Task
> e2ad6390-8cde-4ed7-a595-f5c36d5e2a08 | ITER: 0 END: Error Forbidden: User
> does not have admin privileges (HTTP 403) (Request-ID:
> req-45312185-56e5-46c4-a39a-68f5e346715e)
> 2016-02-23 09:18:25.636 5995 INFO
> rally.plugins.openstack.context.cleanup.context [-] Task
> e2ad6390-8cde-4ed7-a595-f5c36d5e2a08 | Starting:  user resources cleanup
>
> Best regards
> wuliming
>
>
>
> __________________________________________________________________________
> OpenStack Development Mailing List (not for usage questions)
> Unsubscribe: OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>



-- 
Best regards,
Andrey Kurilin.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20160223/043bc8bf/attachment.html>


More information about the OpenStack-dev mailing list