def get_dhcp_opts(context, network_ref, fixedips):
    gateway = network_ref['gateway']
    # NOTE(vish): if we are in multi-host mode and we are not sharing
    #             addresses, then we actually need to hand out the
    #             dhcp server address as the gateway.
    if network_ref['multi_host'] and not (network_ref['share_address'] or
                                          CONF.share_dhcp_address):
        gateway = network_ref['dhcp_server']
    hosts = []
    if CONF.use_single_default_gateway:
        for fixedip in fixedips:
            if fixedip.allocated:
                vif_id = fixedip.virtual_interface_id
                if fixedip.default_route:
                    hosts.append(_host_dhcp_opts(vif_id, gateway))
                else:
                    hosts.append(_host_dhcp_opts(vif_id))
    else:
        hosts.append(_host_dhcp_opts(None, gateway))
    return '\n'.join(hosts)
Get network's hosts config in dhcp-opts format.
dataset/ETHPy150Open openstack/nova/nova/network/linux_net.py/get_dhcp_opts