Skip to content

Commit b6c83c4

Browse files
committed
remove replication_state and %, but added instead replication_states
1 parent f959bbe commit b6c83c4

File tree

2 files changed

+29
-12
lines changed

2 files changed

+29
-12
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88

99
## [Unreleased]
1010

11+
### Changed
12+
13+
- remove replication_state and done_percentage, but added instead replication_states
14+
1115
## [1.25.1] - 2025-04-02
1216

1317
### Fixed

linstor/responses.py

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1270,6 +1270,27 @@ def volume_groups(self):
12701270
return [VolumeGroup(x) for x in self._rest_data]
12711271

12721272

1273+
class ReplicationState(RESTMessageResponse):
1274+
def __init__(self, data):
1275+
super(ReplicationState, self).__init__(data)
1276+
1277+
@property
1278+
def replication_state(self):
1279+
"""
1280+
:return: String describing the drbd replication state
1281+
:rtype: str
1282+
"""
1283+
return self._rest_data.get("replication_state", "")
1284+
1285+
@property
1286+
def done_percentage(self):
1287+
"""
1288+
:return: decimal percentage of current verify/sync operation on drbd
1289+
:rtype: Optional[float]
1290+
"""
1291+
return self._rest_data.get("done_percentage")
1292+
1293+
12731294
class VolumeState(RESTMessageResponse):
12741295
def __init__(self, data):
12751296
super(VolumeState, self).__init__(data)
@@ -1292,20 +1313,12 @@ def disk_state(self):
12921313
return self._rest_data.get("disk_state")
12931314

12941315
@property
1295-
def replication_state(self):
1316+
def replication_states(self):
12961317
"""
1297-
:return: String describing the drbd replication state
1298-
:rtype: str
1318+
:return: dict with peers and their replication states
1319+
:rtype: dict[str, ReplicationState]
12991320
"""
1300-
return self._rest_data.get("replication_state", "")
1301-
1302-
@property
1303-
def done_percentage(self):
1304-
"""
1305-
:return: decimal percentage of current verify/sync operation on drbd
1306-
:rtype: Optional[float]
1307-
"""
1308-
return self._rest_data.get("done_percentage")
1321+
return {k: ReplicationState(v) for k, v in self._rest_data.get("replication_states", {}).items()}
13091322

13101323
@property
13111324
def data_v0(self):

0 commit comments

Comments
 (0)