1# Azure specific rules.
2ACTION!="add|change", GOTO="walinuxagent_end"
3SUBSYSTEM!="block", GOTO="walinuxagent_end"
4ATTRS{ID_VENDOR}!="Msft", GOTO="walinuxagent_end"
5ATTRS{ID_MODEL}!="Virtual_Disk", GOTO="walinuxagent_end"
6
7# Match the known ID parts for root and resource disks.
8ATTRS{device_id}=="?00000000-0000-*", ENV{fabric_name}="root", GOTO="wa_azure_names"
9ATTRS{device_id}=="?00000000-0001-*", ENV{fabric_name}="resource", GOTO="wa_azure_names"
10
11# Gen2 disk.
12ATTRS{device_id}=="{f8b3781a-1e82-4818-a1c3-63d806ec15bb}", ENV{fabric_scsi_controller}="scsi0", GOTO="azure_datadisk"
13# Create symlinks for data disks attached.
14ATTRS{device_id}=="{f8b3781b-1e82-4818-a1c3-63d806ec15bb}", ENV{fabric_scsi_controller}="scsi1", GOTO="azure_datadisk"
15ATTRS{device_id}=="{f8b3781c-1e82-4818-a1c3-63d806ec15bb}", ENV{fabric_scsi_controller}="scsi2", GOTO="azure_datadisk"
16ATTRS{device_id}=="{f8b3781d-1e82-4818-a1c3-63d806ec15bb}", ENV{fabric_scsi_controller}="scsi3", GOTO="azure_datadisk"
17GOTO="walinuxagent_end"
18
19# Parse out the fabric n ame based off of scsi indicators.
20LABEL="azure_datadisk"
21ENV{DEVTYPE}=="partition", PROGRAM="/bin/sh -c 'readlink /sys/class/block/%k/../device|cut -d: -f4'", ENV{fabric_name}="$env{fabric_scsi_controller}/lun$result"
22ENV{DEVTYPE}=="disk", PROGRAM="/bin/sh -c 'readlink /sys/class/block/%k/device|cut -d: -f4'", ENV{fabric_name}="$env{fabric_scsi_controller}/lun$result"
23
24ENV{fabric_name}=="scsi0/lun0", ENV{fabric_name}="root"
25ENV{fabric_name}=="scsi0/lun1", ENV{fabric_name}="resource"
26# Don't create a symlink for the cd-rom.
27ENV{fabric_name}=="scsi0/lun2", GOTO="walinuxagent_end"
28
29# Create the symlinks.
30LABEL="wa_azure_names"
31ENV{DEVTYPE}=="disk", SYMLINK+="disk/azure/$env{fabric_name}"
32ENV{DEVTYPE}=="partition", SYMLINK+="disk/azure/$env{fabric_name}-part%n"
33
34LABEL="walinuxagent_end"
35