예제 #1
0
    def tearDown(self):
        try:
            if self._instance_data and self._hypervutils.vm_exists(
                    self._instance_data["name"]):
                self._hypervutils.remove_vm(self._instance_data["name"])

            if self._dest_server and \
                    self._hypervutils.remote_vm_exists(self._dest_server,
                        self._instance_data["name"]):
                self._hypervutils.remove_remote_vm(self._dest_server,
                                                   self._instance_data["name"])

            self._hypervutils.logout_iscsi_volume_sessions(self._volume_id)

            shutil.rmtree(CONF.instances_path, True)

            fake_image.FakeImageService_reset()
        finally:
            super(HyperVAPITestCase, self).tearDown()
예제 #2
0
 def tearDown(self):
     fake_image.FakeImageService_reset()
     self._teardown_fakelibvirt()
     super(_FakeDriverBackendTestCase, self).tearDown()
예제 #3
0
 def tearDown(self):
     self.volume_api.reset_fake_api(self.context)
     super(CinderCloudTestCase, self).tearDown()
     fake.FakeImageService_reset()
예제 #4
0
class CinderCloudTestCase(test.TestCase):
    def setUp(self):
        super(CinderCloudTestCase, self).setUp()
        vol_tmpdir = tempfile.mkdtemp()
        self.flags(compute_driver='nova.virt.fake.FakeDriver',
                   volume_api_class='nova.tests.fake_volume.API',
                   volumes_dir=vol_tmpdir)

        def fake_show(meh, context, id):
            return {'id': id,
                    'name': 'fake_name',
                    'container_format': 'ami',
                    'properties': {
                        'kernel_id': 'cedef40a-ed67-4d10-800e-17455edce175',
                        'ramdisk_id': 'cedef40a-ed67-4d10-800e-17455edce175',
                        'type': 'machine',
                        'image_state': 'available'}}

        def fake_detail(_self, context, **kwargs):
            image = fake_show(None, context, None)
            image['name'] = kwargs.get('filters', {}).get('name')
            return [image]

        self.stubs.Set(fake._FakeImageService, 'show', fake_show)
        self.stubs.Set(fake._FakeImageService, 'detail', fake_detail)
        fake.stub_out_image_service(self.stubs)

        def dumb(*args, **kwargs):
            pass

        self.stubs.Set(compute_utils, 'notify_about_instance_usage', dumb)
        fake_network.set_stub_network_methods(self.stubs)

        # set up our cloud
        self.cloud = cloud.CloudController()
        self.flags(compute_scheduler_driver='nova.scheduler.'
                'chance.ChanceScheduler')

        # set up services
        self.compute = self.start_service('compute')
        self.scheduler = self.start_service('scheduler')
        self.network = self.start_service('network')
        self.volume = self.start_service('volume')

        self.user_id = 'fake'
        self.project_id = 'fake'
        self.context = context.RequestContext(self.user_id,
                                              self.project_id,
                                              is_admin=True)
        self.volume_api = volume.API()

        # NOTE(comstud): Make 'cast' behave like a 'call' which will
        # ensure that operations complete
        self.stubs.Set(rpc, 'cast', rpc.call)

        # make sure we can map ami-00000001/2 to a uuid in FakeImageService
        db.api.s3_image_create(self.context,
                               'cedef40a-ed67-4d10-800e-17455edce175')
        db.api.s3_image_create(self.context,
                               '76fa36fc-c930-4bf3-8c8a-ea2a2420deb6')

    def tearDown(self):
        try:
            shutil.rmtree(FLAGS.volumes_dir)
        except OSError, e:
            pass
        self.volume_api.reset_fake_api(self.context)
        super(CinderCloudTestCase, self).tearDown()
        fake.FakeImageService_reset()
예제 #5
0
 def tearDown(self):
     super(TestS3ImageService, self).tearDown()
     fake.FakeImageService_reset()
예제 #6
0
 def tearDown(self):
     super(EC2ValidateTestCase, self).tearDown()
     fake.FakeImageService_reset()
예제 #7
0
 def tearDown(self):
     super(BaremetalDriverTestCase, self).tearDown()
     fake_image.FakeImageService_reset()