On Mon, Sep 27, 2021 at 2:15 PM Lee Yarwood <lyarwood@redhat.com> wrote:
On 25-09-21 13:11:19, open infra wrote:
On Sat, Sep 25, 2021 at 7:37 AM Laurent Dumont <laurentfdumont@gmail.com
wrote:
Just to be sure, the flow is.
- Create VM with root disk on a volume/image. - Create another 1TB volume. - Attach the volume to the VM as a second drive using a multi attach approach (
https://docs.openstack.org/cinder/latest/admin/blockstorage-volume-multiatta...
)? - Create snapshot of the original VM (with it's root drive + 1 TB volume)? - Create new VM from snapshot. - Instead of a new VM + 1 new root volume + the same 1TB multiattach volume attached, you get a new multiattach volume (new volume ID and everything)?
Because you're attaching a snapshot and not the original volume? See below for more.
Yes, here is the block device mapping of the snapshot (from a VM with 100GB of root disk and 1TB of multiattach volume)
block_device_mapping[{"image_id": null, "delete_on_termination": true, "device_name": "/dev/vda", "disk_bus": "virtio", "volume_id": null, "volume_type": null, "destination_type": "volume", "source_type": "snapshot", "guest_format": null, "volume_size": 100, "device_type": "disk", "snapshot_id": "7b2c7f3a-8420-4a33-820e-2d2231d930c7", "boot_index": 0, "no_device": null, "tag": null}, {"image_id": null, "delete_on_termination": false, "device_name": "/dev/vdb", "disk_bus": null, "volume_id": null, "volume_type": null, "destination_type": "volume", "source_type": "snapshot", "guest_format": null, "volume_size": 1000, "device_type": null, "snapshot_id": "c2a0695f-8c9e-46f9-80a8-560c47521eeb", "boot_index": null, "no_device": null, "tag": null}]
As you can see above you're using source_type = "snapshot" and destination_type of "volume". As set out in the following docs this creates a new volume from a given snapshot and attaches that to the instance:
https://docs.openstack.org/nova/latest/user/block-device-mapping.html#valid-...
snapshot -> volume - this works exactly as passing type=snap does. It would create a volume from a Cinder volume snapshot and attach that volume to the instance. Can be marked bootable.
https://docs.openstack.org/api-ref/compute/?expanded=create-server-detail#cr...
block_device_mapping_v2.source_type (Optional)
The source type of the block device. Valid values are: [..] snapshot: This is only valid with destination_type=volume; creates a volume backed by the given volume snapshot referenced via the block_device_mapping_v2.uuid parameter and attaches it to the server
When attaching multiattach enabled volumes to multiple instances you need to use source_type = 'volume' *and* destination_type = 'volume'.
Hope this helps,
It very clears what went wrong. The above block device mapping was found when I try to figure out what went wrong. But I am not sure where exactly I should define block device mapping when I use CLI. Appreciate if you can give an example. Thanks a lot Lee Yarwood!
-- Lee Yarwood A5D1 9385 88CB 7E5F BE64 6618 BCA6 6E33 F672 2D76