@@ -48,12 +48,6 @@ def __init__(self, **kwargs):
4848 self .consistencygroups .resource_class = fakes .FakeResource (None , {})
4949 self .clusters = mock .Mock ()
5050 self .clusters .resource_class = fakes .FakeResource (None , {})
51- self .groups = mock .Mock ()
52- self .groups .resource_class = fakes .FakeResource (None , {})
53- self .group_snapshots = mock .Mock ()
54- self .group_snapshots .resource_class = fakes .FakeResource (None , {})
55- self .group_types = mock .Mock ()
56- self .group_types .resource_class = fakes .FakeResource (None , {})
5751 self .messages = mock .Mock ()
5852 self .messages .resource_class = fakes .FakeResource (None , {})
5953 self .qos_specs = mock .Mock ()
@@ -737,114 +731,6 @@ def create_one_sdk_volume(attrs=None):
737731 return _volume .Volume (** volume_info )
738732
739733
740- def create_one_volume_group (attrs = None ):
741- """Create a fake group.
742-
743- :param attrs: A dictionary with all attributes of group
744- :return: A FakeResource object with id, name, status, etc.
745- """
746- attrs = attrs or {}
747-
748- group_type = attrs .pop ('group_type' , None ) or uuid .uuid4 ().hex
749- volume_types = attrs .pop ('volume_types' , None ) or [uuid .uuid4 ().hex ]
750-
751- # Set default attribute
752- group_info = {
753- 'id' : uuid .uuid4 ().hex ,
754- 'status' : random .choice (
755- [
756- 'available' ,
757- ]
758- ),
759- 'availability_zone' : f'az-{ uuid .uuid4 ().hex } ' ,
760- 'created_at' : '2015-09-16T09:28:52.000000' ,
761- 'name' : 'first_group' ,
762- 'description' : f'description-{ uuid .uuid4 ().hex } ' ,
763- 'group_type' : group_type ,
764- 'volume_types' : volume_types ,
765- 'volumes' : [f'volume-{ uuid .uuid4 ().hex } ' ],
766- 'group_snapshot_id' : None ,
767- 'source_group_id' : None ,
768- 'project_id' : f'project-{ uuid .uuid4 ().hex } ' ,
769- }
770-
771- # Overwrite default attributes if there are some attributes set
772- group_info .update (attrs )
773-
774- group = fakes .FakeResource (None , group_info , loaded = True )
775- return group
776-
777-
778- def create_volume_groups (attrs = None , count = 2 ):
779- """Create multiple fake groups.
780-
781- :param attrs: A dictionary with all attributes of group
782- :param count: The number of groups to be faked
783- :return: A list of FakeResource objects
784- """
785- groups = []
786- for n in range (0 , count ):
787- groups .append (create_one_volume_group (attrs ))
788-
789- return groups
790-
791-
792- def create_one_volume_group_snapshot (attrs = None , methods = None ):
793- """Create a fake group snapshot.
794-
795- :param attrs: A dictionary with all attributes
796- :param methods: A dictionary with all methods
797- :return: A FakeResource object with id, name, description, etc.
798- """
799- attrs = attrs or {}
800-
801- # Set default attribute
802- group_snapshot_info = {
803- 'id' : uuid .uuid4 ().hex ,
804- 'name' : f'group-snapshot-{ uuid .uuid4 ().hex } ' ,
805- 'description' : f'description-{ uuid .uuid4 ().hex } ' ,
806- 'status' : random .choice (['available' ]),
807- 'group_id' : uuid .uuid4 ().hex ,
808- 'group_type_id' : uuid .uuid4 ().hex ,
809- 'project_id' : uuid .uuid4 ().hex ,
810- }
811-
812- # Overwrite default attributes if there are some attributes set
813- group_snapshot_info .update (attrs )
814-
815- group_snapshot = fakes .FakeResource (
816- None , group_snapshot_info , methods = methods , loaded = True
817- )
818- return group_snapshot
819-
820-
821- def create_one_volume_group_type (attrs = None , methods = None ):
822- """Create a fake group type.
823-
824- :param attrs: A dictionary with all attributes of group type
825- :param methods: A dictionary with all methods
826- :return: A FakeResource object with id, name, description, etc.
827- """
828- attrs = attrs or {}
829-
830- # Set default attribute
831- group_type_info = {
832- 'id' : uuid .uuid4 ().hex ,
833- 'name' : f'group-type-{ uuid .uuid4 ().hex } ' ,
834- 'description' : f'description-{ uuid .uuid4 ().hex } ' ,
835- 'is_public' : random .choice ([True , False ]),
836- 'group_specs' : {},
837- }
838-
839- # Overwrite default attributes if there are some attributes set
840- group_type_info .update (attrs )
841-
842- group_type = fakes .FakeResource (
843- None , group_type_info , methods = methods , loaded = True
844- )
845- return group_type
846-
847-
848734def create_one_volume_message (attrs = None ):
849735 """Create a fake message.
850736
0 commit comments