I've seen this a few times lately as well. It was always when I was deleting an instance. Looking at the code, it appears to be a race condition in nova/virt/xenapi/vmops.py:VMOps.list_instances.
It calls the XenAPI command VM.get_all and then calls VM.get_record on each of the returned VM refs. If an instance gets deleted between the VM.get_all command and the VM.get_record, then I could easily see a HANDLE_INVALID being returned.
I think the code needs to be tolerant of HANDLE_INVALID exceptions and continue on, assuming we lost the race on that VM.
I've seen this a few times lately as well. It was always when I was deleting an instance. Looking at the code, it appears to be a race condition in nova/virt/ xenapi/ vmops.py: VMOps.list_ instances.
It calls the XenAPI command VM.get_all and then calls VM.get_record on each of the returned VM refs. If an instance gets deleted between the VM.get_all command and the VM.get_record, then I could easily see a HANDLE_INVALID being returned.
I think the code needs to be tolerant of HANDLE_INVALID exceptions and continue on, assuming we lost the race on that VM.