Fix authentication bug when booting an server in V3

Currently when booting a server with V3, novaclient sends an empty
os_password to image_cs. This will cause 401(Unauthorized: Invalid
user/password) when trying to find image. This is is a result of
changes nova's V3 API: nova is no longer used as a proxy for the
image service. So novaclient uses two Client instances: one for
nova, the other for image service. This patch checks os_password
before creating the image Client and assigns it if it's empty.

Change-Id: Ic54cef93e9b823fb98b1edd78776c9a1fc06ba46
Closes-Bug: #1277425
This commit is contained in:
Haiwei Xu 2014-02-08 03:45:47 +09:00 committed by Chris Buccella
parent 7cf73f1942
commit 02a091cc6c
1 changed files with 6 additions and 0 deletions

View File

@ -694,6 +694,12 @@ class OpenStackComputeShell(object):
# sometimes need to be able to look up images information
# via glance when connected to the nova api.
image_service_type = 'image'
# NOTE(hdd): the password is needed again because creating a new
# Client without specifying bypass_url will force authentication.
# We can't reuse self.cs's bypass_url, because that's the URL for
# the nova service; we need to get glance's URL for this Client
if not os_password:
os_password = helper.password
self.cs.image_cs = client.Client(
options.os_compute_api_version, os_username,
os_password, os_tenant_name, tenant_id=os_tenant_id,