Exemplo n.º 1
0
    def test_create_flavor_all_settings(self):
        """
        Tests the creation of an OpenStack Flavor, the deletion, then
        cleanup to ensure clean() does not
        raise any exceptions.
        """
        # Create Flavor
        if self.flavor_metadata:
            self.flavor_metadata.update(create_flavor.MEM_PAGE_SIZE_ANY)
        flavor_settings = openstack_tests.get_flavor_config(
            name=self.flavor_name,
            ram=1,
            disk=1,
            vcpus=1,
            ephemeral=2,
            swap=3,
            rxtx_factor=2.2,
            is_public=False,
            metadata=self.flavor_metadata)
        self.flavor_creator = OpenStackFlavor(self.os_creds, flavor_settings)
        flavor = self.flavor_creator.create()
        self.assertTrue(validate_flavor(self.nova, flavor_settings, flavor))

        # Delete Flavor
        nova_utils.delete_flavor(self.nova, flavor)
        self.assertIsNone(
            nova_utils.get_flavor_by_name(self.nova, flavor_settings.name))

        # Attempt to cleanup
        self.flavor_creator.clean()

        self.assertIsNone(self.flavor_creator.get_flavor())
Exemplo n.º 2
0
 def test_create_delete_flavor(self):
     """
     Tests the creation of an OpenStack keypair that does not exist.
     """
     self.flavor = nova_utils.create_flavor(self.nova, self.flavor_settings)
     self.validate_flavor()
     nova_utils.delete_flavor(self.nova, self.flavor)
     flavor = nova_utils.get_flavor_by_name(self.nova,
                                            self.flavor_settings.name)
     self.assertIsNone(flavor)
Exemplo n.º 3
0
    def tearDown(self):
        """
        Cleans the image and downloaded image file
        """
        if self.flavor:
            try:
                nova_utils.delete_flavor(self.nova, self.flavor)
            except:
                pass

        super(self.__class__, self).__clean__()
Exemplo n.º 4
0
    def clean(self):
        """
        Cleanse environment of all artifacts
        :return: void
        """
        if self.__flavor:
            try:
                nova_utils.delete_flavor(self._nova, self.__flavor)
            except NotFound:
                pass

            self.__flavor = None

        super(self.__class__, self).clean()
Exemplo n.º 5
0
    def test_create_delete_flavor(self):
        """
        Tests the creation of an OpenStack Flavor, the deletion, then
        cleanup to ensure clean() does not
        raise any exceptions.
        """
        # Create Flavor
        flavor_settings = FlavorConfig(name=self.flavor_name,
                                       ram=1,
                                       disk=1,
                                       vcpus=1)
        self.flavor_creator = OpenStackFlavor(self.os_creds, flavor_settings)
        flavor = self.flavor_creator.create()
        self.assertTrue(validate_flavor(self.nova, flavor_settings, flavor))

        # Delete Flavor
        nova_utils.delete_flavor(self.nova, flavor)
        self.assertIsNone(
            nova_utils.get_flavor_by_name(self.nova, flavor_settings.name))

        # Attempt to cleanup
        self.flavor_creator.clean()

        self.assertIsNone(self.flavor_creator.get_flavor())