in selftest/selftest.py [0:0]
def get_scsi_resource_disk() -> Optional[str]:
"""Get the SCSI resource disk device."""
paths = [
# cloud-init udev rules
"/dev/disk/cloud/azure_resource",
# gen2
"/dev/disk/by-path/acpi-VMBUS:00-vmbus-f8b3781a1e824818a1c363d806ec15bb-lun-1",
# gen1
"/dev/disk/by-path/acpi-VMBUS:01-vmbus-000000000001*-lun-0",
]
for path in paths:
if "*" in path:
matched_paths = glob.glob(path)
for matched_path in matched_paths:
resolved_path = os.path.realpath(matched_path)
if os.path.exists(resolved_path):
return resolved_path.split("/")[-1]
else:
if os.path.exists(path):
resolved_path = os.path.realpath(path)
if os.path.exists(resolved_path):
return resolved_path.split("/")[-1]
logger.info("no SCSI resource disk found")
return None