Пример #1
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')
Пример #2
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')
Пример #3
0
 def tearDown(self):
     for name in self.created_types_lst:
         volume_types.purge(self.context.elevated(), name)
     super(VsaSchedulerTestCase, self).tearDown()
Пример #4
0
 def tearDown(self):
     for name in self.created_types_lst:
         volume_types.purge(self.context, name)
     super(VsaSchedulerTestCase, self).tearDown()
Пример #5
0
    def tearDown(self):
        for name in self.created_types_lst:
            volume_types.purge(self.context, name)

        self.stubs.UnsetAll()
        super(VsaSchedulerTestCase, self).tearDown()