From b74a02ef666aa87b5d7cd9c37af2fc7041df3895 Mon Sep 17 00:00:00 2001 From: Gerry Kopec Date: Tue, 29 Jan 2019 11:30:53 -0500 Subject: [PATCH] Add remote storage label for nova local backing To eliminate sysinv dependency, use a host label to determine if host has remote storage backing, or if not default to local image storage backing. User is required to assign host label remote-storage=enabled to trigger nova overrides to setup remote backing. Also set ceph.enabled to True in overrides which will trigger nova helm chart to create ceph.conf file in nova-compute container which is required for remote storage backing. This change also removes concurrent_disk_operations option as this is replaced upstream in nova Stein release. Story: 2004447 Task: 28122 Change-Id: I8c1ac0adf89dbc56e20bbd02126d25d9d64092fb Signed-off-by: Gerry Kopec --- sysinv/sysinv/sysinv/sysinv/helm/common.py | 1 + sysinv/sysinv/sysinv/sysinv/helm/nova.py | 33 ++++++++-------------- 2 files changed, 12 insertions(+), 22 deletions(-) diff --git a/sysinv/sysinv/sysinv/sysinv/helm/common.py b/sysinv/sysinv/sysinv/sysinv/helm/common.py index 7011a80769..144dee753c 100644 --- a/sysinv/sysinv/sysinv/sysinv/helm/common.py +++ b/sysinv/sysinv/sysinv/sysinv/helm/common.py @@ -41,6 +41,7 @@ PASSWORD_FORMAT_CEPH = 'ceph-auth' LABEL_CONTROLLER = 'openstack-control-plane' LABEL_COMPUTE_LABEL = 'openstack-compute-node' LABEL_OPENVSWITCH = 'openvswitch' +LABEL_REMOTE_STORAGE = 'remote-storage' # Label values LABEL_VALUE_ENABLED = 'enabled' diff --git a/sysinv/sysinv/sysinv/sysinv/helm/nova.py b/sysinv/sysinv/sysinv/sysinv/helm/nova.py index 2e9f2ddce0..4325c64cd5 100644 --- a/sysinv/sysinv/sysinv/sysinv/helm/nova.py +++ b/sysinv/sysinv/sysinv/sysinv/helm/nova.py @@ -78,7 +78,7 @@ class NovaHelm(openstack.OpenstackBaseHelm): }, 'conf': { 'ceph': { - 'enabled': False + 'enabled': True }, 'nova': { 'DEFAULT': { @@ -298,29 +298,18 @@ class NovaHelm(openstack.OpenstackBaseHelm): default_config.update({'shared_pcpu_map': shared_cpu_fmt}) def _update_host_storage(self, host, default_config, libvirt_config): - pvs = self.dbapi.ipv_get_by_ihost(host.id) + remote_storage = False + labels = self.dbapi.label_get_all(host.id) + for label in labels: + if (label.label_key == common.LABEL_REMOTE_STORAGE and + label.label_value == common.LABEL_VALUE_ENABLED): + remote_storage = True + break - instance_backing = constants.LVG_NOVA_BACKING_IMAGE - concurrent_disk_operations = constants.LVG_NOVA_PARAM_DISK_OPS_DEFAULT rbd_pool = constants.CEPH_POOL_EPHEMERAL_NAME rbd_ceph_conf = os.path.join(constants.CEPH_CONF_PATH, constants.SB_TYPE_CEPH_CONF_FILENAME) - nova_lvg_uuid = None - for pv in pvs: - if (pv.lvm_vg_name == constants.LVG_NOVA_LOCAL and - pv.pv_state != constants.PV_ERR): - nova_lvg_uuid = pv.ilvg_uuid - - if nova_lvg_uuid: - lvg = self.dbapi.ilvg_get(nova_lvg_uuid) - instance_backing = lvg.capabilities.get( - constants.LVG_NOVA_PARAM_BACKING) - concurrent_disk_operations = lvg.capabilities.get( - constants.LVG_NOVA_PARAM_DISK_OPS) - - default_config.update({'concurrent_disk_operations': concurrent_disk_operations}) - # If NOVA is a service on a ceph-external backend, use the ephemeral_pool # and ceph_conf file that are stored in that DB entry. # If NOVA is not on any ceph-external backend, it must be on the internal @@ -336,12 +325,12 @@ class NovaHelm(openstack.OpenstackBaseHelm): rbd_ceph_conf = \ constants.CEPH_CONF_PATH + os.path.basename(ceph_ext_obj.ceph_conf) - if instance_backing == constants.LVG_NOVA_BACKING_IMAGE: - libvirt_config.update({'images_type': 'default'}) - elif instance_backing == constants.LVG_NOVA_BACKING_REMOTE: + if remote_storage: libvirt_config.update({'images_type': 'rbd', 'images_rbd_pool': rbd_pool, 'images_rbd_ceph_conf': rbd_ceph_conf}) + else: + libvirt_config.update({'images_type': 'default'}) def _update_host_addresses(self, host, default_config, vnc_config, libvirt_config): interfaces = self.dbapi.iinterface_get_by_ihost(host.id)