Skip to content

Commit

Permalink
Merge "Revert "Fix migration across apps when using VMs created from …
Browse files Browse the repository at this point in the history
…image""
  • Loading branch information
Zuul authored and openstack-gerrit committed Oct 5, 2023
2 parents ccea3ee + 11845c7 commit e70f228
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 20 deletions.
8 changes: 2 additions & 6 deletions hooks/charmhelpers/contrib/storage/linux/ceph.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,19 +158,15 @@ def get_osd_settings(relation_name):
return _order_dict_by_key(osd_settings)


def send_application_name(relid=None, app_name=None):
def send_application_name(relid=None):
"""Send the application name down the relation.
:param relid: Relation id to set application name in.
:type relid: str
:param app_name: Application name to send in the relation.
:type app_name: str
"""
if app_name is None:
app_name = application_name()
relation_set(
relation_id=relid,
relation_settings={'application-name': app_name})
relation_settings={'application-name': application_name()})


def send_osd_settings():
Expand Down
4 changes: 2 additions & 2 deletions hooks/nova_compute_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@

# This is just a label and it must be consistent across
# nova-compute nodes to support live migration.
CEPH_SECRET_UUID = 'c91ce26f-403d-4058-9c38-6b56e1c428e0'
CEPH_SECRET_UUID = '514c9fca-8cbe-11e2-9c52-3bc8c7819472'

OVS_BRIDGE = 'br-int'

Expand Down Expand Up @@ -435,7 +435,7 @@ def __call__(self):
ctxt = super(NovaComputeCephContext, self).__call__()
if not ctxt:
return {}
svc = 'nova-compute'
svc = service_name()
# secret.xml
ctxt['ceph_secret_uuid'] = CEPH_SECRET_UUID
# nova.conf
Expand Down
14 changes: 4 additions & 10 deletions hooks/nova_compute_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ def ceph_joined():
# Bug 1427660
if not is_unit_paused_set() and config('virt-type') in LIBVIRT_TYPES:
service_restart(libvirt_daemon())
send_application_name(app_name='nova-compute')
send_application_name()


def get_ceph_request():
Expand Down Expand Up @@ -566,7 +566,7 @@ def ceph_changed(rid=None, unit=None):
log('ceph relation incomplete. Peer not ready?')
return

if not ensure_ceph_keyring(service='nova-compute', user='nova',
if not ensure_ceph_keyring(service=service_name(), user='nova',
group='nova'):
log('Could not create ceph keyring: peer not ready?')
return
Expand Down Expand Up @@ -691,11 +691,8 @@ def _get_broker_rid_unit_for_previous_request():

@hooks.hook('ceph-relation-broken')
def ceph_broken():
delete_keyring(service='nova-compute')
# cleanup old entries based on application name
svc_name = service_name()
if svc_name != 'nova_compute':
delete_keyring(service=svc_name)
service = service_name()
delete_keyring(service=service)
update_all_configs()


Expand All @@ -721,9 +718,6 @@ def upgrade_charm():

for r_id in relation_ids('amqp'):
amqp_joined(relation_id=r_id)
# Trigger upgrade-path from application_name to 'nova-compute'
for r_id in relation_ids('ceph'):
send_application_name(relid=r_id, app_name='nova-compute')

if is_relation_made('nrpe-external-master'):
update_nrpe_config()
Expand Down
3 changes: 1 addition & 2 deletions unit_tests/test_nova_compute_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -602,8 +602,7 @@ def test_ceph_joined(self):
self.apt_install.assert_called_with(['ceph-common'], fatal=True)
self.service_restart.assert_called_with('libvirt-bin')
self.libvirt_daemon.assert_called()
self.send_application_name.assert_called_once_with(
app_name='nova-compute')
self.send_application_name.assert_called_once_with()

@patch.object(hooks, 'CONFIGS')
def test_ceph_changed_missing_relation_data(self, configs):
Expand Down

0 comments on commit e70f228

Please sign in to comment.