Configure ReservationPool with the blazar admin user

By default, Nova requires API clients to have admin role to handle host
aggregates. Blazar uses a role based on the current context of each API
call. Since callers of the create_lease API can be non-admin users as
well as admin users, requests by non-admin users fail to create host
aggregates when creating leases.

This patch ensures the ReservationPool class is configured with the
blazar admin user, which enables both admins and non-admins to have host
aggregates created on their behalf when they call the create_lease API.

Change-Id: Id3259b143925feb0a60e29eac9f85578b44926fc
Closes-Bug: #1706882
This commit is contained in:
Masahito Muroi 2017-07-27 18:36:43 +09:00 committed by Pierre Riteau
parent c17a052434
commit b8b4749916
1 changed files with 7 additions and 1 deletions

View File

@ -202,7 +202,13 @@ class NovaClientWrapper(object):
class ReservationPool(NovaClientWrapper):
def __init__(self):
super(ReservationPool, self).__init__()
super(ReservationPool, self).__init__(
username=CONF.os_admin_username,
password=CONF.os_admin_password,
user_domain_name=CONF.os_admin_user_domain_name,
project_name=CONF.os_admin_project_name,
project_domain_name=CONF.os_admin_user_domain_name)
self.config = CONF.nova
self.freepool_name = self.config.aggregate_freepool_name