git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Openstack] boot order with multiple attachments


Hi colleagues,

is there any mechanism to ensure boot disk when attaching more than two 
volumes to server? At the moment, I can't find a way to make it predictable.

I have two bootable images with the following properties:
1) hw_boot_menu='true', hw_disk_bus='scsi', hw_qemu_guest_agent='yes', 
hw_scsi_model='virtio-scsi', img_hide_hypervisor_id='true', 
locations='[{u'url': u'swift+config:...', u'metadata': {}}]'

which corresponds to the following volume:

- attachments: [{u'server_id': u'...', u'attachment_id': u'...', 
u'attached_at': u'...', u'host_name': u'...', u'volume_id': 
u'<VOLUME1>', u'device': u'/dev/sda', u'id': u'...'}]
- volume_image_metadata: {u'checksum': u'...', u'hw_qemu_guest_agent': 
u'yes', u'disk_format': u'raw', u'image_name': u'bionic-Qpub', 
u'hw_scsi_model': u'virtio-scsi', u'image_id': u'...', u'hw_boot_menu': 
u'true', u'min_ram': u'0', u'container_format': u'bare', u'min_disk': 
u'0', u'img_hide_hypervisor_id': u'true', u'hw_disk_bus': u'scsi', 
u'size': u'...'}

and second image:
2) hw_disk_bus='scsi', hw_qemu_guest_agent='yes', 
hw_scsi_model='virtio-scsi', img_hide_hypervisor_id='true', 
locations='[{u'url': u'cinder://...', u'metadata': {}}]'

which corresponds to the following volume:

- attachments: [{u'server_id': u'...', u'attachment_id': u'...', 
u'attached_at': u'...', u'host_name': u'...', u'volume_id': 
u'<VOLUME2>', u'device': u'/dev/sdb', u'id': u'...'}]
- volume_image_metadata: {u'checksum': u'...', u'hw_qemu_guest_agent': 
u'yes', u'disk_format': u'raw', u'image_name': u'xenial', 
u'hw_scsi_model': u'virtio-scsi', u'image_id': u'...', u'min_ram': u'0', 
u'container_format': u'bare', u'min_disk': u'0', 
u'img_hide_hypervisor_id': u'true', u'hw_disk_bus': u'scsi', u'size': 
u'...'}

Using Heat, I'm creating the following block_devices_mapping_v2 scheme:

block_device_mapping_v2:
         - volume_id: <VOLUME1>
           delete_on_termination: false
           device_type: disk
           disk_bus: scsi
           boot_index: 0
         - volume_id: <VOLUME2>
           delete_on_termination: false
           device_type: disk
           disk_bus: scsi
           boot_index: -1

which maps to the following nova-api debug log:

Action: 'create', calling method: <bound method ServersController.create 
of <nova.api.openstack.compute.servers.ServersController object at 
0x7f6b08dd4890>>, body: {"ser
ver": {"name": "jex-n1", "imageRef": "", "block_device_mapping_v2": 
[{"boot_index": 0, "uuid": "<VOLUME1>", "disk_bus": "scsi", 
"source_type": "volume"
, "device_type": "disk", "destination_type": "volume", 
"delete_on_termination": false}, {"boot_index": -1, "uuid": "<VOLUME2>", 
"disk_bus": "scsi", "so
urce_type": "volume", "device_type": "disk", "destination_type": 
"volume", "delete_on_termination": false}], "flavorRef": 
"4b3da838-3d81-461a-b946-d3613fb6f4b3", "user_data": "...", "max_count": 
1, "min_count": 1, "networks": [{"port": 
"9044f884-1a3d-4dc6-981e-f585f5e45dd1"}], "config_drive": true}} 
_process_stack 
/usr/lib/python2.7/dist-packages/nova/api/openstack/wsgi.py:604

Regardless of boot_index value, server boots from VOLUME2 (/dev/sdb), 
while having attached VOLUME1 as well as /dev/sda

I'm using Queens. Where I'm wrong?

Thank you.

-- 
Volodymyr Litovka
   "Vision without Execution is Hallucination." -- Thomas Edison