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 329dbac
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions lisa/features/disks.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,20 +79,35 @@ def get_os_boot_partition(self) -> Optional[PartitionInfo]:
for partition in partition_info:
if partition.mount_point.startswith("/boot"):
boot_partition = partition
if "FreeBSD" in self._node.os.name:
cmd = "glabel status"
output = self._node.execute(cmd).stdout.split("\n")
for line in output:
if boot_partition.disk in line:
dev = line.split()[2]
boot_partition.disk = dev
break
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:
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 329dbac

Please sign in to comment.