I created two volumes:
1) bootable Cirros (volume ID=45d6a4e4-c478-4b28-9850-049b5c9a8d51)
2) bootable Ubuntu (volume ID=2bffb48d-c859-4df1-a2a7-66e98af43837)
When both volumes are "available", I created VM by specifying Ubuntu as a bootable (bootindex=0) and Cirros as (bootindex=-1)
$ nova --debug boot --flavor 2 --block-device source=volume,id=2bffb48d-c859-4df1-a2a7-66e98af43837,dest=volume,size=5,shutdown=preserve,bootindex=0 --block-device source=volume,id=45d6a4e4-c478-4b28-9850-049b5c9a8d51,dest=volume,size=1,shutdown=preserve,bootindex=-1 uvm
[...]
DEBUG (session:248) REQ: curl -g -i -X POST http://192.168.229.137:8774/v2.1/os-volumes_boot -H "User-Agent: python-novaclient" -H "Content-Type: application/json" -H "Accept: application/json" -H "X-OpenStack-Nova-API-Version: 2.25" -H "X-Auth-Token: {SHA1}db2d307d5a2df66c6cb0a53c3cd7b0d8d77314e5" -d '{"server": {"name": "uvm", "imageRef": "", "block_device_mapping_v2": [{"boot_index": "0", "uuid": "2bffb48d-c859-4df1-a2a7-66e98af43837", "volume_size": "5", "source_type": "volume", "destination_type": "volume", "delete_on_termination": false}, {"boot_index": "-1", "uuid": "45d6a4e4-c478-4b28-9850-049b5c9a8d51", "volume_size": "1", "source_type": "volume", "destination_type": "volume", "delete_on_termination": false}], "flavorRef": "2", "max_count": 1, "min_count": 1}}'
[...]
VM successfully created with Ubuntu image (as expected).
I am not able to reproduce the bug on devstack (running inside VM). The behaviour I see is correct as per documentation (http:// docs.openstack. org/developer/ nova/block_ device_ mapping. html). Note that I am using QEMU as a backend (not KVM). See details below.
I created two volumes: c478-4b28- 9850-049b5c9a8d 51) c859-4df1- a2a7-66e98af438 37)
1) bootable Cirros (volume ID=45d6a4e4-
2) bootable Ubuntu (volume ID=2bffb48d-
When both volumes are "available", I created VM by specifying Ubuntu as a bootable (bootindex=0) and Cirros as (bootindex=-1) volume, id=2bffb48d- c859-4df1- a2a7-66e98af438 37,dest= volume, size=5, shutdown= preserve, bootindex= 0 --block-device source= volume, id=45d6a4e4- c478-4b28- 9850-049b5c9a8d 51,dest= volume, size=1, shutdown= preserve, bootindex= -1 uvm 192.168. 229.137: 8774/v2. 1/os-volumes_ boot -H "User-Agent: python-novaclient" -H "Content-Type: application/json" -H "Accept: application/json" -H "X-OpenStack- Nova-API- Version: 2.25" -H "X-Auth-Token: {SHA1}db2d307d5 a2df66c6cb0a53c 3cd7b0d8d77314e 5" -d '{"server": {"name": "uvm", "imageRef": "", "block_ device_ mapping_ v2": [{"boot_index": "0", "uuid": "2bffb48d- c859-4df1- a2a7-66e98af438 37", "volume_size": "5", "source_type": "volume", "destination_type": "volume", "delete_ on_termination" : false}, {"boot_index": "-1", "uuid": "45d6a4e4- c478-4b28- 9850-049b5c9a8d 51", "volume_size": "1", "source_type": "volume", "destination_type": "volume", "delete_ on_termination" : false}], "flavorRef": "2", "max_count": 1, "min_count": 1}}'
$ nova --debug boot --flavor 2 --block-device source=
[...]
DEBUG (session:248) REQ: curl -g -i -X POST http://
[...]
VM successfully created with Ubuntu image (as expected).
I repeated the same experiment by swapping bootable index values, i.e., Ubuntu bootindex=-1 and Cirros bootindex=0. volume, id=2bffb48d- c859-4df1- a2a7-66e98af438 37,dest= volume, size=5, shutdown= preserve, bootindex= -1 --block-device source= volume, id=45d6a4e4- c478-4b28- 9850-049b5c9a8d 51,dest= volume, size=1, shutdown= preserve, bootindex= 0 cvm 192.168. 229.137: 8774/v2. 1/os-volumes_ boot -H "User-Agent: python-novaclient" -H "Content-Type: application/json" -H "Accept: application/json" -H "X-OpenStack- Nova-API- Version: 2.25" -H "X-Auth-Token: {SHA1}12de1ea71 63bebdf6a775660 61f24036a69941d d" -d '{"server": {"name": "cvm", "imageRef": "", "block_ device_ mapping_ v2": [{"boot_index": "-1", "uuid": "2bffb48d- c859-4df1- a2a7-66e98af438 37", "volume_size": "5", "source_type": "volume", "destination_type": "volume", "delete_ on_termination" : false}, {"boot_index": "0", "uuid": "45d6a4e4- c478-4b28- 9850-049b5c9a8d 51", "volume_size": "1", "source_type": "volume", "destination_type": "volume", "delete_ on_termination" : false}], "flavorRef": "2", "max_count": 1, "min_count": 1}}'
$ nova --debug boot --flavor 2 --block-device source=
[...]
DEBUG (session:248) REQ: curl -g -i -X POST http://
VM successfully created with Cirros image (as expected).