From 63c78983c7c511797730b701d2125d7de174f3f2 Mon Sep 17 00:00:00 2001 From: Gabor Hernadi Date: Wed, 12 Oct 2022 14:57:16 +0200 Subject: [PATCH] SnapVlm: Add response object for state --- linstor-common | 2 +- linstor/responses.py | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/linstor-common b/linstor-common index 011f1a4..0c80b71 160000 --- a/linstor-common +++ b/linstor-common @@ -1 +1 @@ -Subproject commit 011f1a4840bee510bf7c501d20daef86ed9667d3 +Subproject commit 0c80b712547817be00529ef057aab4ad7f4b0086 diff --git a/linstor/responses.py b/linstor/responses.py index c1616a3..fc08640 100644 --- a/linstor/responses.py +++ b/linstor/responses.py @@ -1804,6 +1804,31 @@ def create_datetime(self): def uuid(self): return self._rest_data.get("uuid") + @property + def snapshot_volumes(self): + return [SnapshotVolume(x) for x in self._rest_data.get("snapshot_volumes", [])] + + +class SnapshotVolume(RESTMessageResponse): + def __init__(self, data): + super(SnapshotVolume, self).__init__(data) + + @property + def uuid(self): + return self._rest_data.get("uuid") + + @property + def vlm_nr(self): + return self._rest_data.get("vlm_nr") + + @property + def state(self): + return self._rest_data.get("state") + + @property + def properties(self): + return self._rest_data.get("props", {}) + class SnapshotDefinition(RESTMessageResponse): def __init__(self, data):