'Test the failure condition where all snap groups are allocated'

def test_create_snapshot_no_snapshot_groups_remaining(self):

    self.library._client.features = mock.Mock()
    expected_snap = copy.deepcopy(eseries_fake.SNAPSHOT_IMAGE)
    vol = copy.deepcopy(eseries_fake.VOLUME)
    snapshot_group = copy.deepcopy(eseries_fake.SNAPSHOT_GROUP)
    snap_vol = copy.deepcopy(eseries_fake.SNAPSHOT_VOLUME)
    grp_count = (self.library.MAX_SNAPSHOT_GROUP_COUNT - self.library.RESERVED_SNAPSHOT_GROUP_COUNT)
    fake_label = 'fakeName'
    self.mock_object(self.library, '_get_volume', return_value=vol)
    self.mock_object(self.library._client, 'create_snapshot_image', return_value=expected_snap)
    self.mock_object(self.library._client, 'create_snapshot_volume', return_value=snap_vol)
    self.mock_object(self.library, '_get_available_snapshot_group', return_value=None)
    self.mock_object(self.library, '_get_snapshot_groups_for_volume', return_value=([snapshot_group] * grp_count))
    self.mock_object(utils, 'convert_uuid_to_es_fmt', return_value=fake_label)
    fake_snapshot = copy.deepcopy(eseries_fake.FAKE_CINDER_SNAPSHOT)
    self.assertRaisesRegexp(exception.SnapshotLimitExceeded, str((self.library.MAX_SNAPSHOT_COUNT * grp_count)), self.library.create_snapshot, fake_snapshot)
