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