'Registers the initiators to storage group.
:param storage_group: storage group object to which the initiator is
registered.
:param host: information of initiator, etc.
The behavior depends on the combination of the registered
initiators of SG and the configured white list of the ports (that is
`self.config.io_port_list`).
#. Register all non-registered initiators to `self.allowed_ports`.
#. For registered initiators, if the white list is configured, register
them to `self.allowed_ports` except the ones which are already
registered.
Note that `self.allowed_ports` comprises of all iSCSI/FC ports on array
or the valid ports of the white list if `self.config.io_port_list` is
configured.'

def auto_register_initiator(self, storage_group, host):

    host_initiators = set(host.initiators)
    sg_initiators = set(storage_group.initiator_uid_list)
    unreg_initiators = (host_initiators - sg_initiators)
    initiator_port_map = {unreg_id: set(self.allowed_ports) for unreg_id in unreg_initiators}
    if (self.config.io_port_list is not None):
        reg_initiators = (host_initiators & sg_initiators)
        for reg_id in reg_initiators:
            ports_to_reg = (set(self.allowed_ports) - set(storage_group.get_ports(reg_id)))
            if ports_to_reg:
                initiator_port_map[reg_id] = ports_to_reg
                LOG.debug('Ports    [%(ports)s]    in    white    list    will    be    bound    to    the    registered    initiator:    %(reg_id)s', {'ports': ports_to_reg, 'reg_id': reg_id})
    self.client.register_initiator(storage_group, host, initiator_port_map)
