'Create a new cinder volume from a given snapshot of a lun.'

def test_create_volume_from_snapshot(self):

    object_id = '12345'
    vdev_id = 11111
    lun_info_response = {'subType': 'THICK', 'virtualDeviceID': vdev_id}
    response = {'success': True, 'object_id': object_id, 'msg': 'Copy    TimeMark    successfully.'}
    compressed_snap_id = 'abcdabcd1234abcd1234abcdeffedcbb'
    conf = {'lun.get_lun_info.return_value': lun_info_response, 'lun.copy_snapshot_to_new_lun.return_value': response}
    self.driver.vmem_mg = self.setup_mock_concerto(m_conf=conf)
    self.driver._compress_snapshot_id = mock.Mock(return_value=compressed_snap_id)
    self.driver._get_storage_pool = mock.Mock(return_value=DEFAULT_THICK_POOL)
    self.driver._wait_for_lun_or_snap_copy = mock.Mock()
    result = self.driver._create_volume_from_snapshot(SNAPSHOT, VOLUME)
    self.driver.vmem_mg.lun.copy_snapshot_to_new_lun.assert_called_with(source_lun=SNAPSHOT['volume_id'], source_snapshot_comment=compressed_snap_id, destination=VOLUME['id'], storage_pool_id=99)
    self.driver._wait_for_lun_or_snap_copy.assert_called_with(SNAPSHOT['volume_id'], dest_vdev_id=vdev_id)
    self.assertIsNone(result)
