66-azure-ephemeral.rules 1.9 KB

12345678910111213141516171819202122232425262728293031323334
  1. # Azure specific rules
  2. ACTION!="add|change", GOTO="cloud_init_end"
  3. SUBSYSTEM!="block", GOTO="cloud_init_end"
  4. ATTRS{ID_VENDOR}!="Msft", GOTO="cloud_init_end"
  5. ATTRS{ID_MODEL}!="Virtual_Disk", GOTO="cloud_init_end"
  6. # Root has a GUID of 0000 as the second value on Gen1 instances
  7. # The resource/resource has GUID of 0001 as the second value
  8. ATTRS{device_id}=="?00000000-0000-*", ENV{fabric_name}="azure_root", GOTO="ci_azure_names"
  9. ATTRS{device_id}=="?00000000-0001-*", ENV{fabric_name}="azure_resource", GOTO="ci_azure_names"
  10. # Azure well known SCSI controllers on Gen2 instances
  11. ATTRS{device_id}=="{f8b3781a-1e82-4818-a1c3-63d806ec15bb}", ENV{fabric_scsi_controller}="scsi0", GOTO="azure_datadisk"
  12. # Do not create symlinks for scsi[1-3] or unmatched device_ids
  13. ATTRS{device_id}=="{f8b3781b-1e82-4818-a1c3-63d806ec15bb}", ENV{fabric_scsi_controller}="scsi1", GOTO="cloud_init_end"
  14. ATTRS{device_id}=="{f8b3781c-1e82-4818-a1c3-63d806ec15bb}", ENV{fabric_scsi_controller}="scsi2", GOTO="cloud_init_end"
  15. ATTRS{device_id}=="{f8b3781d-1e82-4818-a1c3-63d806ec15bb}", ENV{fabric_scsi_controller}="scsi3", GOTO="cloud_init_end"
  16. GOTO="cloud_init_end"
  17. # Map scsi#/lun# fabric_name to azure_root|resource on Gen2 instances
  18. LABEL="azure_datadisk"
  19. 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"
  20. 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"
  21. ENV{fabric_name}=="scsi0/lun0", ENV{fabric_name}="azure_root", GOTO="ci_azure_names"
  22. ENV{fabric_name}=="scsi0/lun1", ENV{fabric_name}="azure_resource", GOTO="ci_azure_names"
  23. GOTO="cloud_init_end"
  24. # Create the symlinks
  25. LABEL="ci_azure_names"
  26. ENV{DEVTYPE}=="disk", SYMLINK+="disk/cloud/$env{fabric_name}"
  27. ENV{DEVTYPE}=="partition", SYMLINK+="disk/cloud/$env{fabric_name}-part%n"
  28. LABEL="cloud_init_end"