~openstack-charmers-next/charms/trusty/ceph-mon/trunk

« back to all changes in this revision

Viewing changes to hooks/ceph_hooks.py

  • Committer: Edward Hope-Morley
  • Date: 2016-04-15 13:04:49 UTC
  • Revision ID: edward.hope-morley@canonical.com-20160415130449-7xbanpqqsmms1pj8
Ensure all units provide ceph-public-addr

radosgw relation was only providing information
when executed by a leader unit. This patch ensures
that the minimum info is provided regardless.

Change-Id: I2f841933f70847fb1bddc94f5ae525f5588021c2
Closes-Bug: 1570823

Show diffs side-by-side

added added

removed removed

Lines of Context:
515
515
    apt_install(packages=filter_installed_packages(['radosgw']))
516
516
    if not unit:
517
517
        unit = remote_unit()
518
 
    """Process broker request(s)."""
 
518
 
519
519
    if ceph.is_quorum():
 
520
        log('mon cluster in quorum - providing radosgw with keys')
 
521
        public_addr = get_public_addr()
 
522
        data = {
 
523
            'fsid': leader_get('fsid'),
 
524
            'radosgw_key': ceph.get_radosgw_key(),
 
525
            'auth': config('auth-supported'),
 
526
            'ceph-public-address': public_addr,
 
527
        }
 
528
 
520
529
        settings = relation_get(rid=relid, unit=unit)
 
530
        """Process broker request(s)."""
521
531
        if 'broker_req' in settings:
522
 
            if not ceph.is_leader():
523
 
                log("Not leader - ignoring broker request", level=DEBUG)
524
 
            else:
 
532
            if ceph.is_leader():
525
533
                rsp = process_requests(settings['broker_req'])
526
534
                unit_id = unit.replace('/', '-')
527
535
                unit_response_key = 'broker-rsp-' + unit_id
528
 
                log('mon cluster in quorum - providing radosgw with keys')
529
 
                public_addr = get_public_addr()
530
 
                data = {
531
 
                    'fsid': leader_get('fsid'),
532
 
                    'radosgw_key': ceph.get_radosgw_key(),
533
 
                    'auth': config('auth-supported'),
534
 
                    'ceph-public-address': public_addr,
535
 
                    unit_response_key: rsp,
536
 
                }
537
 
                relation_set(relation_id=relid, relation_settings=data)
 
536
                data[unit_response_key] = rsp
 
537
            else:
 
538
                log("Not leader - ignoring broker request", level=DEBUG)
 
539
 
 
540
        relation_set(relation_id=relid, relation_settings=data)
538
541
    else:
539
542
        log('mon cluster not in quorum - deferring key provision')
540
543