Skip to content

Commit

Permalink
Update disks.py
Browse files Browse the repository at this point in the history
  • Loading branch information
SRIKKANTH committed Nov 23, 2024
1 parent 80ae08e commit 7ac69ad
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions lisa/features/disks.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,18 +105,24 @@ def get_os_boot_partition(self) -> Optional[PartitionInfo]:
break
return boot_partition

def get_disc_type(self, disk: str) -> schema.StorageInterfaceType:
def get_disk_type(self, disk: str) -> schema.StorageInterfaceType:
if isinstance(self._node.os, BSD):
if disk.startswith("da"):
# Sample disk names in FreeBSD:
# /dev/da1p1 -> SCSI
# /dev/nvd1p1 -> NVME
if "da" in disk:
disk_type = schema.StorageInterfaceType.SCSI
elif disk.startswith("nvd"):
elif ("nvd" in disk) or ("nvme" in disk):
disk_type = schema.StorageInterfaceType.NVME
else:
raise LisaException(f"Unknown disk type {disk}")
else:
if disk.startswith("nvme"):
# Sample disk names in Linux:
# /dev/sda1 -> SCSI
# /dev/nvme0n1p1 -> NVME
if "nvme" in disk:
disk_type = schema.StorageInterfaceType.NVME
elif disk.startswith("sd"):
elif "sd" in disk:
disk_type = schema.StorageInterfaceType.SCSI
else:
raise LisaException(f"Unknown disk type {disk}")
Expand All @@ -126,7 +132,7 @@ def get_disc_type(self, disk: str) -> schema.StorageInterfaceType:
def get_os_disk_controller_type(self) -> schema.DiskControllerType:
boot_partition = self.get_os_boot_partition()
assert boot_partition, "'boot_partition' must not be 'None'"
os_disk_controller_type = self.get_disc_type(boot_partition.disk)
os_disk_controller_type = self.get_disk_type(boot_partition.disk)
return schema.DiskControllerType(os_disk_controller_type)


Expand Down

0 comments on commit 7ac69ad

Please sign in to comment.