本文整理汇总了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", []))
示例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()
])
示例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()
])
示例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())
示例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")
)
示例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())
示例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())
示例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"])
示例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())
示例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()
)
示例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", []))
示例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())
示例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(),
]
)
示例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
示例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", []))