Hi,

I installed opencontrail kolla per 
https://gitlab.com/gokulpch/OpenContrail-Kolla/tree/master

I found that spawning a service instance would always fail.
On investigating, it seems there are problems with svc_monitor/nova_client.py
i) The Openstack nova client wants the project id not the project name so I was 
continually getting authorization failures.
ii) If authorization is required it seemed the client returns a string 
containing 'HTTP 401' rather than throwing an exception.

I hacked nova_client.py as shown in the diff below to fix. 
Obviously, the project_id should not be hard wired like I've done below, rather 
it should come from the config file for a proper fix.

After patching the file, I restarted contrail-svc-monitor.service in controller 
container and my service vms are created.

-- Martin

root@condev(controller):/usr/lib/python2.7/dist-packages/svc_monitor# cat 
~/nova_client.p
--- /root/usr-lib-python2.7-dist-packages-svc_monitor-nova_client.py    
2017-11-17 08:32:31.824536983 +0000
+++ nova_client.py      2017-11-17 20:06:01.922516986 +0000
@@ -14,11 +14,11 @@
             client = self._nova.get(proj_name)
             if client is not None:
                 return client
-    
+
         auth_url = self._args.auth_protocol + '://' + self._args.auth_host \
                    + ':' + self._args.auth_port + '/' + self._args.auth_version
         self._nova[proj_name] = nc.Client(
-            '2', username=self._args.admin_user, project_id=proj_name,
+            '2', username=self._args.admin_user, 
project_id='f19b7a8879bf4ee890d5e25b7525a262',
             api_key=self._args.admin_password,
             region_name=self._args.region_name, service_type='compute',
             auth_url=auth_url, insecure=self._args.auth_insecure,
@@ -50,7 +50,10 @@
             raise
         except Exception as e:
             self.logger.error("nova error %s" % str(e))
-            return None
+            if str(e).find( 'HTTP 401' ) == -1:
+                return None
+            else:
+                raise nc_exc.Unauthorized( str(e) )
 
     def oper(self, resource, oper, proj_name, **kwargs):
         try:
root@condev(controller):/usr/lib/python2.7/dist-packages/svc_monitor#

_______________________________________________
Users mailing list
[email protected]
http://lists.opencontrail.org/mailman/listinfo/users_lists.opencontrail.org

Reply via email to