#NEWLINE# def get_dhcp_opts( context , network_ref , fixedips ) : #NEWLINE# #INDENT# "Get network's hosts config in dhcp-opts format." #NEWLINE# gateway = network_ref [ 'gateway' ] #NEWLINE# if ( network_ref [ 'multi_host' ] and ( not ( network_ref [ 'share_address' ] or CONF . share_dhcp_address ) ) ) : #NEWLINE# #INDENT# gateway = network_ref [ 'dhcp_server' ] #NEWLINE# #UNINDENT# hosts = [ ] #NEWLINE# if CONF . use_single_default_gateway : #NEWLINE# #INDENT# for fixedip in fixedips : #NEWLINE# #INDENT# if fixedip . allocated : #NEWLINE# #INDENT# vif_id = fixedip . virtual_interface_id #NEWLINE# if fixedip . default_route : #NEWLINE# #INDENT# hosts . append ( _host_dhcp_opts ( vif_id , gateway ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# hosts . append ( _host_dhcp_opts ( vif_id ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# hosts . append ( _host_dhcp_opts ( None , gateway ) ) #NEWLINE# #UNINDENT# return '\n' . join ( hosts )