Nova find block device mappings
Jump to navigation
Jump to search
You know when you boot a VM from a volume and you select whether to delete that volume on instance termination? Well, it's a pain to find this information after the VM is created! This is the only way I've found so far. You have to go in the nova mysql database and run the following query:
MariaDB [nova]> select * from block_device_mapping where volume_id="77e6583a-a2f8-49bf-a932-3359f78a9c1c" \G;
*************************** 1. row ***************************
created_at: 2019-06-03 15:47:32
updated_at: 2019-06-03 15:47:53
deleted_at: NULL
id: 263
device_name: /dev/vda
delete_on_termination: 1
snapshot_id: NULL
volume_id: 77e6583a-a2f8-49bf-a932-3359f78a9c1c
volume_size: 40
no_device: 0
connection_info: {"driver_volume_type": "iscsi", "connector": {"platform": "x86_64", "host": "node01.vscaler.net", "do_local_attach": false, "ip": "10.10.10.11", "os_type": "linux2", "multipath": false, "initiator": "iqn.1994-05.com.redhat:572075d2203f"}, "serial": "77e6583a-a2f8-49bf-a932-3359f78a9c1c", "data": {"access_mode": "rw", "target_discovered": false, "encrypted": false, "qos_specs": null, "target_iqn": "iqn.2010-10.org.openstack:volume-77e6583a-a2f8-49bf-a932-3359f78a9c1c", "target_portal": "10.10.10.13:3260", "volume_id": "77e6583a-a2f8-49bf-a932-3359f78a9c1c", "target_lun": 1, "device_path": "/dev/sdg", "auth_password": "Sh55YNC4KUuoBqJV", "auth_username": "UJXs5NtVr6UKNHt9PNMB", "auth_method": "CHAP"}}
instance_uuid: 30afcbb6-8d99-4c1c-8d55-470c1e960bbc
deleted: 0
source_type: image
destination_type: volume
guest_format: NULL
device_type: disk
disk_bus: virtio
boot_index: 0
image_id: 4d1ee5e2-5b0f-4d77-a431-bc4773988379
tag: NULL
attachment_id: NULL
uuid: f12d7abc-8fa5-4393-8dc5-2933a8c0a7c8
1 row in set (0.00 sec)