Skip to content
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

add DiskIDTransform Rules #403

Merged
merged 13 commits into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
"Linux": {
"PartitionerType": "parted",
"CreatePartitionIfNoEphemeralDisk": true,
"DevicePathResolutionType": "virtio"
"DevicePathResolutionType": "virtio",
"ServiceManager": "systemd",
"DiskIDTransformPattern": "^d-(.+)$",
"DiskIDTransformReplacement": "virtio-${1}"
}
},
"Infrastructure": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Introduction
The problem that we have is that the diskID provided by the IAAS does not correspond with the diskID on the vm
as you can see in the related information part.
beyhan marked this conversation as resolved.
Show resolved Hide resolved
Therefore we are trying to mitigate this issue by using diskIdTransformation as you can see in the example below
beyhan marked this conversation as resolved.
Show resolved Hide resolved

Do note that if this fails it will always fallback to other means of mounting the disk

## Disk ID transform rules
the following 2 json entries
```
"DiskIDTransformPattern": "^d-(.+)$",
"DiskIDTransformReplacement": "virtio-${1}"
```

## what it does
the `DiskIDTransformPattern` will match `d-gw8ibkvqdrmdqzwpo4rk` in to 2 groups `d-` and `gw8ibkvqdrmdqzwpo4rk`
the `DiskIDTransformReplacement` will match and replace `gw8ibkvqdrmdqzwpo4rk` with `virtio-gw8a1q0dqyqmcjrnetpj`

the agent will then glob and mount `/dev/disk/by-id/virtio-gw8a1q0dqyqmcjrnetpj`

## related information
contents of `persistent_disk_hints.json`
```
{
"d-gw8ibkvqdrmdqzwpo4rk": {
"ID": "d-gw8ibkvqdrmdqzwpo4rk",
"DeviceID": "",
"VolumeID": "/dev/disk/by-id/virtio-gw8ibkvqdrmdqzwpo4rk",
"Lun": "",
"HostDeviceID": "",
"Path": "/dev/disk/by-id/virtio-gw8ibkvqdrmdqzwpo4rk",
"ISCSISettings": {
"InitiatorName": "",
"Username": "",
"Target": "",
"Password": ""
},
"FileSystemType": "",
"MountOptions": null,
"Partitioner": ""
}
}
```
files listed in `/dev/disk/by-id`
```
virtio-gw8a1q0dqyqmcjrnetpj
virtio-gw8a1q0dqyqmcjrnetpj-part1
virtio-gw8a1q0dqyqmcjrnetpj-part2
virtio-gw8au7up14j66ge6u4vs
virtio-gw8au7up14j66ge6u4vs-part1
virtio-gw8ibkvqdrmdqzwpo4rk
virtio-gw8ibkvqdrmdqzwpo4rk-part1
```
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
"PartitionerType": "parted",
"DevicePathResolutionType": "virtio",
"CreatePartitionIfNoEphemeralDisk": true,
"ServiceManager": "systemd"
"ServiceManager": "systemd",
"DiskIDTransformPattern": "^vol-(.+)$",
"DiskIDTransformReplacement": "nvme-Amazon_Elastic_Block_Store_vol${1}"
}
},
"Infrastructure": {
Expand Down
68 changes: 68 additions & 0 deletions stemcell_builder/stages/bosh_aws_agent_settings/assets/agent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Introduction
The problem that we have is that the diskID provided by the IAAS does not correspond with the diskID on the vm
as you can see in the related information part.
beyhan marked this conversation as resolved.
Show resolved Hide resolved
Therefore we are trying to mitigate this issue by using diskIdTransformation as you can see in the example below
beyhan marked this conversation as resolved.
Show resolved Hide resolved

Do note that if this fails it will always fallback to other means of mounting the disk

## Disk ID transform rules
the following 2 json entries
```
"DiskIDTransformPattern": "^vol-(.+)$",
"DiskIDTransformReplacement": "nvme-Amazon_Elastic_Block_Store_vol${1}"
```

## what it does
the `DiskIDTransformPattern` will match `vol-04b2a40747d7e9625` in to 1 group `04b2a40747d7e9625`
the `DiskIDTransformReplacement` will match and replace `04b2a40747d7e9625` with `nvme-Amazon_Elastic_Block_Store_vol04b2a40747d7e9625`

the agent will then glob and mount `/dev/disk/by-id/nvme-Amazon_Elastic_Block_Store_vol04b2a40747d7e9625`

## related information
contents of persistent_disk_hints.json
```
{
"vol-04b2a40747d7e9625": {
"ID": "vol-04b2a40747d7e9625",
"DeviceID": "",
"VolumeID": "/dev/disk/by-id/nvme-Amazon_Elastic_Block_Store_vol04b2a40747d7e9625",
"Lun": "",
"HostDeviceID": "",
"Path": "/dev/disk/by-id/nvme-Amazon_Elastic_Block_Store_vol04b2a40747d7e9625",
"ISCSISettings": {
"InitiatorName": "",
"Username": "",
"Target": "",
"Password": ""
},
"FileSystemType": "",
"MountOptions": null,
"Partitioner": ""
}
}
```

files listed in `/dev/disk/by-id`
```
nvme-Amazon_Elastic_Block_Store_vol04b2a40747d7e9625
nvme-Amazon_Elastic_Block_Store_vol04b2a40747d7e9625_1
nvme-Amazon_Elastic_Block_Store_vol04b2a40747d7e9625_1-part1
nvme-Amazon_Elastic_Block_Store_vol04b2a40747d7e9625-part1
nvme-Amazon_Elastic_Block_Store_vol0c2ee6da5d33b8f8b
nvme-Amazon_Elastic_Block_Store_vol0c2ee6da5d33b8f8b_1
nvme-Amazon_Elastic_Block_Store_vol0c2ee6da5d33b8f8b_1-part1
nvme-Amazon_Elastic_Block_Store_vol0c2ee6da5d33b8f8b_1-part2
nvme-Amazon_Elastic_Block_Store_vol0c2ee6da5d33b8f8b-part1
nvme-Amazon_Elastic_Block_Store_vol0c2ee6da5d33b8f8b-part2
nvme-Amazon_Elastic_Block_Store_vol0c67d3300b92fe851
nvme-Amazon_Elastic_Block_Store_vol0c67d3300b92fe851_1
nvme-Amazon_Elastic_Block_Store_vol0c67d3300b92fe851_1-part1
nvme-Amazon_Elastic_Block_Store_vol0c67d3300b92fe851-part1
nvme-nvme.1d0f-766f6c3034623261343037343764376539363235-416d617a6f6e20456c617374696320426c6f636b2053746f7265-00000001
nvme-nvme.1d0f-766f6c3034623261343037343764376539363235-416d617a6f6e20456c617374696320426c6f636b2053746f7265-00000001-part1
nvme-nvme.1d0f-766f6c3063326565366461356433336238663862-416d617a6f6e20456c617374696320426c6f636b2053746f7265-00000001
nvme-nvme.1d0f-766f6c3063326565366461356433336238663862-416d617a6f6e20456c617374696320426c6f636b2053746f7265-00000001-part1
nvme-nvme.1d0f-766f6c3063326565366461356433336238663862-416d617a6f6e20456c617374696320426c6f636b2053746f7265-00000001-part2
nvme-nvme.1d0f-766f6c3063363764333330306239326665383531-416d617a6f6e20456c617374696320426c6f636b2053746f7265-00000001
nvme-nvme.1d0f-766f6c3063363764333330306239326665383531-416d617a6f6e20456c617374696320426c6f636b2053746f7265-00000001-part1
```
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
"PartitionerType": "parted",
"DevicePathResolutionType": "virtio",
"VirtioDevicePrefix": "google",
"ServiceManager": "systemd"
"ServiceManager": "systemd",
"DiskIDTransformPattern": "^(disk-.+)$",
"DiskIDTransformReplacement": "google-${1}"
}
},
"Infrastructure": {
Expand Down
62 changes: 62 additions & 0 deletions stemcell_builder/stages/bosh_google_agent_settings/assets/agent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Introduction
The problem that we have is that the diskID provided by the IAAS does not correspond with the diskID on the vm
as you can see in the related information part.
beyhan marked this conversation as resolved.
Show resolved Hide resolved
Therefore we are trying to mitigate this issue by using diskIdTransformation as you can see in the example below
beyhan marked this conversation as resolved.
Show resolved Hide resolved

Do note that if this fails it will always fallback to other means of mounting the disk

## Disk ID transform rules
the following 2 json entries
```
"DiskIDTransformPattern": "^(disk-.+)$",
"DiskIDTransformReplacement": "google-${1}"
```

## what it does
the `DiskIDTransformPattern` will match `disk-69e53b13-76b3-4400-4437-633782a5cbb5` in to 1 group `disk-69e53b13-76b3-4400-4437-633782a5cbb5`
the `DiskIDTransformReplacement` will match and replace ``disk-69e53b13-76b3-4400-4437-633782a5cbb5` with `google-disk-69e53b13-76b3-4400-4437-633782a5cbb5`

the agent will then glob and mount `/dev/disk/by-id/google-disk-69e53b13-76b3-4400-4437-633782a5cbb5`

## related information
contents of `persistent_disk_hints.json`
```
{
"disk-69e53b13-76b3-4400-4437-633782a5cbb5": {
"ID": "disk-69e53b13-76b3-4400-4437-633782a5cbb5",
"DeviceID": "",
"VolumeID": "/dev/sdb",
"Lun": "",
"HostDeviceID": "",
"Path": "/dev/sdb",
"ISCSISettings": {
"InitiatorName": "",
"Username": "",
"Target": "",
"Password": ""
},
"FileSystemType": "",
"MountOptions": null,
"Partitioner": ""
}
}
```

files listed in `/dev/disk/by-id`
```
google-disk-69e53b13-76b3-4400-4437-633782a5cbb5
google-disk-69e53b13-76b3-4400-4437-633782a5cbb5-part1
google-persistent-disk-0
google-persistent-disk-0-part1
google-persistent-disk-0-part2
google-persistent-disk-0-part3
google-persistent-disk-0-part4
scsi-0Google_PersistentDisk_disk-69e53b13-76b3-4400-4437-633782a5cbb5
scsi-0Google_PersistentDisk_disk-69e53b13-76b3-4400-4437-633782a5cbb5-part1
scsi-0Google_PersistentDisk_persistent-disk-0
scsi-0Google_PersistentDisk_persistent-disk-0-part1
scsi-0Google_PersistentDisk_persistent-disk-0-part2
scsi-0Google_PersistentDisk_persistent-disk-0-part3
scsi-0Google_PersistentDisk_persistent-disk-0-part4
```nvme.1d0f-766f6c3063363764333330306239326665383531-416d617a6f6e20456c617374696320426c6f636b2053746f7265-00000001-part1
```
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
"PartitionerType": "parted",
"CreatePartitionIfNoEphemeralDisk": true,
"DevicePathResolutionType": "virtio",
"ServiceManager": "systemd"
"ServiceManager": "systemd",
"DiskIDTransformPattern": "^([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$",
"DiskIDTransformReplacement": "scsi-${1}${2}${3}${4}${5}"
}
},
"Infrastructure": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Introduction
The problem that we have is that the diskID provided by the IAAS does not correspond with the diskID on the vm
as you can see in the related information part.
beyhan marked this conversation as resolved.
Show resolved Hide resolved
Therefore we are trying to mitigate this issue by using diskIdTransformation as you can see in the example below
beyhan marked this conversation as resolved.
Show resolved Hide resolved

Do note that if this fails it will always fallback to other means of mounting the disk

## Disk ID transform rules
the following 2 json entries
```
"DiskIDTransformPattern": "^([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$",
"DiskIDTransformReplacement": "scsi-${1}${2}${3}${4}${5}"
```

## what it does
the `DiskIDTransformPattern` will match `05c185c6-e8a3-4216-ab30-1f5cf7d17f0d` in to 5 groups `05c185c6`, `e8a3`, `4216`, `ab30`, `1f5cf7d17f0d`
the `DiskIDTransformReplacement` will match and replace `scsi-` with the 5 groups `scsi-305c185c6e8a34216ab301f5cf7d17f0d`

the agent will then glob and mount `/dev/disk/by-id/scsi-305c185c6e8a34216ab301f5cf7d17f0d`

## related information
contents of `persistent_disk_hints.json`
```
{
"05c185c6-e8a3-4216-ab30-1f5cf7d17f0d": {
"ID": "05c185c6-e8a3-4216-ab30-1f5cf7d17f0d",
"DeviceID": "",
"VolumeID": "/dev/sdb",
"Lun": "",
"HostDeviceID": "",
"Path": "/dev/sdb",
"ISCSISettings": {
"InitiatorName": "",
"Username": "",
"Target": "",
"Password": ""
},
"FileSystemType": "",
"MountOptions": null,
"Partitioner": ""
}
}
```

files listed in `/dev/disk/by-id`
```
scsi-305c185c6e8a34216ab301f5cf7d17f0d
scsi-305c185c6e8a34216ab301f5cf7d17f0d-part1
scsi-36000c295e04c2c9a4b447d59632b887b
scsi-36000c295e04c2c9a4b447d59632b887b-part1
scsi-36000c295e04c2c9a4b447d59632b887b-part2
scsi-36000c295e04c2c9a4b447d59632b887b-part3
wwn-0x05c185c6e8a34216ab301f5cf7d17f0d
wwn-0x05c185c6e8a34216ab301f5cf7d17f0d-part1
wwn-0x6000c295e04c2c9a4b447d59632b887b
wwn-0x6000c295e04c2c9a4b447d59632b887b-part1
wwn-0x6000c295e04c2c9a4b447d59632b887b-part2
wwn-0x6000c295e04c2c9a4b447d59632b887b-part3
```