def _port_belongs_to_vmware(self, context): port = context.current try: if port['binding:vif_type'] == dvs_const.DVS: return func(self, context) elif port['binding:vif_type'] == 'unbound': try: host = port['binding:host_id'] except KeyError: raise exceptions.HypervisorNotFound agent = db.get_agent_by_host(host) if not agent: raise exceptions.HypervisorNotFound else: return False except exceptions.ResourceNotFound: return False return func(self, context)