Exemplo n.º 1
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())
Exemplo n.º 2
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"],
                              superclass=mather,
                              task_id=self.get_owner_id())
Exemplo n.º 3
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())
Exemplo n.º 4
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())
Exemplo n.º 5
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())
Exemplo n.º 6
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())
Exemplo n.º 7
0
 def test_make_name_matcher(self):
     matcher = utils.make_name_matcher("foo", "bar")
     self.assertTrue(matcher.name_matches_object("foo", task_id="task"))
     self.assertTrue(matcher.name_matches_object("bar", task_id="task"))
     self.assertFalse(matcher.name_matches_object("foo1", task_id="task"))
Exemplo n.º 8
0
 def test_make_name_matcher(self):
     matcher = utils.make_name_matcher("foo", "bar")
     self.assertTrue(matcher.name_matches_object("foo", task_id="task"))
     self.assertTrue(matcher.name_matches_object("bar", task_id="task"))
     self.assertFalse(matcher.name_matches_object("foo1", task_id="task"))