<div dir="ltr"><span style="font-family:arial,sans-serif;font-size:13px">I wonder if there is a way to do the following. I have a user A with admin role in tenant A, and I want to create a VM in/for tenant B as user A. Obviously, I can use A's admin privilege to add itself to tenant B, but I want to avoid that.</span><div style="font-family:arial,sans-serif;font-size:13px">
<br></div><div style="font-family:arial,sans-serif;font-size:13px">Based on the policy.json file, it seems doable:</div><div style="font-family:arial,sans-serif;font-size:13px"><a href="https://github.com/openstack/nova/blob/master/etc/nova/policy.json#L8" target="_blank">https://github.com/openstack/nova/blob/master/etc/nova/policy.json#L8</a><br>
</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">I read this as, as long as a user is an admin, it can create an instance.. Just like an admin user can remove an instance from another tenant. </div>
<div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">But in here, it looks like as long as the context project ID and target project ID don't match, an action would be rejected:</div>
<div style="font-family:arial,sans-serif;font-size:13px"><a href="https://github.com/openstack/nova/blob/master/nova/api/openstack/wsgi.py#L968" target="_blank">https://github.com/openstack/nova/blob/master/nova/api/openstack/wsgi.py#L968</a><br>
</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">Indeed, when I try to use user A's token to create a VM (POST to v2/<tenant_b>/servers), I got the exception from the above link.</div>
<div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">On the other hand, according to here, VM's project_id only comes from the context:</div><div style="font-family:arial,sans-serif;font-size:13px">
<div><a href="https://github.com/openstack/nova/blob/master/nova/compute/api.py#L767" target="_blank">https://github.com/openstack/nova/blob/master/nova/compute/api.py#L767</a><br></div><div><br></div><div>I wonder if it makes sense to allow admin users to specify a "project_id" field (which overrides context.project_id) when creating a VM. This probably requires non-trivial code change. </div>
<div><br></div><div>Or maybe there is another way of doing what I want?</div><div><br></div><div>Thanks.</div><div>-Simon <br></div></div><div style="font-family:arial,sans-serif;font-size:13px"><br></div></div>