'Test group can be deleted on another service in the cluster.'

@mock.patch('cinder.volume.driver.VolumeDriver.create_group', mock.Mock(return_value={'status': 'available'}))
@mock.patch('cinder.volume.driver.VolumeDriver.delete_group', return_value=({'status': 'deleted'}, []))
def test_delete_group_cluster(self, mock_del_grp):

    cluster_name = 'cluster@backend1'
    self.volume.host = 'host2@backend1'
    self.volume.cluster = cluster_name
    group = tests_utils.create_group(self.context, host=(CONF.host + 'fake'), cluster_name=cluster_name, availability_zone=CONF.storage_availability_zone, volume_type_ids=[fake.VOLUME_TYPE_ID], group_type_id=fake.GROUP_TYPE_ID)
    volume = tests_utils.create_volume(self.context, group_id=group.id, host='host1@backend1#pool1', cluster_name=cluster_name, status='creating', volume_type_id=fake.VOLUME_TYPE_ID, size=1)
    self.volume.host = 'host2@backend1'
    self.volume.create_volume(self.context, volume)
    self.volume.delete_group(self.context, group)
    grp = objects.Group.get_by_id(context.get_admin_context(read_deleted='yes'), group.id)
    self.assertEqual(fields.GroupStatus.DELETED, grp.status)
    self.assertRaises(exception.NotFound, objects.Group.get_by_id, self.context, group.id)
    self.assertTrue(mock_del_grp.called)
