Skip to content

Commit

Permalink
Added FreeBSD specifics to disk
Browse files Browse the repository at this point in the history
  • Loading branch information
r-dailey committed Sep 5, 2024
1 parent 225fb52 commit 4cffef2
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions lisa/features/disks.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,19 +80,35 @@ def get_os_boot_partition(self) -> Optional[PartitionInfo]:
if partition.mount_point.startswith("/boot"):
boot_partition = partition
break
if "FreeBSD" in self._node.os.name:
output = self._node.execute("glabel status").stdout.split('\n')
for line in output:
if boot_partition.disk in line:
dev = line.split()[2]
self._node.log.info(f"disk mounted on: {dev}")
boot_partition.disk = dev
break
return boot_partition

# Get disk controller type from the VM by checking the boot partition
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'"

if boot_partition.disk.startswith("nvme"):
os_disk_controller_type = schema.DiskControllerType.NVME
elif boot_partition.disk.startswith("sd"):
os_disk_controller_type = schema.DiskControllerType.SCSI
if "FreeBSD" in self._node.os.name:
self._node.log.info(f"boot disk: {boot_partition.disk}")
if boot_partition.disk.startswith("da"):
os_disk_controller_type = schema.DiskControllerType.SCSI
elif boot_partition.disk.startswith("nvd"):
os_disk_controller_type = schema.DiskControllerType.NVME
else:
raise LisaException(f"Unknown OS boot disk type {boot_partition.disk}")
else:
raise LisaException(f"Unknown OS boot disk type {boot_partition.disk}")
if boot_partition.disk.startswith("nvme"):
os_disk_controller_type = schema.DiskControllerType.NVME
elif boot_partition.disk.startswith("sd"):
os_disk_controller_type = schema.DiskControllerType.SCSI
else:
raise LisaException(f"Unknown OS boot disk type {boot_partition.disk}")
return os_disk_controller_type


Expand Down

0 comments on commit 4cffef2

Please sign in to comment.