~ubuntu-branches/ubuntu/raring/nova/raring-proposed

« back to all changes in this revision

Viewing changes to nova/manager.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short, Adam Gandelman, Chuck Short
  • Date: 2012-11-23 09:04:58 UTC
  • mfrom: (1.1.66)
  • Revision ID: package-import@ubuntu.com-20121123090458-91565o7aev1i1h71
Tags: 2013.1~g1-0ubuntu1
[ Adam Gandelman ]
* debian/control: Ensure novaclient is upgraded with nova,
  require python-keystoneclient >= 1:2.9.0. (LP: #1073289)
* debian/patches/{ubuntu/*, rbd-security.patch}: Dropped, applied
  upstream.
* debian/control: Add python-testtools to Build-Depends.

[ Chuck Short ]
* New upstream version.
* Refreshed debian/patches/avoid_setuptools_git_dependency.patch.
* debian/rules: FTBFS if missing binaries.
* debian/nova-scheudler.install: Add missing rabbit-queues and
  nova-rpc-zmq-receiver.
* Remove nova-volume since it doesnt exist anymore, transition to cinder-*.
* debian/rules: install apport hook in the right place.
* debian/patches/ubuntu-show-tests.patch: Display test failures.
* debian/control: Add depends on genisoimage
* debian/control: Suggest guestmount.
* debian/control: Suggest websockify. (LP: #1076442)
* debian/nova.conf: Disable nova-volume service.
* debian/control: Depend on xen-system-* rather than the hypervisor.
* debian/control, debian/mans/nova-conductor.8, debian/nova-conductor.init,
  debian/nova-conductor.install, debian/nova-conductor.logrotate
  debian/nova-conductor.manpages, debian/nova-conductor.postrm
  debian/nova-conductor.upstart.in: Add nova-conductor service.
* debian/control: Add python-fixtures as a build deps.

Show diffs side-by-side

added added

removed removed

Lines of Context:
56
56
import eventlet
57
57
 
58
58
from nova.db import base
59
 
from nova import flags
 
59
from nova.openstack.common import cfg
60
60
from nova.openstack.common import log as logging
61
61
from nova.openstack.common.plugin import pluginmanager
62
62
from nova.openstack.common.rpc import dispatcher as rpc_dispatcher
63
63
from nova.scheduler import rpcapi as scheduler_rpcapi
64
64
from nova import version
65
65
 
66
 
 
67
 
FLAGS = flags.FLAGS
68
 
 
69
 
 
 
66
CONF = cfg.CONF
 
67
CONF.import_opt('host', 'nova.config')
70
68
LOG = logging.getLogger(__name__)
71
69
 
72
70
 
139
137
 
140
138
    def __init__(self, host=None, db_driver=None):
141
139
        if not host:
142
 
            host = FLAGS.host
 
140
            host = CONF.host
143
141
        self.host = host
144
142
        self.load_plugins()
 
143
        self.backdoor_port = None
145
144
        super(Manager, self).__init__(db_driver)
146
145
 
147
146
    def load_plugins(self):
183
182
                              locals())
184
183
 
185
184
    def init_host(self):
186
 
        """Handle initialization if this is a standalone service.
187
 
 
188
 
        Child classes should override this method.
189
 
 
 
185
        """Hook to do additional manager initialization when one requests
 
186
        the service be started.  This is called before any service record
 
187
        is created.
 
188
 
 
189
        Child classes should override this method.
 
190
        """
 
191
        pass
 
192
 
 
193
    def pre_start_hook(self, **kwargs):
 
194
        """Hook to provide the manager the ability to do additional
 
195
        start-up work before any RPC queues/consumers are created. This is
 
196
        called after other initialization has succeeded and a service
 
197
        record is created.
 
198
 
 
199
        Child classes should override this method.
 
200
        """
 
201
        pass
 
202
 
 
203
    def post_start_hook(self):
 
204
        """Hook to provide the manager the ability to do additional
 
205
        start-up work immediately after a service creates RPC consumers
 
206
        and starts 'running'.
 
207
 
 
208
        Child classes should override this method.
190
209
        """
191
210
        pass
192
211
 
195
214
 
196
215
    def service_config(self, context):
197
216
        config = {}
198
 
        for key in FLAGS:
199
 
            config[key] = FLAGS.get(key, None)
 
217
        for key in CONF:
 
218
            config[key] = CONF.get(key, None)
200
219
        return config
201
220
 
202
221
 
222
241
 
223
242
    def update_service_capabilities(self, capabilities):
224
243
        """Remember these capabilities to send on next periodic update."""
 
244
        if not isinstance(capabilities, list):
 
245
            capabilities = [capabilities]
225
246
        self.last_capabilities = capabilities
226
247
 
227
248
    @periodic_task
228
 
    def _publish_service_capabilities(self, context):
229
 
        """Pass data back to the scheduler at a periodic interval."""
 
249
    def publish_service_capabilities(self, context):
 
250
        """Pass data back to the scheduler.
 
251
 
 
252
        Called at a periodic interval. And also called via rpc soon after
 
253
        the start of the scheduler.
 
254
        """
230
255
        if self.last_capabilities:
231
256
            LOG.debug(_('Notifying Schedulers of capabilities ...'))
232
 
            self.scheduler_rpcapi.update_service_capabilities(context,
233
 
                    self.service_name, self.host, self.last_capabilities)
 
257
            for capability_item in self.last_capabilities:
 
258
                self.scheduler_rpcapi.update_service_capabilities(context,
 
259
                        self.service_name, self.host, capability_item)
 
260
        # TODO(NTTdocomo): Make update_service_capabilities() accept a list
 
261
        #                  of capabilities