nanovms / ops

ops - build and run nanos unikernels
https://ops.city
MIT License
1.3k stars 132 forks source link

Volume attach: add support for specifying attachment point #1299

Closed francescolavra closed 2 years ago

francescolavra commented 2 years ago

This PR adds to the volume attach command the option to specify a volume identifier argument with format %<attach_id>:<volume_name> (where is an integer number indicating an attachment point) instead of <volume_name>. Example: ops volume attach myInstance %1:myVolume attaches the volume identified by myVolume to an instance using 1 as attachment point. The allowed values for the attachment point vary based on the deployment target; currently, this feature is only implemented for the AWS cloud provider, where the valid range for attachment points is [1-25]. If the attachment point is not specified in a volume attach command, a suitable attachment point is chosen automatically.

The attachment point can be used (alternatively to the volume name) to identify a volume in a mount directive. For example, the --mounts %1:/mnt command line option (or alternatively the "Mounts": {"%1": "/mnt"} JSON attribute in the configuration file) can be used to mount the volume with attachment point 1 in the /mnt directory.