[Openstack-devel] Bug#703242: [openstack-dev] Bug#703242: Bugging issue with nova-consoleauth on newest nova build 2012.1.1-15

Julien Cristau jcristau at debian.org
Sun Mar 24 12:23:13 UTC 2013


On Sun, Mar 17, 2013 at 12:47:38 -0700, Vishvananda Ishaya wrote:

> Potential fix here:
> 
> https://review.openstack.org/24608
> 
That's not sufficient:

- ConsoleAuthManager.authorize_console sets token_dict['instance_id'],
  and then ConsoleAuthManager._validate_console accesses
  token_dict['instance_uuid'], which doesn't work out well
- compute_api.validate_vnc_console calls get_vnc_console without a
  console_type parameter

I got things to work with this (I guess there's a way to get the right
console_type, but not being familiar with the code I'm hoping I can
leave that to you):

diff --git a/nova/compute/api.py b/nova/compute/api.py
index a317c44..d6f9a0e 100644
--- a/nova/compute/api.py
+++ b/nova/compute/api.py
@@ -1566,7 +1566,8 @@ class API(BaseAPI):
         instance = self.get(context, instance_id)
         output = self._call_compute_message('get_vnc_console',
                                             context,
-                                            instance)
+                                            instance,
+                                            params={"console_type": 'xvpvnc'})
         return (port == output['port'] and host == output['host'])
 
     @wrap_check_policy
diff --git a/nova/consoleauth/manager.py b/nova/consoleauth/manager.py
index 5690ef3..eec4c1a 100644
--- a/nova/consoleauth/manager.py
+++ b/nova/consoleauth/manager.py
@@ -84,12 +84,12 @@ class ConsoleAuthManager(manager.Manager):
 
         LOG.audit(_("Received Token: %(token)s, %(token_dict)s)"), locals())
 
-    def _validate_console(self, token):
+    def _validate_console(self, context, token):
         console_valid = False
         token_dict = self.tokens[token]
         try:
             console_valid = self.compute_api.validate_vnc_console(context,
-                                                token_dict['instance_uuid'],
+                                                token_dict['instance_id'],
                                                 token_dict['host'],
                                                 token_dict['port'])
         except exception.InstanceNotFound:
@@ -99,7 +99,7 @@ class ConsoleAuthManager(manager.Manager):
     def check_token(self, context, token):
         token_valid = token in self.tokens
         LOG.audit(_("Checking Token: %(token)s, %(token_valid)s)"), locals())
-        if token_valid and self._validate_console(token):
+        if token_valid and self._validate_console(context, token):
             return self.tokens[token]
 
     def delete_tokens_for_instance(self, context, instance_id):


Cheers,
Julien
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/openstack-devel/attachments/20130324/60ef2a91/attachment.pgp>


More information about the Openstack-devel mailing list