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

« back to all changes in this revision

Viewing changes to hooks/nova_compute_context.py

Checkin templates.

Show diffs side-by-side

added added

removed removed

Lines of Context:
65
65
class CloudComputeContext(context.OSContextGenerator):
66
66
    '''
67
67
    Generates main context for writing nova.conf and quantum.conf templates
68
 
    from a cloud-compute relation changed hook
 
68
    from a cloud-compute relation changed hook.  Mainly used for determinig
 
69
    correct network and volume service configuration on the compute node,
 
70
    as advertised by the cloud-controller.
69
71
 
70
72
    Note: individual quantum plugin contexts are handled elsewhere.
71
73
    '''
138
140
 
139
141
        net_manager = relation_get('network_manager')
140
142
        if net_manager:
141
 
            ctxt['network_manager'] = net_manager
142
143
            if net_manager.lower() == 'flatdhcpmanager':
143
 
                ctxt.update(self.flat_dhcp_context())
 
144
                ctxt.update({
 
145
                    'network_manager_config': self.flat_dhcp_context()
 
146
                })
144
147
            elif net_manager.lower() == 'quantum':
145
 
                ctxt.update(self.quantum_context())
 
148
                ctxt.update({
 
149
                    'network_manager_config': self.quantum_context()
 
150
                })
146
151
            _save_flag_file(path='/etc/nova/nm.conf', data=net_manager)
147
152
 
148
 
        ctxt.update(self.volume_context())
 
153
        vol_service = self.volume_context()
 
154
        if vol_service:
 
155
            ctxt.update({'volume_service_config': vol_service})
149
156
        return ctxt
150
157
 
151
158
class QuantumPluginContext(context.OSContextGenerator):
168
175
        n_fw_driver = 'nova.virt.firewall.NoopFirewallDriver'
169
176
 
170
177
        ovs_ctxt = {
 
178
            'quantum_plugin': 'ovs',
171
179
            # quantum.conf
172
180
            'core_plugin': q_driver,
173
181
            # nova.conf
182
190
 
183
191
        q_sec_groups = relation_get('quantum_security_groups')
184
192
        if q_sec_groups and q_sec_groups.lower() == 'yes':
 
193
            ovs_ctxt['quantum_security_groups'] = True
185
194
            # nova.conf
186
 
            ovs_ctxt['security_group_api'] = 'quantum'
187
195
            ovs_ctxt['nova_firewall_driver'] = n_fw_driver
188
196
            # ovs conf
189
197
            ovs_ctxt['ovs_firewall_driver'] = q_fw_driver