def _create_ucsm_host_to_service_profile_mapping(self):
<EOL>ucsm_ips = [ip for ip, ucsm in CONF.ml2_cisco_ucsm.ucsms.items()<EOL>if not ucsm.ucsm_host_list]<EOL>for ucsm_ip in ucsm_ips:<EOL><INDENT>with self.ucsm_connect_disconnect(ucsm_ip) as handle:<EOL><INDENT>try:<EOL><INDENT>sp_list = handle.query_classid('<STR_LIT>')<EOL>if sp_list is not None:<EOL><INDENT>for sp in sp_list:<EOL><INDENT>if sp.pn_dn:<EOL><INDENT>server_name = handle.query_dn(sp.pn_dn).name<EOL>if (server_name and not<EOL>sp.oper_src_templ_name):<EOL><INDENT>LOG.debug('<STR_LIT>'<EOL>'<STR_LIT>', server_name, ucsm_ip)<EOL>key = (ucsm_ip, server_name)<EOL>self.ucsm_sp_dict[key] = str(sp.dn)<EOL>self.ucsm_host_dict[server_name] = ucsm_ip<EOL><DEDENT><DEDENT><DEDENT><DEDENT><DEDENT>except Exception as e:<EOL><INDENT>raise cexc.UcsmConfigReadFailed(ucsm_ip=ucsm_ip, exc=e)<EOL><DEDENT><DEDENT><DEDENT>
Reads list of Service profiles and finds associated Server.