Beispiel #1
0
    def test_volume_type_create_then_destroy(self):
        """Ensure volume types can be created and deleted"""
        prev_all_vtypes = volume_types.get_all_types(self.ctxt)

        volume_types.create(self.ctxt,
                            self.vol_type1_name,
                            self.vol_type1_specs)
        new = volume_types.get_volume_type_by_name(self.ctxt,
                                                   self.vol_type1_name)

        LOG.info(_("Given data: %s"), self.vol_type1_specs)
        LOG.info(_("Result data: %s"), new)

        for k, v in self.vol_type1_specs.iteritems():
            self.assertEqual(v, new['extra_specs'][k],
                             'one of fields doesnt match')

        new_all_vtypes = volume_types.get_all_types(self.ctxt)
        self.assertEqual(len(prev_all_vtypes) + 1,
                         len(new_all_vtypes),
                         'drive type was not created')

        volume_types.destroy(self.ctxt, self.vol_type1_name)
        new_all_vtypes = volume_types.get_all_types(self.ctxt)
        self.assertEqual(prev_all_vtypes,
                         new_all_vtypes,
                         'drive type was not deleted')
Beispiel #2
0
    def test_volume_type_create_then_destroy(self):
        """Ensure volume types can be created and deleted"""
        prev_all_vtypes = volume_types.get_all_types(self.ctxt)

        volume_types.create(self.ctxt, self.vol_type1_name,
                            self.vol_type1_specs)
        new = volume_types.get_volume_type_by_name(self.ctxt,
                                                   self.vol_type1_name)

        LOG.info(_("Given data: %s"), self.vol_type1_specs)
        LOG.info(_("Result data: %s"), new)

        for k, v in self.vol_type1_specs.iteritems():
            self.assertEqual(v, new['extra_specs'][k],
                             'one of fields doesnt match')

        new_all_vtypes = volume_types.get_all_types(self.ctxt)
        self.assertEqual(
            len(prev_all_vtypes) + 1, len(new_all_vtypes),
            'drive type was not created')

        volume_types.destroy(self.ctxt, self.vol_type1_name)
        new_all_vtypes = volume_types.get_all_types(self.ctxt)
        self.assertEqual(prev_all_vtypes, new_all_vtypes,
                         'drive type was not deleted')
Beispiel #3
0
    def test_volume_type_create_then_purge(self):
        """Ensure volume types can be created and deleted"""
        prev_all_vtypes = volume_types.get_all_types(self.ctxt, inactive=1)

        volume_types.create(self.ctxt,
                            self.vol_type1_name,
                            self.vol_type1_specs)
        new = volume_types.get_volume_type_by_name(self.ctxt,
                                                   self.vol_type1_name)

        for k, v in self.vol_type1_specs.iteritems():
            self.assertEqual(v, new['extra_specs'][k],
                             'one of fields doesnt match')

        new_all_vtypes = volume_types.get_all_types(self.ctxt, inactive=1)
        self.assertEqual(len(prev_all_vtypes) + 1,
                         len(new_all_vtypes),
                         'drive type was not created')

        volume_types.destroy(self.ctxt, self.vol_type1_name)
        new_all_vtypes2 = volume_types.get_all_types(self.ctxt, inactive=1)
        self.assertEqual(len(new_all_vtypes),
                         len(new_all_vtypes2),
                         'drive type was incorrectly deleted')

        volume_types.purge(self.ctxt, self.vol_type1_name)
        new_all_vtypes2 = volume_types.get_all_types(self.ctxt, inactive=1)
        self.assertEqual(len(new_all_vtypes) - 1,
                         len(new_all_vtypes2),
                         'drive type was not purged')
Beispiel #4
0
    def test_volume_type_create_then_purge(self):
        """Ensure volume types can be created and deleted"""
        prev_all_vtypes = volume_types.get_all_types(self.ctxt, inactive=1)

        volume_types.create(self.ctxt, self.vol_type1_name,
                            self.vol_type1_specs)
        new = volume_types.get_volume_type_by_name(self.ctxt,
                                                   self.vol_type1_name)

        for k, v in self.vol_type1_specs.iteritems():
            self.assertEqual(v, new['extra_specs'][k],
                             'one of fields doesnt match')

        new_all_vtypes = volume_types.get_all_types(self.ctxt, inactive=1)
        self.assertEqual(
            len(prev_all_vtypes) + 1, len(new_all_vtypes),
            'drive type was not created')

        volume_types.destroy(self.ctxt, self.vol_type1_name)
        new_all_vtypes2 = volume_types.get_all_types(self.ctxt, inactive=1)
        self.assertEqual(len(new_all_vtypes), len(new_all_vtypes2),
                         'drive type was incorrectly deleted')

        volume_types.purge(self.ctxt, self.vol_type1_name)
        new_all_vtypes2 = volume_types.get_all_types(self.ctxt, inactive=1)
        self.assertEqual(
            len(new_all_vtypes) - 1, len(new_all_vtypes2),
            'drive type was not purged')
Beispiel #5
0
 def test_repeated_vol_types_should_raise_api_error(self):
     """Ensures that volume duplicates raises ApiError"""
     new_name = self.vol_type1_name + "dup"
     volume_types.create(self.ctxt, new_name)
     volume_types.destroy(self.ctxt, new_name)
     self.assertRaises(exception.ApiError, volume_types.create, self.ctxt,
                       new_name)
Beispiel #6
0
 def test_repeated_vol_types_should_raise_api_error(self):
     """Ensures that volume duplicates raises ApiError"""
     new_name = self.vol_type1_name + "dup"
     volume_types.create(self.ctxt, new_name)
     volume_types.destroy(self.ctxt, new_name)
     self.assertRaises(
             exception.ApiError,
             volume_types.create, self.ctxt, new_name)
Beispiel #7
0
    def delete(self, req, id):
        """ Deletes an existing volume type """
        context = req.environ['nova.context']

        try:
            vol_type = volume_types.get_volume_type(context, id)
            volume_types.destroy(context, vol_type['name'])
        except exception.NotFound:
            raise exc.HTTPNotFound()
Beispiel #8
0
    def delete(self, req, id):
        """ Deletes an existing volume type """
        context = req.environ['nova.context']

        try:
            vol_type = volume_types.get_volume_type(context, id)
            volume_types.destroy(context, vol_type['name'])
        except exception.NotFound:
            raise exc.HTTPNotFound()
Beispiel #9
0
    def _delete(self, req, id):
        """ Deletes an existing volume type """
        context = req.environ['nova.context']
        authorize(context)

        try:
            vol_type = volume_types.get_volume_type(context, id)
            volume_types.destroy(context, vol_type['name'])
        except exception.NotFound:
            raise webob.exc.HTTPNotFound()

        return webob.Response(status_int=202)
Beispiel #10
0
    def _delete(self, req, id):
        """ Deletes an existing volume type """
        context = req.environ['nova.context']
        authorize(context)

        try:
            vol_type = volume_types.get_volume_type(context, id)
            volume_types.destroy(context, vol_type['name'])
        except exception.NotFound:
            raise webob.exc.HTTPNotFound()

        return webob.Response(status_int=202)
Beispiel #11
0
 def tearDown(self):
     for name in self.created_types_lst:
         volume_types.destroy(self.context.elevated(), name)
     super(VsaSchedulerTestCase, self).tearDown()
Beispiel #12
0
 def test_repeated_vol_types_shouldnt_raise(self):
     """Ensures that volume duplicates don't raise"""
     new_name = self.vol_type1_name + "dup"
     volume_types.create(self.ctxt, new_name)
     volume_types.destroy(self.ctxt, new_name)
     volume_types.create(self.ctxt, new_name)
Beispiel #13
0
 def tearDown(self):
     for name in self.created_types_lst:
         volume_types.destroy(self.context.elevated(), name)
     super(VsaSchedulerTestCase, self).tearDown()
Beispiel #14
0
 def test_repeated_vol_types_shouldnt_raise(self):
     """Ensures that volume duplicates don't raise"""
     new_name = self.vol_type1_name + "dup"
     volume_types.create(self.ctxt, new_name)
     volume_types.destroy(self.ctxt, new_name)
     volume_types.create(self.ctxt, new_name)