'Link or unlink a snapVx to or from a target storagegroup.
:param array: the array serial number
:param source_sg_id: the source device id
:param target_sg_id: the target device id
:param snap_name: the snapshot name
:param extra_specs: extra specifications
:param link: Flag to indicate action = Link
:param unlink: Flag to indicate action = Unlink'

def modify_storagegroup_snap(self, array, source_sg_id, target_sg_id, snap_name, extra_specs, link=False, unlink=False):

    payload = ''
    if link:
        payload = {'link': {'linkStorageGroupName': target_sg_id, 'copy': 'true'}, 'action': 'Link'}
    elif unlink:
        payload = {'unlink': {'unlinkStorageGroupName': target_sg_id}, 'action': 'Unlink'}
    resource_name = ('%(sg_name)s/snapshot/%(snap_id)s/generation/0' % {'sg_name': source_sg_id, 'snap_id': snap_name})
    (status_code, job) = self.modify_resource(array, REPLICATION, 'storagegroup', payload, resource_name=resource_name)
    self.wait_for_job('Modify    storagegroup    snapVx    relationship    to    target', status_code, job, extra_specs)
