~ubuntu-branches/ubuntu/saucy/nova/saucy-proposed

« back to all changes in this revision

Viewing changes to nova/manager.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2012-05-24 13:12:53 UTC
  • mfrom: (1.1.55)
  • Revision ID: package-import@ubuntu.com-20120524131253-ommql08fg1en06ut
Tags: 2012.2~f1-0ubuntu1
* New upstream release.
* Prepare for quantal:
  - Dropped debian/patches/upstream/0006-Use-project_id-in-ec2.cloud._format_image.patch
  - Dropped debian/patches/upstream/0005-Populate-image-properties-with-project_id-again.patch
  - Dropped debian/patches/upstream/0004-Fixed-bug-962840-added-a-test-case.patch
  - Dropped debian/patches/upstream/0003-Allow-unprivileged-RADOS-users-to-access-rbd-volumes.patch
  - Dropped debian/patches/upstream/0002-Stop-libvirt-test-from-deleting-instances-dir.patch
  - Dropped debian/patches/upstream/0001-fix-bug-where-nova-ignores-glance-host-in-imageref.patch 
  - Dropped debian/patches/0001-fix-useexisting-deprecation-warnings.patch
* debian/control: Add python-keystone as a dependency. (LP: #907197)
* debian/patches/kombu_tests_timeout.patch: Refreshed.
* debian/nova.conf, debian/nova-common.postinst: Convert to new ini
  file configuration
* debian/patches/nova-manage_flagfile_location.patch: Refreshed

Show diffs side-by-side

added added

removed removed

Lines of Context:
56
56
from nova.db import base
57
57
from nova import flags
58
58
from nova import log as logging
59
 
from nova.scheduler import api
 
59
from nova.rpc import dispatcher as rpc_dispatcher
 
60
from nova.scheduler import rpcapi as scheduler_rpcapi
60
61
from nova import version
61
62
 
62
63
 
130
131
class Manager(base.Base):
131
132
    __metaclass__ = ManagerMeta
132
133
 
 
134
    # Set RPC API version to 1.0 by default.
 
135
    RPC_API_VERSION = '1.0'
 
136
 
133
137
    def __init__(self, host=None, db_driver=None):
134
138
        if not host:
135
139
            host = FLAGS.host
136
140
        self.host = host
137
141
        super(Manager, self).__init__(db_driver)
138
142
 
 
143
    def create_rpc_dispatcher(self):
 
144
        '''Get the rpc dispatcher for this manager.
 
145
 
 
146
        If a manager would like to set an rpc API version, or support more than
 
147
        one class as the target of rpc messages, override this method.
 
148
        '''
 
149
        return rpc_dispatcher.RpcDispatcher([self])
 
150
 
139
151
    def periodic_tasks(self, context, raise_on_error=False):
140
152
        """Tasks to be run at a periodic interval."""
141
153
        for task_name, task in self._periodic_tasks:
190
202
    def __init__(self, host=None, db_driver=None, service_name='undefined'):
191
203
        self.last_capabilities = None
192
204
        self.service_name = service_name
 
205
        self.scheduler_rpcapi = scheduler_rpcapi.SchedulerAPI()
193
206
        super(SchedulerDependentManager, self).__init__(host, db_driver)
194
207
 
195
208
    def update_service_capabilities(self, capabilities):
201
214
        """Pass data back to the scheduler at a periodic interval."""
202
215
        if self.last_capabilities:
203
216
            LOG.debug(_('Notifying Schedulers of capabilities ...'))
204
 
            api.update_service_capabilities(context, self.service_name,
205
 
                                self.host, self.last_capabilities)
 
217
            self.scheduler_rpcapi.update_service_capabilities(context,
 
218
                    self.service_name, self.host, self.last_capabilities)