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

« back to all changes in this revision

Viewing changes to hooks/nova_compute_context.py

Add libvirt context to enable TCP listening when migration is configured.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
 
30
30
 
31
31
class NovaComputeLibvirtContext(context.OSContextGenerator):
 
32
    '''
 
33
    Determines various libvirt options depending on live migration
 
34
    configuration.
 
35
    '''
32
36
    interfaces = []
33
37
 
34
38
    def __call__(self):
35
 
        pass
 
39
 
 
40
        # enable tcp listening if configured for live migration.
 
41
        migration = config('enable-live-migration')
 
42
        if migration and migration.lower() == 'true':
 
43
            opts = '-d -l'
 
44
        else:
 
45
            opts = '-d'
 
46
        return {
 
47
            'libvirtd_opts': opts,
 
48
        }
36
49
 
37
50
 
38
51
class NovaComputeVirtContext(context.OSContextGenerator):
40
53
    def __call__(self):
41
54
        return {}
42
55
 
 
56
 
43
57
class NovaComputeCephContext(context.CephContext):
44
58
    def __call__(self):
45
59
        ctxt = super(NovaComputeCephContext, self).__call__()
72
86
        return {
73
87
            'network_manager': 'nova.network.manager.FlatDHCPManager',
74
88
            'flat_interface': config('flat-interface'),
75
 
            'ec2_host': ec2_host,
 
89
            'ec2_dmz_host': ec2_host,
76
90
        }
77
91
 
78
92
    def quantum_context(self):
168
182
 
169
183
        q_sec_groups = relation_get('quantum_security_groups')
170
184
        if q_sec_groups and q_sec_groups.lower() == 'yes':
 
185
            # nova.conf
171
186
            ovs_ctxt['security_group_api'] = 'quantum'
172
187
            ovs_ctxt['nova_firewall_driver'] = n_fw_driver
 
188
            # ovs conf
173
189
            ovs_ctxt['ovs_firewall_driver'] = q_fw_driver
174
190
 
175
191
        return ovs_ctxt