-
Notifications
You must be signed in to change notification settings - Fork 112
Add instance storage discovery patterns in config #592
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Ivaylogi98
wants to merge
1
commit into
cloudfoundry:ubuntu-jammy
Choose a base branch
from
Ivaylogi98:ubuntu-jammy-add-instance-storage-patterns
base: ubuntu-jammy
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+3
−1
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: cloudfoundry/bosh-linux-stemcell-builder
Length of output: 769
🌐 Web query:
standard udev persistent storage nvme by-id Amazon Elastic Block Store Ubuntu Jammy💡 Result:
On Ubuntu Jammy (22.04 LTS) EC2 instances with Nitro-based hardware, Amazon EBS volumes appear as NVMe devices (/dev/nvmeXn1) with non-persistent enumeration order across reboots. Standard udev persistent storage uses /dev/disk/by-id symlinks based on model, serial (EBS volume ID), and namespace ID (e.g., nvme-Amazon_Elastic_Block_Store_vol-0123456789abcdef_1), provided by /usr/lib/udev/rules.d/60-persistent-storage.rules. For EBS-specific persistence matching block device mappings (e.g., /dev/sdf symlink to NVMe device), install amazon-ec2-utils package (version 1.4-1 in Jammy repos), which provides ebsnvme-id tool and installs /usr/lib/udev/rules.d/70-ec2-nvme-devices.rules. These rules run ebsnvme-id -u /dev/%k on "Amazon Elastic Block Store" model devices to create symlinks like /dev/sdf -> /dev/nvme1n1. To install: sudo apt update sudo apt install amazon-ec2-utils Example usage: - ebsnvme-id /dev/nvme0n1 --volume : vol-0123456789abcdef - ebsnvme-id /dev/nvme0n1 -u : sdf (for udev/symlink name) Use /dev/disk/by-id/nvme-Amazon_Elastic_Block_Store_VOLID_1 for scripts/fstab to avoid enumeration issues. Standard by-id is always available; EBS block mapping symlinks require amazon-ec2-utils.
Citations:
🏁 Script executed:
Repository: cloudfoundry/bosh-linux-stemcell-builder
Length of output: 1193
🏁 Script executed:
Repository: cloudfoundry/bosh-linux-stemcell-builder
Length of output: 1065
🏁 Script executed:
Repository: cloudfoundry/bosh-linux-stemcell-builder
Length of output: 1515
🌐 Web query:
bosh-agent InstanceStorageDevicePattern InstanceStorageManagedVolumePattern implementation how used💡 Result:
No public sources explicitly document "InstanceStorageDevicePattern" or "InstanceStorageManagedVolumePattern" in the context of bosh-agent. These terms do not appear in official BOSH documentation, GitHub repositories for cloudfoundry/bosh-agent, or related CPIs (e.g., AWS, vSphere, Google). Bosh-agent handles disk settings via /var/vcap/bosh/settings.json, parsing ephemeral, persistent, system, and raw_ephemeral disks from CPI-provided data. It uses DiskSettings struct to extract path, volume_id, id, lun, etc., for mounting and partitioning. For instance storage (e.g., AWS NVMe/local disks), CPIs like bosh-aws-cpi configure block device mappings and raw_instance_storage: true exposes all disks as raw-ephemeral-* labels for jobs. The agent resolves device paths using strategies like virtio, scsi, iscsi via DevicePathResolver, with options like StripVolumeRegex for ID matching (/dev/disk/by-id). These patterns may be internal CPI-specific (e.g., GoogleCPI or custom) for distinguishing managed volumes vs. instance-local storage, but no implementation details found. Likely used by CPIs to populate agent disk settings for proper resolution/mounting of local ephemeral storage vs. managed persistent volumes.
Citations:
🏁 Script executed:
Repository: cloudfoundry/bosh-linux-stemcell-builder
Length of output: 783
🌐 Web query:
bosh-aws-cpi InstanceStorageDevicePattern device pattern matching ephemeral storage💡 Result:
In the BOSH AWS CPI, there is no config key or code path named “InstanceStorageDevicePattern” for matching instance-storage devices. What the CPI actually does for ephemeral/instance storage device “pattern matching” is: 1) When you enable raw instance storage (raw_instance_storage: true) - BOSH tells the agent to partition and label each instance-storage disk with part labels matching the pattern raw-ephemeral-. - Your job is then to locate these disks inside the VM using /dev/disk/by-partlabel/raw-ephemeral- - Example (from docs): ls -la /dev/disk/by-partlabel/raw-ephemeral-* 2) How this relates to “ephemeral storage” - All BOSH-managed VMs must store ephemeral data; BOSH prefers first instance-storage disk when available, otherwise it creates a separate EBS volume to use as an ephemeral disk. 3) How disk selection is configured - The AWS CPI supports instance-storage-backed ephemeral disks in two ways: a) raw_instance_storage: true (access to all instance storage disks; labels them raw-ephemeral-) b) cloud_properties.ephemeral_disk.use_instance_storage (use instance storage for the ephemeral disk instead of EBS), with safeguards: - raw_instance_storage? cannot be combined with ephemeral_disk.use_instance_storage - use_instance_storage requires the chosen instance type to actually have instance storage So if your goal is “matching ephemeral storage devices” in the guest OS, the authoritative pattern you’re looking for is the agent partlabel pattern raw-ephemeral-, not an “InstanceStorageDevicePattern”.
Citations:
🏁 Script executed:
Repository: cloudfoundry/bosh-linux-stemcell-builder
Length of output: 50400
🌐 Web query:
bosh-linux-stemcell-builder InstanceStorageDevicePattern AWS ephemeral device matching💡 Result:
There isn’t an “InstanceStorageDevicePattern” setting in bosh-linux-stemcell-builder (stemcells don’t define the AWS ephemeral-device mapping pattern). Instead, AWS ephemeral disks are handled at deploy/runtime by the BOSH AWS CPI + bosh-agent. What’s available / relevant in AWS instance-storage (ephemeral) handling: - BOSH documents that with multiple instance-storage disks attached, bosh-agent partitions and labels them with the label pattern raw-ephemeral-, and you can discover them via: /dev/disk/by-partlabel/raw-ephemeral- - Example output shows symlinks like /dev/disk/by-partlabel/raw-ephemeral-0 -> ../../xvdba1 and raw-ephemeral-1 -> ../../xvdbb1. So, for “AWS ephemeral device matching”, the authoritative match pattern exposed to jobs/release tasks is the by-partlabel prefix raw-ephemeral-, not an InstanceStorageDevicePattern from the stemcell builder. Where the mapping/devices are defined (for context): - In the BOSH AWS CPI code, the “first raw ephemeral device” is selected per virtualization type; e.g. for hvm on i3/i3en it uses /dev/nvme0n1, otherwise /dev/xvdba. Additional raw ephemeral mappings are then derived by stepping to next raw ephemeral disks. If your goal is to locate ephemeral instance-storage devices inside a BOSH VM: use /dev/disk/by-partlabel/raw-ephemeral- (agent-managed), rather than trying to match /dev/xvd* or /dev/nvme* by a custom pattern.
Citations:
🏁 Script executed:
Repository: cloudfoundry/bosh-linux-stemcell-builder
Length of output: 1553
🌐 Web query:
bosh-agent go code DiskSettings device pattern matching AWS EBS NVMe💡 Result:
In the BOSH agent Go code, DiskSettings (from boshsettings package) holds disk identification fields like ID, VolumeID, Path, DeviceID for persistent/ephemeral disks provided by the CPI. The linux_platform.go uses a DevicePathResolver (boshdpresolv package) to resolve the real kernel device path via GetRealDevicePath(diskSetting), which symlinks it for association/mounting (e.g., AssociateDisk, MountPersistentDisk). Resolution strategies are configurable via LinuxOptions.DevicePathResolutionType ("virtio", "scsi", "iscsi", or default), using specialized resolvers like virtioDevicePathResolver or idDevicePathResolver. These scan directories like /dev/disk/by-id/ for matches against disk ID/VolumeID, falling back to path/mapped resolution if needed (e.g., timeouts noted for AWS vol- IDs in issues). For AWS EBS NVMe (Nitro instances like c5/m5), the AWS CPI maps to stable paths like /dev/disk/by-id/nvme-Amazon_Elastic_Block_Store_ (from block_device_manager.rb) or /dev/nvmeXn1. Symlinks in /dev/disk/by-id/ enable pattern matching: resolvers glob/lookup symlinks containing the transformed VolumeID (e.g., vol-xxx -> nvme-Amazon...volxxx). AWS docs confirm NVMe devices /dev/nvmen; ebsnvme-id maps vol IDs to names. DiskIDTransformPattern/Replace in LinuxOptions allows regex transform of IDs for symlink matching (e.g., "^(vol-.*)$" -> "${1}"). partitionPath derives /dev/p1 from device path. Sources confirm fallback to path resolution works reliably on AWS despite by-id mismatches; NVMe order varies, so ID/symlink matching ensures stability.
Citations:
These config fields are not used by bosh-agent and have no implementation.
Lines 15-16 add
InstanceStorageDevicePatternandInstanceStorageManagedVolumePatternto the agent config, but:DevicePathResolutionType(already present in the config) withDevicePathResolverstrategies that match disks via/dev/disk/by-id/symlinks using diskVolumeIDand optionalDIDTransformPatternregex transforms.Either:
🤖 Prompt for AI Agents