<div dir="ltr">Hello all,<div><br></div><div>Can I add the code I used above to the NOVA upstream code?</div><div><br></div><div>Two changes:</div><div>* add option "enable_az_attach_list" in nove/[cinder]</div><div>* passing checking availability zone 

in check_availability_zone function if there is enable_az_attach_list</div><div><br></div><div>Thanks,</div><div><br></div><div>Kiseok Kim</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jan 22, 2020 at 3:09 PM Kim KS <<a href="mailto:kiseok7@gmail.com">kiseok7@gmail.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">Hello, Brin and Matt.<br>
and Thank you.<br>
<br>
I'll tell you more about my use case:<br>
<br>
* First, I create an instance(I'll call it NODE01) and a volume in same AZ.  (so I use 'cross_az_attach = False' option)<br>
* and I create a cinder volume(I'll call it PV01) in different Volume Zone(I'll call it KubePVZone)<br>
* and then I would like to attach PV01 volume to NODE01 instance.<br>
<br>
KubePVZone is volume zone for kubernetes's persistent volume and NODE01 is a kubernetes' node.<br>
KubePVZone's volumes can be attached to the other kubernetes's nodes.<br>
<br>
So I would like to use options like:<br>
<br>
    [cinder]<br>
    cross_az_attach = False<br>
    enable_az_attach_list = KubePVZone<br>
<br>
Let me know if there is a lack of explanation.<br>
<br>
I currently use the code by adding in to check_availability_zone method:<br>
<br>
<a href="https://github.com/openstack/nova/blob/058e77e26c1b52ab7d3a79a2b2991ca772318105/nova/volume/cinder.py#L534" rel="noreferrer" target="_blank">https://github.com/openstack/nova/blob/058e77e26c1b52ab7d3a79a2b2991ca772318105/nova/volume/cinder.py#L534</a><br>
<br>
+        if volume['availability_zone'] in CONF.cinder.enable_az_attach_list:<br>
+            LOG.info("allowed AZ for attaching in different availability zone: %s",<br>
+                 volume['availability_zone'])<br>
+            return<br>
<br>
Best,<br>
Kiseok Kim<br>
<br>
<br>
> 2020. 1. 21. 오전 11:35, Brin Zhang(张百林) <<a href="mailto:zhangbailin@inspur.com" target="_blank">zhangbailin@inspur.com</a>> 작성:<br>
> <br>
> Hi, Kim KS:<br>
>    "cross_az_attach"'s default value is True, that means a llow attach between instance and volume in different availability zones.<br>
>    If False, volumes attached to an instance must be in the same availability zone in Cinder as the instance availability zone in Nova. Another thing is, you should care booting an BFV instance from "image", and this should interact the " allow_availability_zone_fallback" in Cinder, if " allow_availability_zone_fallback=False" and *that* request AZ does not in Cinder, the request will be fail.<br>
> <br>
> <br>
> About specify AZ to unshelve a shelved_offloaded server, about the cross_az_attach something you can know<br>
> <a href="https://github.com/openstack/nova/blob/master/releasenotes/notes/bp-specifying-az-to-unshelve-server-aa355fef1eab2c02.yaml" rel="noreferrer" target="_blank">https://github.com/openstack/nova/blob/master/releasenotes/notes/bp-specifying-az-to-unshelve-server-aa355fef1eab2c02.yaml</a><br>
> <br>
> Availability Zones docs, that contains some description with cinder.cross_az_attach<br>
> <a href="https://docs.openstack.org/nova/latest/admin/availability-zones.html#implications-for-moving-servers" rel="noreferrer" target="_blank">https://docs.openstack.org/nova/latest/admin/availability-zones.html#implications-for-moving-servers</a> <br>
> <br>
> cross_az_attach configuration: <a href="https://docs.openstack.org/nova/train/configuration/config.html#cinder.cross_az_attach" rel="noreferrer" target="_blank">https://docs.openstack.org/nova/train/configuration/config.html#cinder.cross_az_attach</a> <br>
> <br>
> And cross_az_attach with the server is in<br>
> <a href="https://github.com/openstack/nova/blob/master/nova/volume/cinder.py#L523-L545" rel="noreferrer" target="_blank">https://github.com/openstack/nova/blob/master/nova/volume/cinder.py#L523-L545</a> <br>
> <br>
> I am not sure why you are need " enable_az_attach_list = AZ1,AZ2" configuration?<br>
> <br>
> brinzhang<br>
> <br>
> <br>
>> cross_az_attach<br>
>> <br>
>> Hello all,<br>
>> <br>
>> In nova with setting [cinder]/ cross_az_attach option to false, nova creates<br>
>> instance and volume in same AZ.<br>
>> <br>
>> but some of usecase (in my case), we need to attach new volume in different<br>
>> AZ to the instance.<br>
>> <br>
>> so I need two options.<br>
>> <br>
>> one is for nova block device mapping and attaching volume and another is for<br>
>> attaching volume in specified AZ.<br>
>> <br>
>>    [cinder]<br>
>>    cross_az_attach = False<br>
>>    enable_az_attach_list = AZ1,AZ2<br>
>> <br>
>> how do you all think of it?<br>
>> <br>
>> Best,<br>
>> Kiseok<br>
>> <br>
> <br>
</blockquote></div>