'Process port bindings for subports on the given trunk.'

def _process_trunk_subport_bindings(self, context, trunk, port_ids):

    updated_ports = []
    trunk_port_id = trunk.port_id
    trunk_port = self.core_plugin.get_port(context, trunk_port_id)
    trunk_host = trunk_port.get(portbindings.HOST_ID)
    trunk.update(status=trunk_consts.BUILD_STATUS)
    for port_id in port_ids:
        try:
            updated_port = self._handle_port_binding(context, port_id, trunk, trunk_host)
            updated_ports.append(updated_port)
        except trunk_exc.SubPortBindingError as e:
            LOG.error(_LE('Failed    to    bind    subport:    %s'), e)
            trunk.update(status=trunk_consts.ERROR_STATUS)
            return []
        except Exception as e:
            msg = _LE('Failed    to    bind    subport    port    %(port)s    on    trunk    %(trunk)s:    %(exc)s')
            LOG.error(msg, {'port': port_id, 'trunk': trunk.id, 'exc': e})
    if (len(port_ids) != len(updated_ports)):
        trunk.update(status=trunk_consts.DEGRADED_STATUS)
    return updated_ports
