juju_verify.verifiers.ceph module¶
ceph-osd verification.
- class juju_verify.verifiers.ceph.CephCommon(units: List[Unit], exclude_affected_units: Optional[List[Unit]] = None)¶
Bases:
BaseVerifierParent class for CephMon and CephOsd verifier.
- classmethod check_cluster_health(*units: Unit) Result¶
Check Ceph cluster health for specific units.
This will execute get-health against each unit provided.
- Raises:
CharmException – if the units do not belong to the ceph-mon charm
- classmethod get_ceph_pools(unit: Unit) List[PoolInfo]¶
Get detail about Ceph pools (name, type, min_size, replicated).
This function runs the list-pools action with the parameter ‘format=json’ to gather information about all pools. Pool types: 1 - replicated crush rule type is required to know how the data is replicated 2 - erasure (not supported yet) 3 - erasure-coded (not supported yet)
- Raises:
CharmException – if the unit does not belong to the ceph-mon charm
TypeError – if the object pools is not iterable
KeyError – if the key could not be obtained from the pool detail
VerificationError – if any pool is in not supported type
json.decoder.JSONDecodeError – if json.loads failed
- classmethod get_crush_rules(unit: Unit) Dict[int, CrushRuleInfo]¶
Get all crush rules in Ceph cluster.
- classmethod get_disk_utilization(unit: Unit) List[NodeInfo]¶
Get disk utilization as osd tree output.
- model: Model¶
- class juju_verify.verifiers.ceph.CephMon(units: List[Unit], exclude_affected_units: Optional[List[Unit]] = None)¶
Bases:
CephCommonImplementation of verification checks for the ceph-mon charm.
- NAME = 'ceph-mon'¶
- check_version() Result¶
Check minimum required version of Juju agent.
Ceph-mon verifier requires that all the units run juju agent >=2.8.10 due to reliance on juju.Machine.hostname feature.
- model: Model¶
- class juju_verify.verifiers.ceph.CephOsd(units: List[Unit], exclude_affected_units: Optional[List[Unit]] = None)¶
Bases:
CephCommonImplementation of verification checks for the ceph-osd charm.
- NAME = 'ceph-osd'¶
- REPLICATION_RULE = 'host'¶
- property ancestor_node_type: str¶
Get ancestor node type based on all crush rules used on pools.
If the replication rule is set to a host and the goal is to remove the host(s), then it is necessary to calculate free space for the entire root. Otherwise, if there is a replication rule between the chassis and the region, then it is necessary to check the free space on these nodes.
- property ceph_mon_app_map: Dict[str, Unit]¶
Get a map between ceph-osd applications and the first ceph-mon unit.
- Returns:
Dictionary with keys as distinct applications of verified units and values as the first ceph-mon unit obtained from the relation with the ceph-mon application (<application_name>:mon).
- property ceph_tree_map: Dict[str, CephTree]¶
Get a map between ceph-osd application and the Ceph tree.
- check_availability_zone() Result¶
Check availability zones resources.
This function checks whether the units can be reboot/shutdown without interrupting operation in the availability zone.
- check_ceph_cluster_health() Result¶
Check Ceph cluster health for unique ceph-mon units from ceph_mon_app_map.
- check_replication_number() Result¶
Check the minimum number of replications for related applications.
- model: Model¶
- property units_device_class_map: Dict[str, Dict[str, Set[Unit]]]¶
Get a map between ceph-osd units and osds device class.
Return dictionary contain three keys hdd, ssd and nvme and a set of units.
- class juju_verify.verifiers.ceph.CephTree(nodes: List[NodeInfo])¶
Bases:
objectCeph tree.
- SUPPORTED_ANCESTOR_TYPES = ['root', 'region', 'datacenter', 'room', 'pod', 'pdu', 'row', 'rack', 'chassis']¶
- can_remove_host_node(*names: str, required_ancestor_type: str = 'root') bool¶
Check if host node could be removed.
- find_ancestor(node: NodeInfo, required_type: str) Optional[NodeInfo]¶
Find ancestor with the desired type.
This function will recursively search for the parent node until the parent is of the desired type. Example: {“id”: -1, “name”: “root”, “children”: [-2, -3], …}, {“id”: -2, “name”: “rack.0”, “children”: [-4, -5], …}, {“id”: -4, “name”: “host.0”, “children”: [0, 1, 2], …}, {“id”: -5, “name”: “host.1”, “children”: [3, 4, 5], …}, … {“id”: -3, “name”: “rack.1”, “children”: [-6, -7], …}, …
The request is to find the root ancestor for the host.0. The first step is to find a parent who has id=-4 among its children, then check if it is root. The parent node found is of the rack type with id=-2, so the first step is repeated for this node until the parent node is of the root type.
- class juju_verify.verifiers.ceph.CrushRuleInfo(id: int, name: str, failure_domain: str, device_class: Optional[str] = None)¶
Bases:
tupleInformation about Node obtains from ceph osd dump.
- property device_class¶
Alias for field number 3
- property failure_domain¶
Alias for field number 2
- property id¶
Alias for field number 0
- property name¶
Alias for field number 1
- class juju_verify.verifiers.ceph.NodeInfo(id: int, name: str, type_id: int, type: str, kb: int, kb_used: int, kb_avail: int, children: Optional[List[int]] = None, device_class: Optional[str] = None)¶
Bases:
tupleInformation about Node obtains from ceph osd df tree.
The ceph df [1] comes from ceph-mon unit and it’s run with additional option tree to show output in Crush Map hierarchy format. The Crush Map hierarchy [2] contains the following types along with their IDs.
<type>: <type_id> root: 10 region: 9 datacenter: 8 room: 7 pod: 6 pdu: 5 row: 4 rack: 3 chassis: 2 host: 1 osd: 0
[1]: https://docs.ceph.com/en/latest/api/mon_command_api/#df [2]: https://docs.ceph.com/en/latest/rados/operations/crush-map/#types-and-buckets
- property children¶
Alias for field number 7
- property device_class¶
Alias for field number 8
- property id¶
Alias for field number 0
- property kb¶
Alias for field number 4
- property kb_avail¶
Alias for field number 6
- property kb_used¶
Alias for field number 5
- property name¶
Alias for field number 1
- property type¶
Alias for field number 3
- property type_id¶
Alias for field number 2
- class juju_verify.verifiers.ceph.PoolInfo(id: int, name: str, type: int, size: int, min_size: int, crush_rule: CrushRuleInfo, erasure_code_profile: str)¶
Bases:
tupleInformation about Node obtains from ceph osd dump.
- property crush_rule¶
Alias for field number 5
- property erasure_code_profile¶
Alias for field number 6
- property id¶
Alias for field number 0
- property min_size¶
Alias for field number 4
- property name¶
Alias for field number 1
- property size¶
Alias for field number 3
- property type¶
Alias for field number 2