openstack api报错ClientResponseException,status=403, status-code=FORBIDDEN

项目场景:

使用共享VLAN网络建的port,非vlan所属者用户调用openstack4j api更新port信息,报错403
在这里插入图片描述


问题描述

调用openstack4j api更新port信息,报错403,报错信息如下:

ClientResponseException{
    
    message=(((((rule:update_port and (rule:update_port:fixed_ips and (rule:update_port:fixed_ips:ip_address and rule:update_port:fixed_ips:subnet_id))) and rule:update_port:device_owner) and rule:update_port:allowed_address_pairs) and rule:update_port:binding:vnic_type) and rule:update_port:port_security_enabled) is disallowed by policy, status=403, status-code=FORBIDDEN}

报错截图如下:
在这里插入图片描述


原因分析:

查看neutron日志:提示使用该用户的client不能操作该资源
在这里插入图片描述
该场景为:共享VLAN名称为vlan3303,project_id属于租户A
租户B使用vlan3303创建了port,并将该port分配了租户B,port更新安全组信息时,报错403
在这里插入图片描述


解决方案:

更新port传的参数信息:
NeutronPort{name=vlan-eni-test, adminStateUp=true, deviceId=, deviceOwner=, fixedIps=[NeutronIP{ipAddress=192.168.2.144, subnetId=088666d5-1e5c-46bb-b591-8c9952d5253e}], securityGroups=[08dc26a4-6d40-4eea-afcf-c4366490673d, 1f5731e1-80eb-4bd5-b289-9dfb9404e961], allowed_address_pairs=[], port_security_enabled =true, binding:vnic_type=normal}

通过代码调试,非VLAN所属者需要使用admin client 更新port信息。

猜你喜欢

转载自blog.csdn.net/qq_25919879/article/details/127826347