'Rebuild if instance exists raises an exception.'

def test_rebuild_on_host_instance_exists(self):

    db.instance_update(self.context, self.inst.uuid, {'task_state': task_states.SCHEDULING})
    self.compute.build_and_run_instance(self.context, self.inst, {}, {}, {}, block_device_mapping=[])
    self.stub_out('nova.virt.fake.FakeDriver.instance_on_disk', (lambda *a, **kw: True))
    self.assertRaises(exception.InstanceExists, (lambda : self._rebuild(on_shared_storage=True)))
