class CephReport(ConvBase): @dataclass class PoolsSum(ConvBase): stat_sum: CephIOStats acting: int log_size: int ondisk_log_size: int up: int @dataclass class PGOnOSD(ConvBase): osd: int num_primary_pg: int num_acting_pg: int num_up_pg: int quorum: List[int] monmap_first_committed: int monmap_last_committed: int cluster_fingerprint: str commit: str timestamp: DateTime tag: str health: CephStatus.Health osd_metadata: List[OSDMetadata] monmap: CephStatus.MonMap crushmap: CrushMap osdmap_first_committed: int osdmap_last_committed: int mdsmap_first_committed: int mdsmap_last_committed: int num_pg: int num_pg_active: int num_pg_unknown: int num_osd: int pool_sum: PoolsSum pool_stats: List[PoolStatSum] num_pg_by_osd: List[PGOnOSD] osdmap: OSDMap osd_sum: OSDStat auth: Dict[str, Any] fsmap: Dict[str, Any] osd_stats: List[Dict[str, Any]] paxos: Dict[str, Any] version: CephVersion = field(converter=parse_ceph_version_simple) num_pg_by_state: List[Tuple[Set[PGState], int]] = field(noauto=True) @classmethod def convert(cls: Type[T], v: Dict[str, Any]) -> T: obj = super().convert(v) num_pg_by_state = [] for st in v['num_pg_by_state']: states = {PGState[name] for name in st['state'].split("+")} num_pg_by_state.append((states, int(st["num"]))) obj.num_pg_by_state = num_pg_by_state return obj
class LVMListDevice(ConvBase): devices: List[Path] lv_name: str lv_path: Path lv_uuid: str name: str path: Path tags: Dict[str, Any] type: str vg_name: str lv_size: int = field(converter=from_ceph_str_size) lv_tags: Dict[str, str] = field(converter=lvtags_parser)
class BlueFSDev(ConvBase): access_mode: str dev_node: str driver: str model: str partition_path: Path size: ToInt block_size: ToInt # size: int = field(converter=int) # block_size: int = field(converter=int) type: DiskType = field(converter=from_disk_short_type) dev: Tuple[int, int] = field(converter=lambda v: tuple(map(int, v.split(":")))) rotational: bool = field(converter=lambda v: v == '1')
class OSDMapPool(ConvBase): pool: int pool_name: str flags: int flags_names: str type: int size: int min_size: int crush_rule: int object_hash: int pg_num: int pg_placement_num: int crash_replay_interval: int auid: int snap_mode: str snap_seq: int snap_epoch: int pool_snaps: List[Any] removed_snaps: str quota_max_bytes: int quota_max_objects: int tiers: List[Any] tier_of: int read_tier: int write_tier: int cache_mode: str target_max_bytes: int target_max_objects: int cache_target_dirty_ratio_micro: int cache_target_dirty_high_ratio_micro: int cache_target_full_ratio_micro: int cache_min_flush_age: int cache_min_evict_age: int erasure_code_profile: str hit_set_params: Dict[str, Any] hit_set_period: int hit_set_count: int use_gmt_hitset: bool min_read_recency_for_promote: int min_write_recency_for_promote: int hit_set_grade_decay_rate: int hit_set_search_last_n: int grade_table: List[Any] stripe_width: int expected_num_objects: int fast_read: bool options: Dict[str, Any] application_metadata: Dict[str, Any] last_change: int = field(converter=int) last_force_op_resend: int = field(converter=int) last_force_op_resend_preluminous: int = field(converter=int)
class Health(ConvBase): @dataclass class Check(ConvBase): severity: CephStatusCode summary: str checks: Dict[str, Any] status: CephStatusCode summary: List[Check] = field(default_factory=list) overall_status: Optional[CephStatusCode] = field(default=None) def __post_init__(self) -> None: if self.overall_status is None: self.overall_status = self.status
class Rule(ConvBase): rule_id: int rule_name: str ruleset: int type: int min_size: int max_size: int steps: List[CrushRuleStep] = field(converter=crush_rule_step)
class OSD(ConvBase): osd: int uuid: str weight: float primary_affinity: float last_clean_begin: int last_clean_end: int up_from: int up_thru: int down_at: int lost_at: int public_addr: EndpointAddr cluster_addr: EndpointAddr heartbeat_back_addr: EndpointAddr heartbeat_front_addr: EndpointAddr state: Set[OSDState] = field(converter=lambda v: {OSDState[name] for name in v}) in_: bool = field(key='in', converter=lambda x: x == 1) up: bool = field(converter=lambda x: x == 1)
class BlueStoreDevices(ConvBase): db: BlueFSDev = field(noauto=True) wal: BlueFSDev = field(noauto=True) data: BlueFSDev = field(noauto=True) @classmethod def convert(cls: Type[T], v: Dict[str, Any]) -> T: obj = cls() attrs = {} for name in BlueFSDev.__annotations__: attrs[name] = v[f"bluefs_db_{name}"] obj.db = BlueFSDev.convert(attrs) obj.wal = obj.db attrs = {} for name in BlueFSDev.__annotations__: attrs[name] = v[f"bluestore_bdev_{name}"] obj.data = BlueFSDev.convert(attrs) return obj
class OSDMap(ConvBase): @dataclass class OSD(ConvBase): osd: int uuid: str weight: float primary_affinity: float last_clean_begin: int last_clean_end: int up_from: int up_thru: int down_at: int lost_at: int public_addr: EndpointAddr cluster_addr: EndpointAddr heartbeat_back_addr: EndpointAddr heartbeat_front_addr: EndpointAddr state: Set[OSDState] = field(converter=lambda v: {OSDState[name] for name in v}) in_: bool = field(key='in', converter=lambda x: x == 1) up: bool = field(converter=lambda x: x == 1) @dataclass class OSDXInfo(ConvBase): osd: int down_stamp: Union[DateTime, ToFloat] laggy_probability: float laggy_interval: int features: int old_weight: float epoch: int fsid: str created: DateTime modified: DateTime crush_version: int full_ratio: float backfillfull_ratio: float nearfull_ratio: float cluster_snapshot: str pool_max: int max_osd: int require_min_compat_client: CephRelease min_compat_client: CephRelease require_osd_release: CephRelease pools: List[OSDMapPool] osds: List[OSD] osd_xinfo: List[OSDXInfo] pg_upmap: List[Any] pg_upmap_items: List[Any] pg_temp: List[Any] primary_temp: List[Any] blacklist: Dict[str, Any] erasure_code_profiles: Dict[str, Any] flags: List[str] = field(converter=lambda v: v.split(","))
class Bucket(ConvBase): @dataclass class Item(ConvBase): id: int pos: int weight: float = field(converter=lambda v: float(v) / 65536.) id: int name: str type_id: int type_name: str alg: Optional[CrushAlg] hash: Optional[HashAlg] items: List[Item] class_name: Optional[str] = field(default=None) weight: float = field(converter=lambda v: float(v) / 65536.) @property def is_osd(self) -> bool: return self.id >= 0
class OSDStat(ConvBase): up_from: int seq: int num_pgs: int kb: int kb_used: int kb_avail: int hb_peers: List[int] snap_trim_queue_len: int num_snap_trimming: int op_queue_age_hist: Dict[str, Any] perf_stat: Dict[str, Any] osd: Optional[int] = field(default=None)
class CrushMap(ConvBase): @dataclass class Device(ConvBase): id: int name: str class_name: Optional[str] = field(key='class') @dataclass class Bucket(ConvBase): @dataclass class Item(ConvBase): id: int pos: int weight: float = field(converter=lambda v: float(v) / 65536.) id: int name: str type_id: int type_name: str alg: Optional[CrushAlg] hash: Optional[HashAlg] items: List[Item] class_name: Optional[str] = field(default=None) weight: float = field(converter=lambda v: float(v) / 65536.) @property def is_osd(self) -> bool: return self.id >= 0 @dataclass class Rule(ConvBase): rule_id: int rule_name: str ruleset: int type: int min_size: int max_size: int steps: List[CrushRuleStep] = field(converter=crush_rule_step) devices: List[Device] buckets: List[Bucket] rules: List[Rule] tunables: Dict[str, Any] choose_args: Dict[str, Any] types: Dict[str, int] = field(converter=lambda v: {itm["name"]: itm["type_id"] for itm in v})
class PGStat(ConvBase): acting: List[int] acting_primary: int blocked_by: List[int] created: int dirty_stats_invalid: bool hitset_bytes_stats_invalid: bool hitset_stats_invalid: bool last_active: DateTime last_became_active: DateTime last_became_peered: DateTime last_change: DateTime last_clean: DateTime last_clean_scrub_stamp: DateTime last_deep_scrub: str last_deep_scrub_stamp: DateTime last_epoch_clean: int last_fresh: DateTime last_fullsized: DateTime last_peered: DateTime last_scrub: str last_scrub_stamp: DateTime last_undegraded: DateTime last_unstale: DateTime log_size: int log_start: str mapping_epoch: int omap_stats_invalid: bool ondisk_log_size: int ondisk_log_start: str parent: str parent_split_bits: int pgid: PGId pin_stats_invalid: bool reported_epoch: ToInt reported_seq: ToInt stats_invalid: bool up: List[int] up_primary: int version: str stat_sum: CephIOStats state: Set[PGState] = field(converter=convert_state)
class PgMap(ConvBase): bytes_avail: int bytes_total: int bytes_used: int data_bytes: int num_objects: int num_pgs: int num_pools: int pgs_by_state: List[Dict[str, Any]] read_op_per_sec: int = field(default=0) read_bytes_per_sec: int = field(default=0) write_op_per_sec: int = field(default=0) write_bytes_sec: int = field(default=0) recovering_bytes_per_sec: int = field(default=0) recovering_objects_per_sec: int = field(default=0)
class OSDMetadata(ConvBase): id: int arch: str back_addr: EndpointAddr back_iface: str ceph_version: CephVersion cpu: str default_device_class: str distro: str distro_description: str distro_version: str front_addr: EndpointAddr front_iface: str hb_back_addr: EndpointAddr hb_front_addr: EndpointAddr hostname: str kernel_description: str kernel_version: str os: str osd_data: Path osd_objectstore: OSDStoreType bluefs_single_shared_device: bool = field(converter=lambda v: v == '1') bluefs: bool = field(converter=lambda v: v == '1') rotational: bool = field(converter=lambda v: v == '1') journal_rotational: bool = field(converter=lambda v: v == '1') mem_swap_kb: int = field(converter=int) mem_total_kb: int = field(converter=int) bs_info: Optional[BlueStoreDevices] = field(noauto=True) @classmethod def convert(cls: Type[T], v: Dict[str, Any]) -> T: obj = cast(OSDMetadata, super().convert(v)) if obj.bluefs: obj.bs_info = BlueStoreDevices.convert(v) return obj
class Item(ConvBase): id: int pos: int weight: float = field(converter=lambda v: float(v) / 65536.)
class Device(ConvBase): id: int name: str class_name: Optional[str] = field(key='class')