~gnuoy/charms/trusty/quantum-gateway/fix-purge

« back to all changes in this revision

Viewing changes to hooks/charmhelpers/contrib/storage/linux/ceph.py

  • Committer: Liam Young
  • Date: 2015-01-23 14:48:02 UTC
  • mfrom: (76.2.89 neutron-ha-scale)
  • Revision ID: liam.young@canonical.com-20150123144802-63k91ec17k30p5ng
[xianghui, r=gnuoy] To support quantum-gateway HA in Icehouse before Juno native HA deployed.
It works by using pacemaker to monitor a daemon, which will detect neutron agents status and cleanup local resource when failover etc.

BP:
https://blueprints.launchpad.net/cts-engineering/+spec/neutron-gateway-services-need-ha-support

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright 2014-2015 Canonical Limited.
 
2
#
 
3
# This file is part of charm-helpers.
 
4
#
 
5
# charm-helpers is free software: you can redistribute it and/or modify
 
6
# it under the terms of the GNU Lesser General Public License version 3 as
 
7
# published by the Free Software Foundation.
 
8
#
 
9
# charm-helpers is distributed in the hope that it will be useful,
 
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
# GNU Lesser General Public License for more details.
 
13
#
 
14
# You should have received a copy of the GNU Lesser General Public License
 
15
# along with charm-helpers.  If not, see <http://www.gnu.org/licenses/>.
 
16
 
1
17
#
2
18
# Copyright 2012 Canonical Ltd.
3
19
#
157
173
    log('Created new ceph keyring at %s.' % keyring, level=DEBUG)
158
174
 
159
175
 
 
176
def delete_keyring(service):
 
177
    """Delete an existing Ceph keyring."""
 
178
    keyring = _keyring_path(service)
 
179
    if not os.path.exists(keyring):
 
180
        log('Keyring does not exist at %s' % keyring, level=WARNING)
 
181
        return
 
182
 
 
183
    os.remove(keyring)
 
184
    log('Deleted ring at %s.' % keyring, level=INFO)
 
185
 
 
186
 
160
187
def create_key_file(service, key):
161
188
    """Create a file containing key."""
162
189
    keyfile = _keyfile_path(service)