summaryrefslogtreecommitdiff
path: root/udev/66-azure-ephemeral.rules
diff options
context:
space:
mode:
authorChad Smith <chad.smith@canonical.com>2018-11-08 04:35:56 +0000
committerServer Team CI Bot <josh.powers+server-team-bot@canonical.com>2018-11-08 04:35:56 +0000
commit3b332c93f765c9208f7e059d8a0c2463f7ffe12a (patch)
treeccff1df40c421cd67ed33a28b762c4754dde338e /udev/66-azure-ephemeral.rules
parent093f968013f418d591d9e778a57b2f050ac30db3 (diff)
downloadvyos-cloud-init-3b332c93f765c9208f7e059d8a0c2463f7ffe12a.tar.gz
vyos-cloud-init-3b332c93f765c9208f7e059d8a0c2463f7ffe12a.zip
azure: add udev rules to create cloud-init Gen2 disk name symlinks
Cloud-init delivers udev rules on Azure to create the following symlinks: - /dev/disk/cloud/azure_root - /dev/disk/cloud/azure_root-part# - /dev/disk/cloud/azure_resource - /dev/disk/cloud/azure_resource-part# Cloud-init cc_disk_setup expects presence of these dev links in order to setup the mounted ephemeral disks. Gen1 instances udev rules match based only a DEVICE_ID attribute that no longer exists on Gen2 instances. Supplement existing Gen1 rules with matches on specitic SCSI target/lun path 0:0:0 and 0:0:1 and generate links for azure_root and azure_resource respectively. LP: #1797480
Diffstat (limited to 'udev/66-azure-ephemeral.rules')
-rw-r--r--udev/66-azure-ephemeral.rules18
1 files changed, 17 insertions, 1 deletions
diff --git a/udev/66-azure-ephemeral.rules b/udev/66-azure-ephemeral.rules
index b9c5c3ef..3032f7e1 100644
--- a/udev/66-azure-ephemeral.rules
+++ b/udev/66-azure-ephemeral.rules
@@ -4,10 +4,26 @@ SUBSYSTEM!="block", GOTO="cloud_init_end"
ATTRS{ID_VENDOR}!="Msft", GOTO="cloud_init_end"
ATTRS{ID_MODEL}!="Virtual_Disk", GOTO="cloud_init_end"
-# Root has a GUID of 0000 as the second value
+# Root has a GUID of 0000 as the second value on Gen1 instances
# The resource/resource has GUID of 0001 as the second value
ATTRS{device_id}=="?00000000-0000-*", ENV{fabric_name}="azure_root", GOTO="ci_azure_names"
ATTRS{device_id}=="?00000000-0001-*", ENV{fabric_name}="azure_resource", GOTO="ci_azure_names"
+
+# Azure well known SCSI controllers on Gen2 instances
+ATTRS{device_id}=="{f8b3781a-1e82-4818-a1c3-63d806ec15bb}", ENV{fabric_scsi_controller}="scsi0", GOTO="azure_datadisk"
+# Do not create symlinks for scsi[1-3] or unmatched device_ids
+ATTRS{device_id}=="{f8b3781b-1e82-4818-a1c3-63d806ec15bb}", ENV{fabric_scsi_controller}="scsi1", GOTO="cloud_init_end"
+ATTRS{device_id}=="{f8b3781c-1e82-4818-a1c3-63d806ec15bb}", ENV{fabric_scsi_controller}="scsi2", GOTO="cloud_init_end"
+ATTRS{device_id}=="{f8b3781d-1e82-4818-a1c3-63d806ec15bb}", ENV{fabric_scsi_controller}="scsi3", GOTO="cloud_init_end"
+GOTO="cloud_init_end"
+
+# Map scsi#/lun# fabric_name to azure_root|resource on Gen2 instances
+LABEL="azure_datadisk"
+ENV{DEVTYPE}=="partition", PROGRAM="/bin/sh -c 'readlink /sys/class/block/%k/../device|cut -d: -f4'", ENV{fabric_name}="$env{fabric_scsi_controller}/lun$result"
+ENV{DEVTYPE}=="disk", PROGRAM="/bin/sh -c 'readlink /sys/class/block/%k/device|cut -d: -f4'", ENV{fabric_name}="$env{fabric_scsi_controller}/lun$result"
+
+ENV{fabric_name}=="scsi0/lun0", ENV{fabric_name}="azure_root", GOTO="ci_azure_names"
+ENV{fabric_name}=="scsi0/lun1", ENV{fabric_name}="azure_resource", GOTO="ci_azure_names"
GOTO="cloud_init_end"
# Create the symlinks