~ubuntu-branches/ubuntu/vivid/ironic/vivid-updates

« back to all changes in this revision

Viewing changes to ironic/nova/compute/manager.py

  • Committer: Package Import Robot
  • Author(s): Adam Gandelman, Adam Gandelman, James Page
  • Date: 2014-04-04 11:54:02 UTC
  • mfrom: (1.1.3)
  • Revision ID: package-import@ubuntu.com-20140404115402-wz51btzqxomdizv0
Tags: 2014.1~rc1-0ubuntu1
[ Adam Gandelman ]
* debian/ironic-common.postinst: Fix syntax preventing postinst
  from running.
* debian/ironic-api.install: Create missing .install, install
  ironic-api to /usr/bin/ironic-api.
* debian/patches/set_logdir.patch: Set log_dir to /var/log/ironic/ in
  sample config, causing both daemons to log to respective files there.
* debian/{rules, ironic-common.install}: Install ironic.conf.sample
  as /etc/ironic/ironic.conf.
* Fail build if test suite fails, limit testing concurrency to 1.
* debian/control: Add missing alembic, python-lockfile dependencies.

[ James Page ]
* d/control: Add Vcs-* fields for ubuntu-server-dev branches.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# coding=utf-8
 
2
#
 
3
# Copyright 2014 Red Hat, Inc.
 
4
# Copyright 2013 Hewlett-Packard Development Company, L.P.
 
5
# All Rights Reserved.
 
6
#
 
7
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
 
8
#    not use this file except in compliance with the License. You may obtain
 
9
#    a copy of the License at
 
10
#
 
11
#         http://www.apache.org/licenses/LICENSE-2.0
 
12
#
 
13
#    Unless required by applicable law or agreed to in writing, software
 
14
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 
15
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 
16
#    License for the specific language governing permissions and limitations
 
17
#    under the License.
 
18
 
 
19
"""Short term workaround for friction in the Nova compute manager with  Ironic.
 
20
 
 
21
https://etherpad.openstack.org/p/ironic-nova-friction contains current design
 
22
work. The goal here is to generalise the areas where n-c talking to a clustered
 
23
hypervisor has issues, and long term fold them into the main ComputeManager.
 
24
"""
 
25
 
 
26
from nova.compute import manager
 
27
import nova.context
 
28
 
 
29
 
 
30
class ClusteredComputeManager(manager.ComputeManager):
 
31
 
 
32
    def init_host(self):
 
33
        """Initialization for a clustered compute service."""
 
34
        self.driver.init_host(host=self.host)
 
35
        # Not used currently.
 
36
        # context = nova.context.get_admin_context()
 
37
        # instances = instance_obj.InstanceList.get_by_host(
 
38
        #     context, self.host, expected_attrs=['info_cache'])
 
39
 
 
40
        # defer_iptables_apply is moot for clusters - no local iptables
 
41
        # if CONF.defer_iptables_apply:
 
42
        #     self.driver.filter_defer_apply_on()
 
43
 
 
44
        self.init_virt_events()
 
45
 
 
46
        # try:
 
47
            # evacuation is moot for a clustered hypervisor
 
48
            # # checking that instance was not already evacuated to other host
 
49
            # self._destroy_evacuated_instances(context)
 
50
            # Don't run _init_instance until we solve the partitioning problem
 
51
            # - with N n-cpu's all claiming the same hostname, running
 
52
            # _init_instance here would lead to race conditions where each runs
 
53
            # _init_instance concurrently.
 
54
            # for instance in instances:
 
55
            #     self._init_instance(context, instance)
 
56
        # finally:
 
57
            # defer_iptables_apply is moot for clusters - no local iptables
 
58
            # if CONF.defer_iptables_apply:
 
59
            #     self.driver.filter_defer_apply_off()
 
60
 
 
61
    def pre_start_hook(self):
 
62
        """After the service is initialized, but before we fully bring
 
63
        the service up by listening on RPC queues, make sure to update
 
64
        our available resources (and indirectly our available nodes).
 
65
        """
 
66
        # This is an optimisation to immediately advertise resources but
 
67
        # the periodic task will update them eventually anyway, so ignore
 
68
        # errors as they may be transient (e.g. the scheduler isn't
 
69
        # available...). XXX(lifeless) this applies to all ComputeManagers
 
70
        # and once I feature freeze is over we should push that to nova
 
71
        # directly.
 
72
        try:
 
73
            self.update_available_resource(nova.context.get_admin_context())
 
74
        except Exception:
 
75
            pass