ubuntu@zhhuabj-bastion-xenial:~/openstack-charm-testing$ nova flavor-create test-flav 'auto' 1024 80 4
ERROR (Forbidden): Policy doesn't allow compute_extension:flavormanage to be performed. (HTTP 403) (Request-ID: req-5787298d-af70-432f-900c-121ed2c27eb2)
ubuntu@zhhuabj-bastion-xenial:~/openstack-charm-testing$ nova list
+----+------+--------+------------+-------------+----------+
| ID | Name | Status | Task State | Power State | Networks |
+----+------+--------+------------+-------------+----------+
+----+------+--------+------------+-------------+----------+
I tested it according to the following steps:
1, create a role viewer and a user hua
keystone role-create --name viewer
keystone user-create --name hua --pass password
keystone user-role-add --user hua --role viewer --tenant demo
keystone user-role-list --tenant demo --user hua
2, /etc/nova/ policy. json needs to be modified for each of the services
diff --git a/etc/nova/ policy. json b/etc/nova/ policy. json policy. json policy. json is_admin" : "role:admin", id:%(project_ id)s", is_member" : "not role:viewer", id:%(project_ id)s and rule:context_ is_member) ", or_owner" , or_viewer" : "is_admin:True or (project_ id:%(project_ id)s and not role:viewer)", get":"rule: default_ or_viewer" , or_viewer" , get_all_ tenants" : "rule:default_ or_viewer" , stop":" rule:default_ or_viewer" , start": "rule:default_ or_viewer" , reboot" :"rule: default_ or_viewer" , "compute: get_vnc_ console" :"rule: default_ or_viewer" , get_spice_ console" :"rule: default_ or_viewer" , get_console_ output" :"rule: default_ or_viewer" , extension: console_ output" : "rule:default_ or_viewer" , extension: consoles" : "rule:default_ or_viewer" ,
index c238393..012b051 100644
--- a/etc/nova/
+++ b/etc/nova/
@@ -1,7 +1,20 @@
{
"context_
- "admin_or_owner": "is_admin:True or project_
+ "context_
+ "admin_or_owner": "is_admin:True or (project_
"default": "rule:admin_
+ "default_
+
+ "compute:
+ "compute:get_all": "rule:default_
+ "compute:
+ "compute:
+ "compute:
+ "compute:
+ "compute:
+ "compute:
+ "compute_
+ "compute_
"cells_ scheduler_ filter: TargetCellFilte r": "is_admin:True",
3, test it, it works
ubuntu@ zhhuabj- bastion- xenial: ~/openstack- charm-testing$ nova flavor-create test-flav 'auto' 1024 80 4 extension: flavormanage to be performed. (HTTP 403) (Request-ID: req-5787298d- af70-432f- 900c-121ed2c27e b2) zhhuabj- bastion- xenial: ~/openstack- charm-testing$ nova list -----+- ------- +------ ------+ ------- ------+ ------- ---+ -----+- ------- +------ ------+ ------- ------+ ------- ---+ -----+- ------- +------ ------+ ------- ------+ ------- ---+
ERROR (Forbidden): Policy doesn't allow compute_
ubuntu@
+----+-
| ID | Name | Status | Task State | Power State | Networks |
+----+-
+----+-