Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PartitioningView: add test disk/partition data #812

Merged
merged 2 commits into from
Sep 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 55 additions & 1 deletion src/Views/PartitioningView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,11 @@ public class Installer.PartitioningView : AbstractInstallerView {

InstallerDaemon.DiskInfo? disks = null;
try {
disks = yield Daemon.get_default ().get_disks (true);
if (!Installer.App.test_mode) {
disks = yield Daemon.get_default ().get_disks (true);
} else {
disks = get_test_diskinfo ();
}
} catch (Error e) {
critical ("Unable to get disks: %s", e.message);
load_stack.set_visible_child_name ("disk");
Expand Down Expand Up @@ -343,4 +347,54 @@ public class Installer.PartitioningView : AbstractInstallerView {
array[index] = array[array.size - 1];
return array.remove_at (array.size - 1);
}

private InstallerDaemon.DiskInfo get_test_diskinfo () {
InstallerDaemon.Disk[] physical_disks = {};
InstallerDaemon.Disk[] logical_disks = {};

InstallerDaemon.Partition[] partitions = {};

var usage_1 = Distinst.PartitionUsage () {
tag = 1,
value = 30312
};

partitions += InstallerDaemon.Partition () {
device_path = "/dev/nvme0n1p1",
filesystem = InstallerDaemon.FileSystem.FAT32,
start_sector = 4096,
end_sector = 542966,
sectors_used = usage_1,
current_lvm_volume_group = ""
};

var usage_2 = Distinst.PartitionUsage () {
tag = 0,
value = 0
};

partitions += InstallerDaemon.Partition () {
device_path = "/dev/nvme0n1p2",
filesystem = InstallerDaemon.FileSystem.LVM,
start_sector = 542968,
end_sector = 976769070,
sectors_used = usage_2,
current_lvm_volume_group = "data"
};

physical_disks += InstallerDaemon.Disk () {
name = "Samsung SSD 970 EVO 500GB",
device_path = "/dev/nvme0n1",
sectors = 976773168,
sector_size = 512,
rotational = false,
removable = false,
partitions = partitions
};

return InstallerDaemon.DiskInfo () {
physical_disks = physical_disks,
logical_disks = logical_disks
};
}
}