~gnuoy/charms/trusty/nova-compute/no-hugepages

« back to all changes in this revision

Viewing changes to hooks/nova_compute_hooks.py

  • Committer: James Page
  • Date: 2015-10-02 10:33:33 UTC
  • mfrom: (146.1.23 nova-compute)
  • Revision ID: james.page@ubuntu.com-20151002103333-ttw3b5by658vmpiq
Update for the latest and greatest LXD updates in wily

Show diffs side-by-side

added added

removed removed

Lines of Context:
76
76
    get_ipv6_addr
77
77
)
78
78
 
 
79
from charmhelpers.core.unitdata import kv
 
80
 
79
81
from nova_compute_context import (
80
82
    CEPH_SECRET_UUID,
81
83
    assert_libvirt_imagebackend_allowed
148
150
        fix_path_ownership(fp, user='nova')
149
151
 
150
152
    if config('virt-type').lower() == 'lxd':
151
 
        status_set('maintenance', 'Configure LXD')
152
153
        configure_lxd(user='nova')
153
154
 
154
155
    [compute_joined(rid) for rid in relation_ids('cloud-compute')]
423
424
    CONFIGS.write(NOVA_CONF)
424
425
 
425
426
 
 
427
@hooks.hook('lxd-relation-joined')
 
428
def lxd_joined(relid=None):
 
429
    relation_set(relation_id=relid,
 
430
                 user='nova')
 
431
 
 
432
 
 
433
@hooks.hook('lxd-relation-changed')
 
434
def lxc_changed():
 
435
    nonce = relation_get('nonce')
 
436
    db = kv()
 
437
    if nonce and db.get('lxd-nonce') != nonce:
 
438
        db.set('lxd-nonce', nonce)
 
439
        configure_lxd(user='nova')
 
440
        service_restart('nova-compute')
 
441
 
 
442
 
426
443
def main():
427
444
    try:
428
445
        hooks.execute(sys.argv)