Task name: Reconfigure virtual machine Error: Failed to connect virtual device ethernet0
/var/log/proton/nsxapi.log, you may observe a sequence where a detach is successfully processed, but a subsequent attach indicates a prior stale port for the same VIF ID using a different Logical SwitchINFO L2TaskExecutor4 LogicalPortServiceImpl 77790 SWITCHING [nsx@6876 comp="nsx-manager" level="INFO" subcomp="manager"] dvport [##########################] to be detached on host: [##########################]INFO L2TaskExecutor4 VifAttachmentRpcHandler 77790 FABRIC [nsx@6876 comp="nsx-manager" level="INFO" subcomp="manager"] VifMsgHandler.END: processed Vif operation [112-35] (msgId=null:null), (msg=message_id: ""operation: DETACH_VIF_FROM_PORTtype: RESPONSEport_attachment { logical_port_uuid: "##########################" vif_uuid: "47f3##########################" transport_zone_uuid: "##########################" host_operation_id: "112-35" logical_switch_uuid: "8f46e##########################"}
INFO L2TaskExecutor20 VifAttachmentRpcHandler 77790 FABRIC [nsx@6876 comp="nsx-manager" level="INFO" subcomp="manager"] VifMsgHandler.BEGIN: Received VifMsg [null:null]: "operation: ATTACH_VIF_TO_PORTtype: REQUESTvif_attachment { vif_uuid: "47f3##########################" logical_switch_uuid: "7bc39b##########################" logical_port_uuid: "" host_id: "6c087##########################" vmx_path: "/vmfs/volumes/<redacted>" host_operation_id: "112-36"}
VMware NSX
This issue is caused by stale cached data within the `nsx-opsagent` service on the ESXi host. This data is left behind from past cross-logical switch migrations (e.g., when changing the VM's logical segment). When the VM is subsequently migrated, this incorrect cache is relayed to the NSX Manager, which deletes the logical port and blocks the port that the vNIC is connected to on the destination host.
Temporary Workaround:
Permanent Mitigation (Clearing Cache):
Note: Restarting the nsx-opsagent service does not require host downtime and should not cause any network disruptions to running virtual machines.
/etc/init.d/nsx-opsagent restart
Important Considerations:
Permanent Fix : A permanent resolution is planned for a future NSX release.