Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 2172851

Summary: Host value ignored during the migration of a VM
Product: Red Hat OpenStack Reporter: Eduardo Olivares <eolivare>
Component: openstack-novaAssignee: OSP DFG:Compute <osp-dfg-compute>
Status: CLOSED UPSTREAM QA Contact: OSP DFG:Compute <osp-dfg-compute>
Severity: high Docs Contact:
Priority: unspecified    
Version: 17.1 (Wallaby)CC: alifshit, dasmith, eglynn, jhakimra, kchamart, sbauza, sgordon, vromanso
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-02-23 19:11:38 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Comment 1 Artom Lifshitz 2023-02-23 11:14:21 UTC
You haven't actually provided any evidence that instance.host ends up being wrong. The linked test report appears to say that the test tobiko/tests/scenario/nova/test_server.py::CirrosServerTest::test_6_migrate_server_with_host failed with the error `'NoneType' object is not iterable`.

The following log line:

2023-02-17 23:42:18.580 17 INFO nova.scheduler.host_manager [req-7f0957cb-1b6e-42bd-ac1d-10d315d45988 44f36d6f56634c38a0dfaa533f53989d 8896a584d2694e6eb2fe54a1fc3d9495 - default default] Host filter ignoring hosts: cmp-3-1.redhat.local

Might indicate that the instance was _already_ on cmp-3-1 at the start of the migration.

Please include instance.host before the migration, as well as after.

Comment 3 Artom Lifshitz 2023-02-23 15:57:05 UTC
OK, so!

1. Apologies for missing the source host, I was writing my first comment pre-coffee, which is also why it was grumpier than normal. Sorry again.
2. All you need to do to fix your test is to pass microversion >= 2.56, which is when we started supporting migrating to a specific host.
3. That being said, this is still a hilarious bug in how we validate requests. Because the code looks like this:

    @validation.schema(migrate_server.migrate_v2_56, "2.56")
    def _migrate(self, req, id, body):    
        <snip>

  Meaning we only validate the request schema when it's sent with microversion >= 2.56, we can actually send anything we want if we don't specify a microversion, as demonstrated here:

  $ curl -g -i -X POST https://rhos-d.infra.prod.upshift.rdu2.redhat.com:13774/v2.1/servers/42efd102-91a2-4326-aa62-ad6a1792b35d/action \
         -H "Accept: application/json" -H "Content-Type: application/json" -H "User-Agent: python-novaclient" \
         -H "X-Auth-Token: <snip>" \
         -H "X-OpenStack-Nova-API-Version: 2.1" \
         -d '{"migrate": {"foo": "bar"}}'

  {"forbidden": {"code": 403, "message": "Policy doesn't allow os_compute_api:os-migrate-server:migrate to be performed."}}

  This fails on the policy check (I'm not admin in the cloud I used to test this), rather than the schema check.

Comment 5 Artom Lifshitz 2023-02-23 19:11:38 UTC
I'm going to close this since there's an easy workaround (and really attempting to use a microversion feature without passing that microversion is incorrect anyways, it's only by "luck" that it's allowed in this case), and we'll track the upstream work to close the schema validation bug in https://bugs.launchpad.net/nova/+bug/2008341.