From bc1b7808bb937a414217396b2aca7d03cacd166f Mon Sep 17 00:00:00 2001 From: Haiwei Xu Date: Sat, 8 Feb 2014 03:45:47 +0900 Subject: [PATCH] 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 --- novaclient/shell.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/novaclient/shell.py b/novaclient/shell.py index 919aa21..f751f21 100644 --- a/novaclient/shell.py +++ b/novaclient/shell.py @@ -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,