Ensure that links are followed during upgrade

When upgrading mon and osd units, ensure that symlinks are followed
to ensure that directory based OSD's are upgraded correctly (which
are typically a symlink from /var/lib/ceph/osd/X -> actual_dir).

Change-Id: I7656bbc633b9706bd406dbca0f11fe6108916a02
Partial-Bug: 1611082
This commit is contained in:
James Page 2017-01-07 16:33:05 +00:00
parent 1e60cf0fbe
commit 9c707f166a
3 changed files with 8 additions and 4 deletions

View File

@ -1433,7 +1433,8 @@ def upgrade_monitor(new_version):
# Ensure the ownership of Ceph's directories is correct
chownr(path=os.path.join(os.sep, "var", "lib", "ceph"),
owner=ceph_user(),
group=ceph_user())
group=ceph_user(),
follow_links=True)
if systemd():
for mon_id in get_local_mon_ids():
service_start('ceph-mon@{}'.format(mon_id))
@ -1611,7 +1612,8 @@ def upgrade_osd(new_version):
# Ensure the ownership of Ceph's directories is correct
chownr(path=os.path.join(os.sep, "var", "lib", "ceph"),
owner=ceph_user(),
group=ceph_user())
group=ceph_user(),
follow_links=True)
if systemd():
for osd_id in get_local_osd_ids():
service_start('ceph-osd@{}'.format(osd_id))

View File

@ -111,7 +111,8 @@ class UpgradeRollingTestCase(unittest.TestCase):
])
chownr.assert_has_calls(
[
call(group='ceph', owner='ceph', path='/var/lib/ceph')
call(group='ceph', owner='ceph', path='/var/lib/ceph',
follow_links=True)
]
)

View File

@ -98,7 +98,8 @@ class UpgradeRollingTestCase(unittest.TestCase):
)
chownr.assert_has_calls(
[
call(group='ceph', owner='ceph', path='/var/lib/ceph')
call(group='ceph', owner='ceph', path='/var/lib/ceph',
follow_links=True)
]
)