2018-11-02 01:11:16,254 WARNING [nova.compute.api] The nova-osapi_compute service version is from before Ocata and may cause problems looking up instances in a cells v2 setup. Check your nova-api service configuration and cell mappings. You may need to remove stale nova-osapi_compute service records from the cell database.
And then lookup the instance in the main database which in our tests defaults to cell1, but for a novalidhost error, the instance will be in cell0, and we're not looking there because the nova-api service in the tests doesn't have a service version.
I think this is probably the key issue:
2018-11-02 01:11:16,254 WARNING [nova.compute.api] The nova-osapi_compute service version is from before Ocata and may cause problems looking up instances in a cells v2 setup. Check your nova-api service configuration and cell mappings. You may need to remove stale nova-osapi_compute service records from the cell database.
We hit that here:
https:/ /github. com/openstack/ nova/blob/ 4f5cb30a2f88965 772bcbff0a19a1d cfcd3836c6/ nova/compute/ api.py# L2411
And then lookup the instance in the main database which in our tests defaults to cell1, but for a novalidhost error, the instance will be in cell0, and we're not looking there because the nova-api service in the tests doesn't have a service version.