failed to create instance with block_device_mapping_v2 option

asked 2015-11-30 06:42:46 -0600

John Zhao gravatar image

I was able to create an instance with CLI

$ nova boot --flavor gc1.small --image c85b0898-2bbd-46be-8950-3c031f07cb93 --key-name dev_key --block-device id=c85b0898-2bbd-46be-8950-3c031f07cb93,source=image,dest=volume,type=disk,device=vda,size=30,bootindex=1,shutdown=remove --availability-zone dev_zone --security-groups dev_tech --nic net-id=6fc22c46-b895-408f-b005-b2c4de916d8c ins_from_cl

However, when I submitted it via Python API: net = novaClient.networks.find(label='dev_net') image = novaClient.images.find(name='Base RHEL 6.7 Cloud') flavor = novaClient.flavors.find(name='gc1.small') dev_mapping = [{ 'source_type' : 'image', "image_id" :, 'device_name' : 'vda', "volume_id" : "f7c90ef0-925d-4c19-b499-a951793d7572", "volume_size" : 30, "boot_index" : 0, 'destination_type' : 'volume'}] novaClient.servers.create('ins_from_python', image,flavor , key_name = 'dev_key' ,block_device_mapping_v2 =dev_mapping, availability_zone ='dev_zone', nics = [{'net-id':}])

I got the following error: Traceback (most recent call last): File "<input>", line 1, in <module> File "/usr/share/lib/python2.7/site-packages/novaclient/v2/", line 995, in create *boot_kwargs) File "/usr/share/lib/python2.7/site-packages/novaclient/v2/", line 541, in _boot return_raw=return_raw, *kwargs) File "/usr/share/lib/python2.7/site-packages/novaclient/", line 172, in _create _resp, body =, body=body) File "/usr/share/lib/python2.7/site-packages/novaclient/", line 449, in post return self._cs_request(url, 'POST', *kwargs) File "/usr/share/lib/python2.7/site-packages/novaclient/", line 424, in _cs_request resp, body = self._time_request(url, method, *kwargs) File "/usr/share/lib/python2.7/site-packages/novaclient/", line 397, in _time_request resp, body = self.request(url, method, **kwargs) File "/usr/share/lib/python2.7/site-packages/novaclient/", line 391, in request raise exceptions.from_response(resp, body, url, method) BadRequest: Block Device Mapping is Invalid: Missing device UUID. (HTTP 400) (Request-ID: req-9b4b44fb-659f-4f25-90e2-465343431a21)

I searched, but am not able to find a solution. Can someone help? Thanks


edit retag flag offensive close merge delete