Ejemplo n.º 1
0
    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()
        ])
Ejemplo n.º 2
0
 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())
Ejemplo n.º 3
0
 def cleanup(self):
     resource_manager.cleanup(
         names=["glance.images"],
         users=self.context.get("users", []),
         api_versions=self.context["config"].get("api_versions"),
         superclass=self.__class__,
         task_id=self.get_owner_id())
Ejemplo n.º 4
0
 def cleanup(self):
     manager.cleanup(
         names=self.config,
         admin_required=False,
         users=self.context.get("users", []),
         api_versions=self.context["config"].get("api_versions")
     )
Ejemplo n.º 5
0
 def cleanup(self):
     manager.cleanup(
         names=self.config,
         admin_required=True,
         admin=self.context["admin"],
         users=self.context.get("users", []),
         api_versions=self.context["config"].get("api_versions"))
Ejemplo n.º 6
0
    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()
        ])
Ejemplo n.º 7
0
 def cleanup(self):
     manager.cleanup(
         names=self.config,
         admin_required=False,
         users=self.context.get("users", []),
         api_versions=self.context["config"].get("api_versions"),
         task_id=self.context["task"]["uuid"])
Ejemplo n.º 8
0
 def cleanup(self):
     resource_manager.cleanup(
         names=["cinder.volumes"],
         users=self.context.get("users", []),
         api_versions=self.context["config"].get("api_versions"),
         superclass=cinder_utils.CinderScenario,
         task_id=self.context["task"]["uuid"])
Ejemplo n.º 9
0
 def cleanup(self):
     resources = ["data_sources"]
     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"])
Ejemplo n.º 10
0
    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())
Ejemplo n.º 11
0
    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()
        ])
Ejemplo n.º 12
0
    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", []))
Ejemplo n.º 13
0
    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()
        ])
Ejemplo n.º 14
0
 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())
Ejemplo n.º 15
0
 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())
Ejemplo n.º 16
0
    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"])
Ejemplo n.º 17
0
 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())
Ejemplo n.º 18
0
 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())
Ejemplo n.º 19
0
 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())
Ejemplo n.º 20
0
 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()
     )
Ejemplo n.º 21
0
 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())
    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", []))
Ejemplo n.º 23
0
    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", []))
 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())
Ejemplo n.º 25
0
 def cleanup(self):
     resource_manager.cleanup(
         names=["nova.keypairs"],
         users=self.context.get("users", []),
         superclass=nova_utils.NovaScenario,
         task_id=self.get_owner_id())
     resource_manager.cleanup(
         names=["magnum.cluster_templates"],
         users=self.context.get("users", []),
         superclass=magnum_utils.MagnumScenario,
         task_id=self.get_owner_id())
Ejemplo n.º 26
0
    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"])

        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"])
Ejemplo n.º 27
0
 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
Ejemplo n.º 28
0
 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
Ejemplo n.º 29
0
    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(),
            ]
        )
 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", []))
 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", []))
Ejemplo n.º 32
0
    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"], None),
            mock.call().exterminate(),
            mock.call(mock_find_resource_managers.return_value[1], "admin",
                      ["user"], None),
            mock.call().exterminate()
        ])
Ejemplo n.º 33
0
    def cleanup(self):
        if self.context.get("admin", {}):
            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())
Ejemplo n.º 34
0
 def cleanup(self):
     resource_manager.cleanup(names=["heat.stacks"],
                              users=self.context.get("users", []))
Ejemplo n.º 35
0
 def cleanup(self):
     resource_manager.cleanup(names=["murano.packages"],
                              users=self.context.get("users", []),
                              superclass=self.__class__,
                              task_id=self.get_owner_id())
Ejemplo n.º 36
0
 def cleanup(self):
     resource_manager.cleanup(
         names=["magnum.clusters", "nova.keypairs"],
         users=self.context.get("users", []),
         superclass=magnum_utils.MagnumScenario,
         task_id=self.get_owner_id())
Ejemplo n.º 37
0
 def cleanup(self):
     resource_manager.cleanup(
         names=["manila.shares"],
         users=self.context.get("users", []),
         superclass=manila_utils.ManilaScenario,
         task_id=self.get_owner_id())
Ejemplo n.º 38
0
 def cleanup(self):
     resource_manager.cleanup(names=["watcher.action_plan",
                                     "watcher.audit_template"],
                              admin=self.context.get("admin", []),
                              superclass=watcher_utils.WatcherScenario,
                              task_id=self.get_owner_id())
Ejemplo n.º 39
0
 def cleanup(self):
     resource_manager.cleanup(names=["designate.zones"],
                              users=self.context.get("users", []),
                              superclass=utils.DesignateScenario,
                              task_id=self.context["task"]["uuid"])
Ejemplo n.º 40
0
 def cleanup(self):
     resource_manager.cleanup(names=["heat.stacks"],
                              users=self.context.get("users", []),
                              superclass=heat_utils.HeatScenario,
                              task_id=self.get_owner_id())
Ejemplo n.º 41
0
 def cleanup(self):
     resource_manager.cleanup(
         names=["magnum.clusters"],
         users=self.context.get("users", []))
Ejemplo n.º 42
0
 def cleanup(self):
     resource_manager.cleanup(names=["nova.keypairs"],
                              users=self.context.get("users", []),
                              superclass=self.__class__,
                              task_id=self.get_owner_id())
Ejemplo n.º 43
0
 def cleanup(self):
     resource_manager.cleanup(
         names=["magnum.baymodels", "nova.keypairs"],
         users=self.context.get("users", []))
Ejemplo n.º 44
0
 def cleanup(self):
     resource_manager.cleanup(names=["neutron.router"],
                              users=self.context.get("users", []),
                              superclass=neutron_utils.NeutronScenario,
                              task_id=self.get_owner_id())
Ejemplo n.º 45
0
 def cleanup(self):
     resource_manager.cleanup(
         names=["watcher.action_plan", "watcher.audit_template"],
         admin=self.context.get("admin", []),
         superclass=watcher_utils.WatcherScenario,
         task_id=self.get_owner_id())
Ejemplo n.º 46
0
 def cleanup(self):
     # TODO(boris-42): Delete only resources created by this context
     resource_manager.cleanup(names=["cinder.volumes"],
                              users=self.context.get("users", []))
Ejemplo n.º 47
0
 def cleanup(self):
     resource_manager.cleanup(names=["ec2.servers"],
                              users=self.context.get("users", []))
Ejemplo n.º 48
0
 def cleanup(self):
     resource_manager.cleanup(names=["sahara.clusters"],
                              users=self.context.get("users", []),
                              superclass=utils.SaharaScenario,
                              task_id=self.get_owner_id())
Ejemplo n.º 49
0
 def cleanup(self):
     resource_manager.cleanup(names=["nova.servers"],
                              users=self.context.get("users", []))
Ejemplo n.º 50
0
    def cleanup(self):

        # TODO(boris-42): Delete only resources created by this context
        if self.context["sahara"]["need_image_cleanup"]:
            resource_manager.cleanup(names=["glance.images"],
                                     users=self.context.get("users", []))
Ejemplo n.º 51
0
 def cleanup(self):
     if self.context["sahara"]["need_image_cleanup"]:
         resource_manager.cleanup(names=["glance.images"],
                                  users=self.context.get("users", []),
                                  superclass=self.__class__,
                                  task_id=self.get_owner_id())
Ejemplo n.º 52
0
 def cleanup(self):
     resource_manager.cleanup(names=["murano.environments"],
                              users=self.context.get("users", []),
                              superclass=murano_utils.MuranoScenario,
                              task_id=self.get_owner_id())
Ejemplo n.º 53
0
 def cleanup(self):
     resource_manager.cleanup(names=["heat.stacks"],
                              users=self.context.get("users", []),
                              superclass=heat_utils.HeatScenario,
                              task_id=self.get_owner_id())
Ejemplo n.º 54
0
 def cleanup(self):
     resource_manager.cleanup(
         names=["neutron.router"],
         users=self.context.get("users", []),
         superclass=neutron_utils.NeutronScenario,
         task_id=self.get_owner_id())
Ejemplo n.º 55
0
 def cleanup(self):
     resource_manager.cleanup(names=["magnum.clusters"],
                              users=self.context.get("users", []))
Ejemplo n.º 56
0
 def cleanup(self):
     resource_manager.cleanup(names=["manila.security_services"],
                              users=self.context.get("users", []),
                              superclass=manila_utils.ManilaScenario,
                              task_id=self.get_owner_id())
Ejemplo n.º 57
0
 def cleanup(self):
     resource_manager.cleanup(names=["nova.servers"],
                              users=self.context.get("users", []),
                              superclass=nova_utils.NovaScenario,
                              task_id=self.get_owner_id())
Ejemplo n.º 58
0
 def cleanup(self):
     if self.context["sahara"]["need_image_cleanup"]:
         resource_manager.cleanup(names=["glance.images"],
                                  users=self.context.get("users", []),
                                  superclass=self.__class__,
                                  task_id=self.get_owner_id())