Ejemplo n.º 1
0
    def run(self,
            description=None,
            is_public=True,
            update_name=False,
            update_description=None,
            update_is_public=None):
        """create a volume type, then update the type.

        :param description: Description of the volume type
        :param is_public: Volume type visibility
        :param update_name: if True, can update name by generating random name.
                            if False, don't update name.
        :param update_description: update Description of the volume type
        :param update_is_public: update Volume type visibility
        """
        service = cinder_v2.CinderV2Service(self._admin_clients,
                                            self.generate_random_name,
                                            atomic_inst=self.atomic_actions())

        volume_type = service.create_volume_type(description=description,
                                                 is_public=is_public)

        service.update_volume_type(
            volume_type,
            name=volume_type.name if not update_name else False,
            description=update_description,
            is_public=update_is_public)
Ejemplo n.º 2
0
 def setUp(self):
     super(CinderV2ServiceTestCase, self).setUp()
     self.clients = mock.MagicMock()
     self.cinder = self.clients.cinder.return_value
     self.name_generator = mock.MagicMock()
     self.service = cinder_v2.CinderV2Service(
         self.clients, name_generator=self.name_generator)
Ejemplo n.º 3
0
    def run(self, description=None, is_public=False):
        """Add and list volume type access for the given project.

        This scenario first creates a private volume type, then add project
        access and list project access to it.

        :param description: Description of the volume type
        :param is_public: Volume type visibility
        """
        service = cinder_v2.CinderV2Service(self._admin_clients,
                                            self.generate_random_name,
                                            atomic_inst=self.atomic_actions())
        volume_type = service.create_volume_type(description=description,
                                                 is_public=is_public)
        service.add_type_access(volume_type,
                                project=self.context["tenant"]["id"])
        service.list_type_access(volume_type)