Bug 2172851
| Summary: | Host value ignored during the migration of a VM | ||
|---|---|---|---|
| Product: | Red Hat OpenStack | Reporter: | Eduardo Olivares <eolivare> |
| Component: | openstack-nova | Assignee: | 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
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.
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. |