Openstack的配额共功能的使用

时间:2023-03-08 20:40:51

在一个云系统中,一个项目不能无限制的使用资源,必须对项目进行配额管理,在openstack中主要的命令是nova quota-update, 但是可能会提示的错误:

DEBUG (shell:740) The server has either erred or is incapable of performing the requested operation. (HTTP 500) (Request-ID: req-76ec703e-566e-4133-af5d-d822a6750969)
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/novaclient/shell.py", line 737, in main
OpenStackComputeShell().main(map(strutils.safe_decode, sys.argv[1:]))
File "/usr/lib/python2.6/site-packages/novaclient/shell.py", line 673, in main
args.func(self.cs, args)
File "/usr/lib/python2.6/site-packages/novaclient/v1_1/shell.py", line 3198, in do_quota_update
_quota_update(cs.quotas, args.tenant, args)
File "/usr/lib/python2.6/site-packages/novaclient/v1_1/shell.py", line 3070, in _quota_update
**updates)
File "/usr/lib/python2.6/site-packages/novaclient/v1_1/quotas.py", line 77, in update
return self._update(url, body, 'quota_set')
File "/usr/lib/python2.6/site-packages/novaclient/base.py", line 158, in _update
_resp, body = self.api.client.put(url, body=body)
File "/usr/lib/python2.6/site-packages/novaclient/client.py", line 235, in put
return self._cs_request(url, 'PUT', **kwargs)
File "/usr/lib/python2.6/site-packages/novaclient/client.py", line 213, in _cs_request
**kwargs)
File "/usr/lib/python2.6/site-packages/novaclient/client.py", line 195, in _time_request
resp, body = self.request(url, method, **kwargs)
File "/usr/lib/python2.6/site-packages/novaclient/client.py", line 189, in request
raise exceptions.from_response(resp, body, url, method)
ClientException: The server has either erred or is incapable of performing the requested operation. (HTTP 500) (Request-ID: req-76ec703e-566e-4133-af5d-d822a6750969)
ERROR: The server has either erred or is incapable of performing the requested operation. (HTTP 500) (Request-ID: req-76ec703e-566e-4133-af5d-d822a6750969)

提示基本没有帮助。这里我们的原因是因为使用了fuel-web,他的默认配置文件中是不是用配额管理! 在/etc/nova/nova.conf配置文件中有

quota_driver=nova.quota.DbQuotaDriver
#quota_driver=nova.quota.NoopQuotaDriver

我们必须启用DbQuotaDriver才可以,修改后执行/etc/init.d/openstack-nova-api restart即可