当前位置: 首页>>代码示例>>Python>>正文


Python manager.cleanup函数代码示例

本文整理汇总了Python中rally.plugins.openstack.cleanup.manager.cleanup函数的典型用法代码示例。如果您正苦于以下问题:Python cleanup函数的具体用法?Python cleanup怎么用?Python cleanup使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了cleanup函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: cleanup

    def cleanup(self):
        resources = ["job_binary_internals", "job_binaries"]

        # TODO(boris-42): Delete only resources created by this context
        resource_manager.cleanup(
            names=["sahara.%s" % res for res in resources],
            users=self.context.get("users", []))
开发者ID:GibeomOh,项目名称:rally,代码行数:7,代码来源:sahara_job_binaries.py

示例2: test_cleanup_with_api_versions

    def test_cleanup_with_api_versions(self,
                                       mock_find_resource_managers,
                                       mock_seek_and_destroy):
        manager.cleanup(names=["a", "b"], admin_required=True,
                        admin="admin", users=["user"],
                        api_versions={"cinder": {
                            "version": "1", "service_type": "volume"
                        }})

        mock_find_resource_managers.assert_called_once_with(["a", "b"], True)

        mock_seek_and_destroy.assert_has_calls([
            mock.call(
                mock_find_resource_managers.return_value[0], "admin",
                ["user"],
                {"cinder": {"service_type": "volume", "version": "1"}}
            ),
            mock.call().exterminate(),
            mock.call(
                mock_find_resource_managers.return_value[1], "admin",
                ["user"],
                {"cinder": {"service_type": "volume", "version": "1"}}
            ),
            mock.call().exterminate()
        ])
开发者ID:turmalinow,项目名称:rally,代码行数:25,代码来源:test_manager.py

示例3: test_cleanup_with_api_versions

    def test_cleanup_with_api_versions(self,
                                       mock_find_resource_managers,
                                       mock_seek_and_destroy,
                                       mock_itersubclasses):
        class A(utils.RandomNameGeneratorMixin):
            pass

        class B(object):
            pass

        mock_itersubclasses.return_value = [A, B]

        api_versions = {"cinder": {"version": "1", "service_type": "volume"}}
        manager.cleanup(names=["a", "b"], admin_required=True,
                        admin="admin", users=["user"],
                        api_versions=api_versions,
                        superclass=utils.RandomNameGeneratorMixin,
                        task_id="task_id")

        mock_find_resource_managers.assert_called_once_with(["a", "b"], True)

        mock_seek_and_destroy.assert_has_calls([
            mock.call(mock_find_resource_managers.return_value[0], "admin",
                      ["user"], api_versions=api_versions,
                      resource_classes=[A], task_id="task_id"),
            mock.call().exterminate(),
            mock.call(mock_find_resource_managers.return_value[1], "admin",
                      ["user"], api_versions=api_versions,
                      resource_classes=[A], task_id="task_id"),
            mock.call().exterminate()
        ])
开发者ID:andreykurilin,项目名称:rally,代码行数:31,代码来源:test_manager.py

示例4: cleanup

    def cleanup(self):
        if self.context.get("admin", {}):
            # NOTE(andreykurilin): Glance does not require the admin for
            #   listing tenant images, but the admin is required for
            #   discovering Cinder volumes which might be created for the
            #   purpose of caching. Removing such volumes are optional step,
            #   since Cinder should have own mechanism like garbage collector,
            #   but if we can, let's remove everything and make the cloud as
            #   close as possible to the original state.
            admin = self.context["admin"]
            admin_required = None
        else:
            admin = None
            admin_required = False

        if "image_name" in self.config:
            matcher = rutils.make_name_matcher(self.config["image_name"])
        else:
            matcher = self.__class__

        resource_manager.cleanup(names=["glance.images",
                                        "cinder.image_volumes_cache"],
                                 admin=admin,
                                 admin_required=admin_required,
                                 users=self.context.get("users", []),
                                 api_versions=self.context["config"].get(
                                     "api_versions"),
                                 superclass=matcher,
                                 task_id=self.get_owner_id())
开发者ID:jacobwagner,项目名称:rally,代码行数:29,代码来源:images.py

示例5: cleanup

 def cleanup(self):
     manager.cleanup(
         names=self.config,
         admin_required=False,
         users=self.context.get("users", []),
         api_versions=self.context["config"].get("api_versions")
     )
开发者ID:amit0701,项目名称:rally,代码行数:7,代码来源:__init__.py

示例6: cleanup

 def cleanup(self):
     resource_manager.cleanup(
         names=["cinder.volumes"],
         users=self.context.get("users", []),
         api_versions=self.context["config"].get("api_versions"),
         superclass=self.__class__,
         task_id=self.get_owner_id())
开发者ID:jacobwagner,项目名称:rally,代码行数:7,代码来源:volumes.py

示例7: cleanup

 def cleanup(self):
     mather = utils.make_name_matcher(*self.config)
     resource_manager.cleanup(
         names=["cinder.volume_types"],
         admin=self.context["admin"],
         api_versions=self.context["config"].get("api_versions"),
         superclass=mather,
         task_id=self.get_owner_id())
开发者ID:andreykurilin,项目名称:rally,代码行数:8,代码来源:volume_types.py

示例8: cleanup

    def cleanup(self):
        resources = ["job_binary_internals", "job_binaries"]

        resource_manager.cleanup(
            names=["sahara.%s" % res for res in resources],
            users=self.context.get("users", []),
            superclass=utils.SaharaScenario,
            task_id=self.context["task"]["uuid"])
开发者ID:andreykurilin,项目名称:rally,代码行数:8,代码来源:sahara_job_binaries.py

示例9: cleanup

 def cleanup(self):
     """Delete created flavors."""
     mather = rutils.make_name_matcher(*[f["name"] for f in self.config])
     resource_manager.cleanup(
         names=["nova.flavors"],
         admin=self.context["admin"],
         api_versions=self.context["config"].get("api_versions"),
         superclass=mather,
         task_id=self.get_owner_id())
开发者ID:andreykurilin,项目名称:rally,代码行数:9,代码来源:flavors.py

示例10: cleanup

 def cleanup(self):
     manager.cleanup(
         names=self.config,
         admin_required=False,
         users=self.context.get("users", []),
         api_versions=self.context["config"].get("api_versions"),
         superclass=scenario.OpenStackScenario,
         task_id=self.get_owner_id()
     )
开发者ID:andreykurilin,项目名称:rally,代码行数:9,代码来源:user.py

示例11: cleanup

    def cleanup(self):
        resources = ["data_sources"]
        for swift_object in self.context["sahara"]["swift_objects"]:
            res_cleanup.SwiftObject(resource=swift_object[1])
        res_cleanup.SwiftContainer(
            resource=self.context["sahara"]["container_name"])

        # TODO(boris-42): Delete only resources created by this context
        resource_manager.cleanup(
            names=["sahara.%s" % res for res in resources],
            users=self.context.get("users", []))
开发者ID:GibeomOh,项目名称:rally,代码行数:11,代码来源:sahara_input_data_sources.py

示例12: cleanup

 def cleanup(self):
     resource_manager.cleanup(
         names=["swift.object", "swift.container"],
         users=self.context.get("users", []),
         superclass=swift_utils.SwiftScenario,
         task_id=self.get_owner_id())
     resource_manager.cleanup(
         names=["sahara.data_sources"],
         users=self.context.get("users", []),
         superclass=self.__class__,
         task_id=self.get_owner_id())
开发者ID:andreykurilin,项目名称:rally,代码行数:11,代码来源:sahara_input_data_sources.py

示例13: test_cleanup

    def test_cleanup(self, mock_find_resource_managers, mock_seek_and_destroy):
        manager.cleanup(names=["a", "b"], admin_required=True, admin="admin", users=["user"])

        mock_find_resource_managers.assert_called_once_with(["a", "b"], True)

        mock_seek_and_destroy.assert_has_calls(
            [
                mock.call(mock_find_resource_managers.return_value[0], "admin", ["user"]),
                mock.call().exterminate(),
                mock.call(mock_find_resource_managers.return_value[1], "admin", ["user"]),
                mock.call().exterminate(),
            ]
        )
开发者ID:rjain-iitr,项目名称:rally,代码行数:13,代码来源:test_manager.py

示例14: cleanup

 def cleanup(self):
     if (not self.context["config"].get("existing_users") or
             self.config["use_share_networks"]):
         resource_manager.cleanup(
             names=["manila.share_networks"],
             users=self.context.get("users", []),
             superclass=self.__class__,
             api_versions=self.context["config"].get("api_versions"),
             task_id=self.get_owner_id())
     else:
         # NOTE(vponomaryov): assume that share networks were not created
         # by test run.
         return
开发者ID:jacobwagner,项目名称:rally,代码行数:13,代码来源:manila_share_networks.py

示例15: cleanup

 def cleanup(self):
     for user, tenant_id in rutils.iterate_per_tenants(
             self.context["users"]):
         if self.context["tenants"][tenant_id].get(
                 "sahara", {}).get("container", {}).get("name") is not None:
             for swift_object in (
                 self.context["tenants"][tenant_id]["sahara"]["container"][
                     "output_swift_objects"]):
                 res_cleanup.SwiftObject(swift_object[1])
         res_cleanup.SwiftContainer(
             self.context["tenants"][tenant_id].get(
                 "sahara", {}).get("container", {}).get("name"))
     resources = ["data_sources"]
     resource_manager.cleanup(
         names=["sahara.%s" % res for res in resources],
         users=self.context.get("users", []))
开发者ID:NaliniKrishna,项目名称:Rally,代码行数:16,代码来源:sahara_output_data_sources.py


注:本文中的rally.plugins.openstack.cleanup.manager.cleanup函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。