shuffling the disks to check for an unattached volume wastes time.
We should try to have the syntax filter only the unattached disks and then wait for one to appear (looks like we're already doing this for AWS:
|
UNATTACHED_VOLUME_ID="$(aws ec2 describe-volumes --region $aws_region --filters Name=tag:ClusterName,Values=$es_cluster Name=tag:AutoAttachGroup,Values=$INSTANCE_ROLE Name=availability-zone,Values=$AV_ZONE | jq -r '.Volumes[] | select(.Attachments | length == 0) | .VolumeId' | shuf -n 1)" |
)
If we can't filter, then we should iterate on the list of disks, and then get the list again in case a new disk has appeared.
https://github.com/BigDataBoutique/elasticsearch-cloud-deploy/blob/master/assets/scripts/aws/autoattach-disk.sh
|
UNATTACHED_VOLUME_ID="$(gcloud compute disks list --filter="zone=$GCP_ZONE AND labels.cluster-name=$es_cluster AND labels.auto-attach-group=$INSTANCE_ROLE" --format json | jq -r '.[] | .name' | shuf -n 1)" |
shuffling the disks to check for an unattached volume wastes time.
We should try to have the syntax filter only the unattached disks and then wait for one to appear (looks like we're already doing this for AWS:
elasticsearch-cloud-deploy/assets/scripts/aws/autoattach-disk.sh
Line 12 in 4112f84
If we can't filter, then we should iterate on the list of disks, and then get the list again in case a new disk has appeared.
https://github.com/BigDataBoutique/elasticsearch-cloud-deploy/blob/master/assets/scripts/aws/autoattach-disk.sh
elasticsearch-cloud-deploy/assets/scripts/gcp/autoattach-disk.sh
Line 9 in 4112f84