Hello all,

Can I add the code I used above to the NOVA upstream code?

Two changes:
* add option "enable_az_attach_list" in nove/[cinder]
* passing checking availability zone in check_availability_zone function if there is enable_az_attach_list

Thanks,

Kiseok Kim


On Wed, Jan 22, 2020 at 3:09 PM Kim KS <kiseok7@gmail.com> wrote:
Hello, Brin and Matt.
and Thank you.

I'll tell you more about my use case:

* First, I create an instance(I'll call it NODE01) and a volume in same AZ.  (so I use 'cross_az_attach = False' option)
* and I create a cinder volume(I'll call it PV01) in different Volume Zone(I'll call it KubePVZone)
* and then I would like to attach PV01 volume to NODE01 instance.

KubePVZone is volume zone for kubernetes's persistent volume and NODE01 is a kubernetes' node.
KubePVZone's volumes can be attached to the other kubernetes's nodes.

So I would like to use options like:

    [cinder]
    cross_az_attach = False
    enable_az_attach_list = KubePVZone

Let me know if there is a lack of explanation.

I currently use the code by adding in to check_availability_zone method:

https://github.com/openstack/nova/blob/058e77e26c1b52ab7d3a79a2b2991ca772318105/nova/volume/cinder.py#L534

+        if volume['availability_zone'] in CONF.cinder.enable_az_attach_list:
+            LOG.info("allowed AZ for attaching in different availability zone: %s",
+                 volume['availability_zone'])
+            return

Best,
Kiseok Kim


> 2020. 1. 21. 오전 11:35, Brin Zhang(张百林) <zhangbailin@inspur.com> 작성:
>
> Hi, Kim KS:
>    "cross_az_attach"'s default value is True, that means a llow attach between instance and volume in different availability zones.
>    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.
>
>
> About specify AZ to unshelve a shelved_offloaded server, about the cross_az_attach something you can know
> https://github.com/openstack/nova/blob/master/releasenotes/notes/bp-specifying-az-to-unshelve-server-aa355fef1eab2c02.yaml
>
> Availability Zones docs, that contains some description with cinder.cross_az_attach
> https://docs.openstack.org/nova/latest/admin/availability-zones.html#implications-for-moving-servers
>
> cross_az_attach configuration: https://docs.openstack.org/nova/train/configuration/config.html#cinder.cross_az_attach
>
> And cross_az_attach with the server is in
> https://github.com/openstack/nova/blob/master/nova/volume/cinder.py#L523-L545
>
> I am not sure why you are need " enable_az_attach_list = AZ1,AZ2" configuration?
>
> brinzhang
>
>
>> cross_az_attach
>>
>> Hello all,
>>
>> In nova with setting [cinder]/ cross_az_attach option to false, nova creates
>> instance and volume in same AZ.
>>
>> but some of usecase (in my case), we need to attach new volume in different
>> AZ to the instance.
>>
>> so I need two options.
>>
>> one is for nova block device mapping and attaching volume and another is for
>> attaching volume in specified AZ.
>>
>>    [cinder]
>>    cross_az_attach = False
>>    enable_az_attach_list = AZ1,AZ2
>>
>> how do you all think of it?
>>
>> Best,
>> Kiseok
>>
>