Fix Ceph External Backend issues

1. Fixes the traceback raised by sysinv conductor when reprovisioning
    external ceph backend using same ceph.conf naming as old backend
 2. Allows ceph config file to be overwritten in the
    /opt/platform/config/version/ceph-config directory
 3. In the original design, a new directory, /opt/extension/ceph,
    would be used to store external ceph config files. This directory
    is not actually needed. This commit removes the code in drbd.pp that
    creates this directory.
 4. In storage_ceph_external.py, use uuid instead of isystem_uuid.

Story: 2002820
Task: 22737

Change-Id: Ic9bbfd5859b2ce8a02b6940965db16b78ce854ae
Signed-off-by: Irina Mihai <irina.mihai@windriver.com>
This commit is contained in:
Wei Zhou 2018-07-05 10:02:18 -04:00 committed by Irina Mihai
parent 7a57ad711a
commit 743a292630
4 changed files with 12 additions and 15 deletions

View File

@ -259,13 +259,6 @@ class platform::drbd::extension (
mountpoint => $mountpoint,
resync_after => $resync_after,
}
file { "${mountpoint}/ceph":
ensure => 'directory',
owner => 'root',
group => 'root',
mode => '0775',
}
}
class platform::drbd::patch_vault::params (

View File

@ -291,7 +291,7 @@ class StorageCephExternalController(rest.RestController):
LOG.exception(e)
return dict(
success="",
error=str(e))
error=e.value)
return dict(success="Success: ceph config file is uploaded", error="")
@ -311,7 +311,7 @@ def _check_and_update_services(storage_ceph_ext):
if sb_list:
for sb in sb_list:
if (sb.isystem_uuid != storage_ceph_ext.get("isystem_uuid", None) and
if (sb.uuid != storage_ceph_ext.get("uuid", None) and
sb.backend in [constants.SB_TYPE_CEPH,
constants.SB_TYPE_CEPH_EXTERNAL] and
s in sb.get('services')):
@ -380,7 +380,7 @@ def _check_backend_ceph_external(storage_ceph_ext):
backend_name = storage_ceph_ext.get('name')
backend_list = pecan.request.dbapi.storage_backend_get_list()
for backend in backend_list:
if backend.isystem_uuid != storage_ceph_ext.get("isystem_uuid", None):
if backend.uuid != storage_ceph_ext.get("uuid", None):
if backend_name in constants.SB_DEFAULT_NAMES.values():
msg = _(
"The \"%s\" name is reserved for internally managed "

View File

@ -9547,16 +9547,20 @@ class ConductorManager(service.PeriodicService):
def store_ceph_external_config(self, context, contents, ceph_conf_filename):
"""Store the uploaded external ceph config file in /opt/platform/config
"""
## Once this directory is created at installation time, we can
## remove this code.
# Once this directory is created at installation time, we can
# remove this code.
if not os.path.exists(tsc.PLATFORM_CEPH_CONF_PATH):
os.makedirs(tsc.PLATFORM_CEPH_CONF_PATH)
opt_ceph_conf_file = os.path.join(tsc.PLATFORM_CEPH_CONF_PATH,
ceph_conf_filename)
# Because user needs root permission to manually delete ceph config file
# from /opt/platform/config/version/ceph-config directory if the file
# already exists, we will allow ceph config file to be overwritten.
# Thus, we won't raise an exception if the file already exists.
if os.path.exists(opt_ceph_conf_file):
raise exception.SysinvException(_(
"Same external ceph config file already exists."))
LOG.info("Overwriting file %s in %s " %
(ceph_conf_filename, tsc.PLATFORM_CEPH_CONF_PATH))
try:
with open(opt_ceph_conf_file, 'w+') as f:

View File

@ -2546,7 +2546,7 @@ class Connection(object):
:param stor_ceph_ext_id: The id or uuid of a ceph storage backend.
:param values: Dict of values to update.
{
'ceph_conf': '/opt/extension/ceph/3p_ceph1.conf'
'ceph_conf': '3p_ceph1.conf'
}
:returns: An external ceph storage backend.
"""