def update_port_postcommit(self, context):
vlan_id = self._get_vlanid(context)<EOL>if not vlan_id:<EOL><INDENT>LOG.warning('<STR_LIT>')<EOL>return<EOL><DEDENT>if (not self._is_supported_deviceowner(context.current) or<EOL>not self._is_status_active(context.current)):<EOL><INDENT>LOG.debug("<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>",<EOL>{'<STR_LIT>': context.current['<STR_LIT>'],<EOL>'<STR_LIT>': vlan_id,<EOL>'<STR_LIT:status>': context.current['<STR_LIT:status>']})<EOL>return<EOL><DEDENT>host_id = self._get_host_id(<EOL>context.current.get(bc.portbindings.HOST_ID))<EOL>if not host_id:<EOL><INDENT>LOG.warning('<STR_LIT>'<EOL>'<STR_LIT>')<EOL>return<EOL><DEDENT>ucsm_ip = self.driver.get_ucsm_ip_for_host(host_id)<EOL>if not ucsm_ip:<EOL><INDENT>LOG.info('<STR_LIT>'<EOL>'<STR_LIT>', str(host_id))<EOL>return<EOL><DEDENT>profile = context.current.get(bc.portbindings.PROFILE, {})<EOL>vnic_type = context.current.get(bc.portbindings.VNIC_TYPE,<EOL>bc.portbindings.VNIC_NORMAL)<EOL>if (self.driver.check_vnic_type_and_vendor_info(vnic_type, profile) and<EOL>self.driver.is_vmfex_port(profile)):<EOL><INDENT>profile_name = self.ucsm_db.get_port_profile_for_vlan(vlan_id,<EOL>ucsm_ip)<EOL>if profile_name and self.ucsm_db.is_port_profile_created(vlan_id,<EOL>ucsm_ip):<EOL><INDENT>LOG.debug('<STR_LIT>'<EOL>'<STR_LIT>', profile_name, vlan_id, ucsm_ip)<EOL>return<EOL><DEDENT>network = context.network.current['<STR_LIT:name>']<EOL>trunk_vlans = (<EOL>CONF.sriov_multivlan_trunk.network_vlans.get(network, []))<EOL>if self.driver.create_portprofile(profile_name, vlan_id,<EOL>vnic_type, host_id, trunk_vlans):<EOL><INDENT>self.ucsm_db.set_port_profile_created(vlan_id, profile_name,<EOL>ucsm_ip)<EOL><DEDENT>return<EOL><DEDENT>else:<EOL><INDENT>LOG.debug('<STR_LIT>', host_id)<EOL>physnet = self._get_physnet(context)<EOL>ucsm = CONF.ml2_cisco_ucsm.ucsms[ucsm_ip]<EOL>vnic_template = ucsm.vnic_template_list.get(physnet)<EOL>if vnic_template:<EOL><INDENT>LOG.debug('<STR_LIT>', physnet)<EOL>LOG.debug('<STR_LIT>', vnic_template)<EOL>if (self.driver.update_vnic_template(<EOL>host_id, vlan_id, physnet, vnic_template.path,<EOL>vnic_template.name)):<EOL><INDENT>LOG.debug('<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>',<EOL>{'<STR_LIT>': vlan_id,<EOL>'<STR_LIT>': vnic_template.name,<EOL>'<STR_LIT>': ucsm_ip})<EOL>self.ucsm_db.set_vnic_template_updated(<EOL>vlan_id, ucsm_ip, vnic_template.name, physnet)<EOL><DEDENT>return<EOL><DEDENT>if (CONF.ml2_cisco_ucsm.ucsms[ucsm_ip].sp_template_list and<EOL>self.driver.update_service_profile_template(<EOL>vlan_id, host_id, ucsm_ip)):<EOL><INDENT>sp_template_info = (CONF.ml2_cisco_ucsm.ucsms[<EOL>ucsm_ip].sp_template_list.get(host_id))<EOL>if not sp_template_info:<EOL><INDENT>sp_template = None<EOL><DEDENT>else:<EOL><INDENT>sp_template = sp_template_info.name<EOL><DEDENT>LOG.debug('<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>', {'<STR_LIT>': vlan_id,<EOL>'<STR_LIT>': sp_template, '<STR_LIT>': ucsm_ip})<EOL>self.ucsm_db.set_sp_template_updated(vlan_id, sp_template,<EOL>ucsm_ip)<EOL><DEDENT>else:<EOL><INDENT>self.driver.update_serviceprofile(host_id, vlan_id)<EOL><DEDENT><DEDENT>
Creates a port profile on UCS Manager.

        Creates a Port Profile for this VLAN if it does not already
        exist.