~james-page/charms/trusty/nova-compute/stable-bug-1413862

« back to all changes in this revision

Viewing changes to hooks/nova_compute_utils.py

Checkin templates.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
from charmhelpers.contrib.openstack.utils import get_os_codename_package
18
18
from charmhelpers.contrib.openstack import templating, context
19
19
 
20
 
from nova_compute_contexts import (
 
20
from nova_compute_context import (
21
21
    CloudComputeContext,
22
22
    NovaComputeLibvirtContext,
23
23
    NovaComputeCephContext,
34
34
]
35
35
 
36
36
BASE_RESOURCE_MAP = {
37
 
    '/etc/ceph/ceph.conf': {
38
 
        'contexts': [NovaComputeCephContext()],
39
 
        'services': [],
40
 
    },
41
 
    '/etc/ceph/secret.xml': {
42
 
        'contexts': [NovaComputeCephContext()],
43
 
        'services': [],
44
 
    },
45
37
    '/etc/libvirt/qemu.conf': {
46
38
        'services': ['libvirt-bin'],
47
39
        'contexts': [],
61
53
    },
62
54
}
63
55
 
 
56
CEPH_RESOURCES = {
 
57
    '/etc/ceph/ceph.conf': {
 
58
        'contexts': [NovaComputeCephContext()],
 
59
        'services': [],
 
60
    },
 
61
    '/etc/ceph/secret.xml': {
 
62
        'contexts': [NovaComputeCephContext()],
 
63
        'services': [],
 
64
    }
 
65
}
64
66
 
65
67
QUANTUM_RESOURCES = {
66
68
    '/etc/quantum/quantum.conf': {
119
121
            resource_map[conf] = {}
120
122
            resource_map[conf]['services'] = svcs
121
123
            resource_map[conf]['contexts'] = ctxts
 
124
 
 
125
    if relation_ids('ceph'):
 
126
        resource_map.update(CEPH_RESOURCES)
 
127
 
122
128
    return resource_map
123
129
 
124
130
def restart_map():
170
176
 
171
177
 
172
178
def migration_enabled():
173
 
    return config('enable-live-migration').lower() == 'true'
 
179
    # XXX: confirm juju-core bool behavior is the same.
 
180
    return config('enable-live-migration')
174
181
 
175
182
 
176
183
def quantum_enabled():
177
 
    return config('network-manager').lower() == 'quantum'
 
184
    manager = config('network-manager')
 
185
    if not manager:
 
186
        return False
 
187
    return manager.lower() == 'quantum'
178
188
 
179
189
 
180
190
def _network_config():
248
258
    Ensure libvirt live migration is properly configured or disabled,
249
259
    depending on current config setting.
250
260
    """
 
261
    # dont think we need this
 
262
    return
251
263
    configs = configs or register_configs()
252
264
    configs.write('/etc/libvirt/libvirtd.conf')
253
265
    configs.write('/etc/default/libvirt-bin')