コード例 #1
0
 def update_port_postcommit(self, current, original, segment):
     try:
         dvs = self._lookup_dvs_for_context(segment)
         if current['id'] in self.booked_ports:
             self.added_ports.add(current['id'])
             self.booked_ports.discard(current['id'])
     except exceptions.NoDVSForPhysicalNetwork:
         raise exceptions.InvalidSystemState(
             details=_('Port %(port_id)s belong to VMWare VM, but there is '
                       'no mapping from network to DVS.') %
             {'port_id': current['id']})
     else:
         self._update_admin_state_up(dvs, original, current)
コード例 #2
0
 def delete_port_postcommit(self, current, original, segment):
     try:
         dvs = self._lookup_dvs_for_context(segment)
     except exceptions.NoDVSForPhysicalNetwork:
         raise exceptions.InvalidSystemState(
             details=_('Port %(port_id)s belong to VMWare VM, but there is '
                       'no mapping from network to DVS.') %
             {'port_id': current['id']})
     else:
         if sg_rpc.is_firewall_enabled():
             key = current.get('binding:vif_details',
                               {}).get('dvs_port_key')
             if key:
                 dvs.remove_block(key)
         else:
             dvs.release_port(current)