Skip to content

Commit

Permalink
Merge pull request #125 from gboutry/fix/microceph-replicas
Browse files Browse the repository at this point in the history
Always use 3 replicas for ceph pools
  • Loading branch information
hemanthnakkina authored Feb 15, 2024
2 parents 45d1c70 + 4bacfc1 commit b48c640
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 31 deletions.
19 changes: 2 additions & 17 deletions sunbeam-python/sunbeam/commands/openstack.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,17 +117,6 @@ def compute_ingress_scale(topology: str, control_nodes: int) -> int:
return control_nodes


def compute_ceph_replica_scale(osds: int) -> int:
return min(osds, 3)


async def _get_number_of_osds(jhelper: JujuHelper) -> int:
"""Fetch the number of osds from the microceph application"""
leader = await jhelper.get_leader_unit(microceph.APPLICATION, microceph.MODEL)
osds, _ = await microceph.list_disks(jhelper, microceph.MODEL, leader)
return len(osds)


class DeployControlPlaneStep(BaseStep, JujuStepHelper):
"""Deploy OpenStack using Terraform cloud"""

Expand Down Expand Up @@ -159,9 +148,7 @@ def get_storage_tfvars(self) -> dict:
tfvars = {}
storage_nodes = self.client.cluster.list_nodes_by_role("storage")
if storage_nodes:
tfvars["ceph-osd-replication-count"] = compute_ceph_replica_scale(
run_sync(_get_number_of_osds(self.jhelper))
)
tfvars["ceph-osd-replication-count"] = 3
tfvars["enable-ceph"] = True
tfvars["ceph-offer-url"] = f"{CONTROLLER_MODEL}.{microceph.APPLICATION}"
else:
Expand Down Expand Up @@ -335,9 +322,7 @@ def run(self, status: Optional[Status] = None) -> Result:
"ingress-scale": compute_ingress_scale(topology, len(control_nodes)),
"enable-ceph": len(storage_nodes) > 0,
"ceph-offer-url": f"{CONTROLLER_MODEL}.{microceph.APPLICATION}",
"ceph-osd-replication-count": compute_ceph_replica_scale(
run_sync(_get_number_of_osds(self.jhelper))
),
"ceph-osd-replication-count": 3,
}

self.update_status(status, "scaling services")
Expand Down
14 changes: 0 additions & 14 deletions sunbeam-python/tests/unit/sunbeam/commands/test_openstack.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
PatchLoadBalancerServicesStep,
ReapplyOpenStackTerraformPlanStep,
ResizeControlPlaneStep,
compute_ceph_replica_scale,
compute_ha_scale,
compute_ingress_scale,
compute_os_api_scale,
Expand Down Expand Up @@ -413,19 +412,6 @@ def test_compute_ingress_scale(topology, control_nodes, scale):
assert compute_ingress_scale(topology, control_nodes) == scale


@pytest.mark.parametrize(
"osds,scale",
[
(1, 1),
(1, 1),
(9, 3),
(2, 2),
],
)
def test_compute_ceph_replica_scale(osds, scale):
assert compute_ceph_replica_scale(osds) == scale


class TestReapplyOpenStackTerraformPlanStep(unittest.TestCase):
def __init__(self, methodName: str = "runTest") -> None:
super().__init__(methodName)
Expand Down

0 comments on commit b48c640

Please sign in to comment.