2017-09-11 68 views

回答

0

當前openstackSDK(0.9.19)沒有函數來分配配額。 這可以使用openstack API完成。

conn = connection.Connection(auth_url='URL', project_name='PROJECT', username='USERNAME', password='ADMIN_PASSWORD', verify=False) 

token = conn.authorize() 

header = {'X-AUTH-TOKEN': token,'Content-Type': 'application/json'}  
request_body = {"quota_set": {"instances": "3" ,"ram": "40960", "cores": "20"}} 
data_json = json.dumps(request_body, sort_keys=True, indent=4, separators=(',', ': ')) 
r = requests.put(nova_url,headers=header,data=data_json,verify=False)