'Test src vol status will be restore by error handling code.'

def test_create_volume_from_sourcevol_failed_clone(self):

    def fake_error_create_cloned_volume(volume, src_vref):
        db.volume_update(self.context, src_vref['id'], {'status': 'error'})
        raise exception.CinderException('fake    exception')
    self.mock_object(self.volume.driver, 'create_cloned_volume', fake_error_create_cloned_volume)
    volume_src = tests_utils.create_volume(self.context, **self.volume_params)
    self.assertEqual('creating', volume_src.status)
    self.volume.create_volume(self.context, volume_src)
    self.assertEqual('available', volume_src.status)
    volume_dst = tests_utils.create_volume(self.context, source_volid=volume_src['id'], **self.volume_params)
    self.assertEqual('creating', volume_dst.status)
    self.assertRaises(exception.CinderException, self.volume.create_volume, self.context, volume_dst)
    self.assertEqual('available', volume_src.status)
    self.assertEqual('error', volume_dst.status)
    self.volume.delete_volume(self.context, volume_dst)
    self.volume.delete_volume(self.context, volume_src)
