<div>I don't think there is auto-alignment between nova az and cinder az.</div><div>Probably you may want to look at this <a href="https://docs.openstack.org/cinder/rocky/admin/blockstorage-availability-zone-type.html">https://docs.openstack.org/cinder/rocky/admin/blockstorage-availability-zone-type.html</a></div><div>Cinder AZ can be associated with volume types. When you create a VM, you can specify the VM nova az (eg. host1), volume type (cinder az, eg, also host1), thus by aligning nova az and cinder az manually, maybe your goal can be achieved.  I believe there are also other similar configuration ways to make it work like this.</div><div> </div><div>Thanks,<br />Zang, Rui</div><div> </div><div>24.02.2020, 16:53, "Tony Pearce" <tony.pearce@cinglevue.com>:</div><blockquote><div><div><div><p style="line-height:1.38;margin-bottom:0pt;margin-top:0pt"> </p><p style="line-height:1.38;margin-bottom:0pt;margin-top:0pt"><span style="background-color:transparent;color:#000000;font-family:'arial';font-size:11pt;vertical-align:baseline;white-space:pre-wrap">Apologies in advance if this seems trivial but I am looking for some direction on this and I may have found a bug while testing also.</span></p> <p style="line-height:1.38;margin-bottom:0pt;margin-top:0pt"><span style="background-color:transparent;color:#000000;font-family:'arial';font-size:11pt;vertical-align:baseline;white-space:pre-wrap">Some background - I have 2 physical hosts which I am testing with (host1, host2) and I have 2 separate cinder backends (backend1, backend2). Backend1 can only be utilised by host1. Same for backend2 - it can only be utilised by host2. So they are paired together like: host1:backend1 host2:backend2</span></p> <p style="line-height:1.38;margin-bottom:0pt;margin-top:0pt"><span style="background-color:transparent;color:#000000;font-family:'arial';font-size:11pt;vertical-align:baseline;white-space:pre-wrap">So I wanted to select a Cinder storage back-end based on nova availability zone and to do this when creating an instance through horizon (not creating a volume directly). Also I wanted to avoid the use of metadata input on each instance create or by using metadata from images (such as cinder_img_volume_type) [2] . Because I can foresee a necessity to then have a number of images which reference each AZ or backend individually. </span></p> <p style="line-height:1.38;margin-bottom:0pt;margin-top:0pt"> </p><ul><li><span style="background-color:transparent;color:#000000;font-family:'arial';font-size:11pt;vertical-align:baseline;white-space:pre-wrap">Is it possible to select a backend based on nova AZ? If so, could anyone share any resources to me that could help me understand how to achieve it? </span></li></ul><p> </p><p style="line-height:1.38;margin-bottom:0pt;margin-top:0pt"><span style="background-color:transparent;color:#000000;font-family:'arial';font-size:11pt;vertical-align:baseline;white-space:pre-wrap">Because I failed at achieving the above, I then decided to use one way which had worked for me in the past, which was to use the image metadata "cinder_img_volume_type". However I find that this is not working. The “default” volume type is selected (if cinder.conf has it) or if no default, then `__DEFAULT__` is being selected. The link at [2] states that first, a volume type is used based on the volume type selected and if not chosen/set then the 2nd method is "cinder_img_volume_type" from the image metadata and then the 3rd and final is the default from cinder.conf.</span></p><p style="line-height:1.38;margin-bottom:0pt;margin-top:0pt"> </p><p style="line-height:1.38;margin-bottom:0pt;margin-top:0pt"><span style="background-color:transparent;color:#000000;font-family:'arial';font-size:11pt;vertical-align:baseline;white-space:pre-wrap">I have tested with fresh deployment using Kayobe as well as RDO’s packstack. </span></p><p style="line-height:1.38;margin-bottom:0pt;margin-top:0pt"><span style="background-color:transparent;color:#000000;font-family:'arial';font-size:11pt;vertical-align:baseline;white-space:pre-wrap">Openstack version is <strong>Train</strong></span><br /> </p><p style="line-height:1.38;margin-bottom:0pt;margin-top:0pt"><span style="background-color:transparent;color:#000000;font-family:'arial';font-size:11pt;vertical-align:baseline;white-space:pre-wrap">Steps to reproduce:<br />1. Install packstack</span></p><p style="line-height:1.38;margin-bottom:0pt;margin-top:0pt"><span style="background-color:transparent;color:#000000;font-family:'arial';font-size:11pt;vertical-align:baseline;white-space:pre-wrap">2. Update cinder.conf with enabled_backends and the [backend]</span></p><p style="line-height:1.38;margin-bottom:0pt;margin-top:0pt"><span style="background-color:transparent;color:#000000;font-family:'arial';font-size:11pt;vertical-align:baseline;white-space:pre-wrap">3. Add the volume type to reference the backend (for reference, I call this volume type `number-1`)</span></p><p style="line-height:1.38;margin-bottom:0pt;margin-top:0pt"><span style="background-color:transparent;color:#000000;font-family:'arial';font-size:11pt;vertical-align:baseline;white-space:pre-wrap">4. Upload an image and add metadata `cinder_img_volume_type` and the name as mentioned in step 3: number-1</span></p><p style="line-height:1.38;margin-bottom:0pt;margin-top:0pt"><span style="background-color:transparent;color:#000000;font-family:'arial';font-size:11pt;vertical-align:baseline;white-space:pre-wrap">5. Try and create an instance using horizon. Source = image and create new volume</span></p><p style="line-height:1.38;margin-bottom:0pt;margin-top:0pt"><span style="background-color:transparent;color:#000000;font-family:'arial';font-size:11pt;vertical-align:baseline;white-space:pre-wrap">6. Result = volume type / backend as chosen in the image metadata is not used and instance goes into error status. </span></p> <p style="line-height:1.38;margin-bottom:0pt;margin-top:0pt"><span style="background-color:transparent;color:#000000;font-family:'arial';font-size:11pt;vertical-align:baseline;white-space:pre-wrap">After fresh-deploying the RDO Packstack, I enabled debug logs and tested again. In the cinder-api.log I see “"volume_type": null,” and then the next debug log immediately after logged as “Create volume request body:” has “volume_type': None”. </span></p> <p style="line-height:1.38;margin-bottom:0pt;margin-top:0pt"><span style="background-color:transparent;color:#000000;font-family:'arial';font-size:11pt;vertical-align:baseline;white-space:pre-wrap">I was searching for a list of the supported image metadata, in case it had changed but the pages seem empty one rocky/stein/train [3] or not yet updated. </span></p> <p style="line-height:1.38;margin-bottom:0pt;margin-top:0pt"><span style="background-color:transparent;color:#000000;font-family:'arial';font-size:11pt;vertical-align:baseline;white-space:pre-wrap">Selecting backend based on nova AZ:: </span></p> <p style="line-height:1.38;margin-bottom:0pt;margin-top:0pt"><span style="background-color:transparent;color:#000000;font-family:'arial';font-size:11pt;vertical-align:baseline;white-space:pre-wrap">I was searching how to achieve this and I came across this video on the subject of AZs [1]. Although it seems only in the context of creating volumes (not with creating instances with volume from an image, for example). </span></p><p style="line-height:1.38;margin-bottom:12pt;margin-top:12pt"><span style="background-color:transparent;color:#000000;font-family:'arial';font-size:11pt;vertical-align:baseline;white-space:pre-wrap">I have tried creating a host aggregate in nova, with AZ name `host1az`. I've also created a backend in Cinder (cinder.conf) with `backend_availability_zone = host1az`. But this does not appear to achieve the desired result, either and the cinder api logs are showing “"availability_zone": null” during the volume create part of the launch instance from Horizon.</span></p><p style="line-height:1.38;margin-bottom:12pt;margin-top:12pt"><span style="background-color:transparent;color:#000000;font-family:'arial';font-size:11pt;vertical-align:baseline;white-space:pre-wrap">I also tried setting RESKEY [3] in the volume type, but again similar situation seen; although I dont think this option is the correct context for what I am attempting. </span></p> <p style="line-height:1.38;margin-bottom:12pt;margin-top:12pt"><span style="background-color:transparent;color:#000000;font-family:'arial';font-size:11pt;vertical-align:baseline;white-space:pre-wrap">Could anyone please nudge me in the right direction on this? Any pointers appreciated at this point. Thanks in advance.</span></p><p style="line-height:1.38;margin-bottom:12pt;margin-top:12pt"><span style="background-color:transparent;color:#000000;font-family:'arial';font-size:11pt;vertical-align:baseline;white-space:pre-wrap">References: </span></p><p style="line-height:1.38;margin-bottom:12pt;margin-top:12pt"><span style="background-color:transparent;color:#000000;font-family:'arial';font-size:11pt;vertical-align:baseline;white-space:pre-wrap">[1] </span><a href="https://www.youtube.com/watch?v=a5332_Ew9JA" style="text-decoration:none"><u style="background-color:transparent;font-family:'arial';font-size:11pt;text-decoration:underline;vertical-align:baseline;white-space:pre-wrap">https://www.youtube.com/watch?v=a5332_Ew9JA</u></a></p><p style="line-height:1.38;margin-bottom:12pt;margin-top:12pt"><span style="background-color:transparent;color:#000000;font-family:'arial';font-size:11pt;vertical-align:baseline;white-space:pre-wrap">[2] </span><a href="https://docs.openstack.org/cinder/latest/cli/cli-manage-volumes.html" style="text-decoration:none"><u style="background-color:transparent;font-family:'arial';font-size:11pt;text-decoration:underline;vertical-align:baseline;white-space:pre-wrap">https://docs.openstack.org/cinder/latest/cli/cli-manage-volumes.html</u></a><span style="background-color:transparent;color:#000000;font-family:'arial';font-size:11pt;vertical-align:baseline;white-space:pre-wrap"> </span></p><p style="line-height:1.38;margin-bottom:12pt;margin-top:12pt"><span style="background-color:transparent;color:#000000;font-family:'arial';font-size:11pt;vertical-align:baseline;white-space:pre-wrap">[3] </span><a href="https://docs.openstack.org/cinder/train/contributor/api/cinder.api.schemas.volume_image_metadata.html" style="text-decoration:none"><u style="background-color:transparent;font-family:'arial';font-size:11pt;text-decoration:underline;vertical-align:baseline;white-space:pre-wrap">https://docs.openstack.org/cinder/train/contributor/api/cinder.api.schemas.volume_image_metadata.html</u></a><span style="background-color:transparent;color:#000000;font-family:'arial';font-size:11pt;vertical-align:baseline;white-space:pre-wrap"> </span></p><p style="line-height:1.38;margin-bottom:12pt;margin-top:12pt"><span style="background-color:transparent;color:#000000;font-family:'arial';font-size:11pt;vertical-align:baseline;white-space:pre-wrap">[4] </span><a href="https://docs.openstack.org/cinder/rocky/admin/blockstorage-availability-zone-type.html" style="text-decoration:none"><u style="background-color:transparent;font-family:'arial';font-size:11pt;text-decoration:underline;vertical-align:baseline;white-space:pre-wrap">https://docs.openstack.org/cinder/rocky/admin/blockstorage-availability-zone-type.html</u></a><span style="background-color:transparent;color:#000000;font-family:'arial';font-size:11pt;vertical-align:baseline;white-space:pre-wrap"> </span></p> <p style="line-height:1.38;margin-bottom:12pt;margin-top:12pt"><span style="background-color:transparent;color:#000000;font-family:'arial';font-size:11pt;vertical-align:baseline;white-space:pre-wrap">Regards,</span></p><p style="line-height:1.38;margin-bottom:12pt;margin-top:12pt"><strong style="background-color:transparent;color:#000000;font-family:'arial';font-size:10pt;font-weight:700;vertical-align:baseline;white-space:pre-wrap">Tony Pearce</strong></p><div><div><div><div><div><p> </p></div></div></div></div></div></div></div></div></blockquote>