'Test create snapshot from bootable volume.
But it fails to volume_glance_metadata_copy_to_snapshot.
As a result, status of snapshot is changed to ERROR.'

@mock.patch('cinder.image.image_utils.qemu_img_info')
def test_create_snapshot_from_bootable_volume_fail(self, mock_qemu_info):

    volume = self._create_volume_from_image()
    volume_id = volume['id']
    self.assertEqual('available', volume['status'])
    self.assertTrue(volume['bootable'])
    image_info = imageutils.QemuImgInfo()
    image_info.virtual_size = '1073741824'
    mock_qemu_info.return_value = image_info
    ctxt = context.get_admin_context()
    vol_glance_meta = db.volume_glance_metadata_get(ctxt, volume_id)
    self.assertTrue(vol_glance_meta)
    snap = create_snapshot(volume_id)
    self.assertEqual(36, len(snap.id))
    self.assertEqual('creating', snap.status)
    with mock.patch.object(db, 'volume_glance_metadata_copy_to_snapshot') as mock_db:
        mock_db.side_effect = exception.MetadataCopyFailure(reason='Because    of    DB    service    down.')
        self.assertRaises(exception.MetadataCopyFailure, self.volume.create_snapshot, ctxt, snap)
    self.assertRaises(exception.GlanceMetadataNotFound, db.volume_snapshot_glance_metadata_get, ctxt, snap.id)
    self.assertEqual(fields.SnapshotStatus.ERROR, snap.status)
    snap.destroy()
    db.volume_destroy(ctxt, volume_id)
