~ubuntu-cloud-archive/ubuntu/precise/nova/trunk

« back to all changes in this revision

Viewing changes to nova/console/manager.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short, Chuck Short, Adam Gandelman
  • Date: 2012-06-22 12:39:57 UTC
  • mfrom: (1.1.57)
  • Revision ID: package-import@ubuntu.com-20120622123957-hbzwg84nt9rqwg8r
Tags: 2012.2~f2~20120621.14517-0ubuntu1
[ Chuck Short ]
* New upstream version.

[ Adam Gandelman ]
* debian/rules: Temporarily disable test suite while blocking
  tests are investigated. 
* debian/patches/kombu_tests_timeout.patch: Dropped.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 
20
20
import socket
21
21
 
 
22
from nova.compute import rpcapi as compute_rpcapi
22
23
from nova import exception
23
24
from nova import flags
24
25
from nova import log as logging
25
26
from nova import manager
26
27
from nova.openstack.common import cfg
27
28
from nova.openstack.common import importutils
28
 
from nova import rpc
29
29
from nova import utils
30
30
 
31
31
 
61
61
        self.driver = importutils.import_object(console_driver)
62
62
        super(ConsoleProxyManager, self).__init__(*args, **kwargs)
63
63
        self.driver.host = self.host
 
64
        self.compute_rpcapi = compute_rpcapi.ComputeAPI()
64
65
 
65
66
    def init_host(self):
66
67
        self.driver.init_host()
74
75
        pool = self.get_pool_for_instance_host(context, host)
75
76
        try:
76
77
            console = self.db.console_get_by_pool_instance(context,
77
 
                                                      pool['id'],
78
 
                                                      instance_id)
 
78
                                                           pool['id'],
 
79
                                                           instance['uuid'])
79
80
        except exception.NotFound:
80
81
            LOG.debug(_('Adding console'), instance=instance)
81
82
            if not password:
83
84
            if not port:
84
85
                port = self.driver.get_port(context)
85
86
            console_data = {'instance_name': name,
86
 
                            'instance_id': instance_id,
 
87
                            'instance_uuid': instance['uuid'],
87
88
                            'password': password,
88
89
                            'pool_id': pool['id']}
89
90
            if port:
90
91
                console_data['port'] = port
91
92
            console = self.db.console_create(context, console_data)
92
93
            self.driver.setup_console(context, console)
 
94
 
93
95
        return console['id']
94
96
 
95
97
    @exception.wrap_exception()
121
123
                             'username': 'test',
122
124
                             'password': '1234pass'}
123
125
            else:
124
 
                pool_info = rpc.call(context,
125
 
                                 self.db.queue_get_for(context,
126
 
                                                   FLAGS.compute_topic,
127
 
                                                   instance_host),
128
 
                       {'method': 'get_console_pool_info',
129
 
                        'args': {'console_type': console_type}})
 
126
                pool_info = compute_rpcapi.get_console_pool_info(context,
 
127
                        console_type, instance_host)
130
128
            pool_info['password'] = self.driver.fix_pool_password(
131
129
                                                    pool_info['password'])
132
130
            pool_info['host'] = self.host