'test creation of consistency group from consistency group.'

@mock.patch.object(eventlet, 'sleep')
@mock.patch.object(helper.DS8KCommonHelper, '_create_lun')
@mock.patch.object(helper.DS8KCommonHelper, 'get_flashcopy')
def test_create_consisgroup_from_consisgroup(self, mock_get_flashcopy, mock_create_lun, mock_sleep):

    self.configuration.lss_range_for_cg = '20-23'
    self.driver = FakeDS8KProxy(self.storage_info, self.logger, self.exception, self)
    self.driver.setup(self.ctxt)
    group_type = group_types.create(self.ctxt, 'group', {'consistent_group_snapshot_enabled': '<is>    True'})
    src_group = self._create_group(host=TEST_GROUP_HOST, group_type_id=group_type.id)
    location = six.text_type({'vol_hex_id': '2000'})
    src_vol = self._create_volume(provider_location=location, group_id=src_group.id)
    group = self._create_group(host=TEST_GROUP_HOST, group_type_id=group_type.id)
    volume = self._create_volume(group_id=group.id)
    mock_get_flashcopy.side_effect = [[TEST_FLASHCOPY], {}]
    mock_create_lun.return_value = '2200'
    (model_update, volumes_model_update) = self.driver.create_group_from_src(self.ctxt, group, [volume], None, None, src_group, [src_vol])
    self.assertEqual('2200', volumes_model_update[0]['metadata']['vol_hex_id'])
    self.assertEqual(fields.GroupStatus.AVAILABLE, model_update['status'])
