[AWS] Fix: override disk when mounted on same device name #97
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
When two disks are mounted on the same device name, we need to use the value of the override. Typically this happens when a root disk size is set in the AMI and the EC2 instance sets a bigger size of this root disk.
New storage mapping extension
So, in disk mapping we introduce two optional properties for storage items:
key
andoverride_priority
:If we have many disks set on the same device name, they will be ordered by
override_priority
and pick the lowest. Typically the disk set in the EC2 instance definition on/dev/sda1
will override the disk set in the AMI on/dev/sda1
Those new properties are optional, if not see the
key
will be""
(empty string) and no override mechanism will be applied to storage with no key set (case of GCP or ephemeral storage)Case AWS device naming
On AWS, device name can be either in form of or
/dev/nvme1n1
, and they are both the same (cf aws doc)! In that case, an other custom jq method is introduced:This function will pick the significative letter of the device name (example both
/dev/sda1
or/dev/xvda
will be translated toa
) or the corresponding letter for nvme (example:/dev/nvme3n1
, the significative number is 3 and the corresponding letter will bec
)