'Remove a volume from a storage group.
:param serial_number: the array serial number
:param device_id: the volume device id
:param vol_name: the volume name
:param storagegroup_name: the storage group name
:param extra_specs: the extra specifications
:param connector: the connector object
:param move: flag to indicate if move should be used instead of remove'

def remove_volume_from_sg(self, serial_number, device_id, vol_name, storagegroup_name, extra_specs, connector=None, move=False):

    masking_list = self.rest.get_masking_views_from_storage_group(serial_number, storagegroup_name)
    if (not masking_list):
        LOG.debug('No    masking    views    associated    with    storage    group    %(sg_name)s', {'sg_name': storagegroup_name})
        @coordination.synchronized('emc-sg-{sg_name}')
        def do_remove_volume_from_sg(sg_name):
            if self.rest.is_volume_in_storagegroup(serial_number, device_id, sg_name):
                num_vol_in_sg = self.rest.get_num_vols_in_sg(serial_number, sg_name)
                LOG.debug('There    are    %(num_vol)d    volumes    in    the    storage    group    %(sg_name)s.', {'num_vol': num_vol_in_sg, 'sg_name': sg_name})
                if (num_vol_in_sg == 1):
                    self._last_vol_in_sg(serial_number, device_id, vol_name, sg_name, extra_specs, move)
                else:
                    self._multiple_vols_in_sg(serial_number, device_id, sg_name, vol_name, extra_specs, move)
            else:
                LOG.info('Volume    with    device_id    %(dev)s    is    no    longer    a    member    of    %(sg)s.', {'dev': device_id, 'sg': sg_name})
        return do_remove_volume_from_sg(storagegroup_name)
    else:
        masking_name = masking_list[0]
        parent_sg_name = self.rest.get_element_from_masking_view(serial_number, masking_name, storagegroup=True)
        @coordination.synchronized('emc-mv-{parent_name}')
        @coordination.synchronized('emc-mv-{mv_name}')
        @coordination.synchronized('emc-sg-{sg_name}')
        def do_remove_volume_from_sg(mv_name, sg_name, parent_name):
            is_vol = self.rest.is_volume_in_storagegroup(serial_number, device_id, sg_name)
            if is_vol:
                num_vol_in_sg = self.rest.get_num_vols_in_sg(serial_number, sg_name)
                LOG.debug('There    are    %(num_vol)d    volumes    in    the    storage    group    %(sg_name)s    associated    with    %(mv_name)s.    Parent    storagegroup    is    %(parent)s.', {'num_vol': num_vol_in_sg, 'sg_name': sg_name, 'mv_name': mv_name, 'parent': parent_name})
                if (num_vol_in_sg == 1):
                    self._last_vol_in_sg(serial_number, device_id, vol_name, sg_name, extra_specs, move, connector)
                else:
                    self._multiple_vols_in_sg(serial_number, device_id, sg_name, vol_name, extra_specs, move)
            else:
                LOG.info('Volume    with    device_id    %(dev)s    is    no    longer    a    member    of    %(sg)s', {'dev': device_id, 'sg': sg_name})
        return do_remove_volume_from_sg(masking_name, storagegroup_name, parent_sg_name)
