summaryrefslogtreecommitdiff
path: root/openstackclient/tests/unit/volume/v3/fakes.py
diff options
context:
space:
mode:
authorwhoami-rajat <rajatdhasmana@gmail.com>2023-02-04 00:51:47 +0530
committerwhoami-rajat <rajatdhasmana@gmail.com>2023-02-17 10:03:01 +0000
commit73b4ce88eb3e71568cf5330d6c0a8a4e92287d89 (patch)
tree037c09a3679f875d4ad851ee4af4479d60a2993c /openstackclient/tests/unit/volume/v3/fakes.py
parent2be359677908b81d9985917fd78f9c6897759fb9 (diff)
downloadpython-openstackclient-73b4ce88eb3e71568cf5330d6c0a8a4e92287d89.tar.gz
Add block storage manageable list commands
This patch adds the ``block storage volume manageable list`` and ``block storage snapshot manageable list`` commands that allow operators to list the volumes and snapshots on a particular host or cluster for management under OpenStack. Change-Id: I328dada5a0dc4e9e44c0d51db5cf3f224e27f88f
Diffstat (limited to 'openstackclient/tests/unit/volume/v3/fakes.py')
-rw-r--r--openstackclient/tests/unit/volume/v3/fakes.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/openstackclient/tests/unit/volume/v3/fakes.py b/openstackclient/tests/unit/volume/v3/fakes.py
index 7bde154e..62383580 100644
--- a/openstackclient/tests/unit/volume/v3/fakes.py
+++ b/openstackclient/tests/unit/volume/v3/fakes.py
@@ -487,3 +487,41 @@ def create_cleanup_records():
None, obj, loaded=True) for obj in unavailable_records]
return cleaning, unavailable
+
+
+def create_one_manage_record(attrs=None, snapshot=False):
+ manage_dict = {
+ 'reference': {'source-name': 'fake-volume'},
+ 'size': '1',
+ 'safe_to_manage': False,
+ 'reason_not_safe': 'already managed',
+ 'cinder_id': 'fake-volume',
+ 'extra_info': None,
+ }
+ if snapshot:
+ manage_dict['source_reference'] = {'source-name': 'fake-source'}
+
+ # Overwrite default attributes if there are some attributes set
+ attrs = attrs or {}
+
+ manage_dict.update(attrs)
+ manage_record = fakes.FakeResource(None, manage_dict, loaded=True)
+ return manage_record
+
+
+def create_volume_manage_list_records(count=2):
+ volume_manage_list = []
+ for i in range(count):
+ volume_manage_list.append(
+ create_one_manage_record({'size': str(i + 1)}))
+
+ return volume_manage_list
+
+
+def create_snapshot_manage_list_records(count=2):
+ snapshot_manage_list = []
+ for i in range(count):
+ snapshot_manage_list.append(
+ create_one_manage_record({'size': str(i + 1)}, snapshot=True))
+
+ return snapshot_manage_list