-
Notifications
You must be signed in to change notification settings - Fork 19
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
Add support for SDX 8900 platform #181
base: release/xs8
Are you sure you want to change the base?
Conversation
Instead of coding lot of logic in the "return" line use a "part_nums" list. This will make easier to change the partition layout avoiding long and hard to understand lines. Signed-off-by: Frediano Ziglio <[email protected]>
Parse "target-platform" from answer file and store it. Signed-off-by: Frediano Ziglio <[email protected]>
If log partition won't be specified simple directory will be used. If swap partition won't be specified a file will be used. Signed-off-by: Frediano Ziglio <[email protected]>
Newer Gdisks returns different GUID for Linux, handle them. Signed-off-by: Frediano Ziglio <[email protected]>
These machine have limited disk space so reuse the old root+backup as new root. Change some "constants" variable and use them. Signed-off-by: Frediano Ziglio <[email protected]>
These machine have limited disk space so reuse the old root+backup as new root. As the layout have no backup partition store the required files for the upgrade in a directory under /tmp (tmpfs during installation, the size is less than 20 mb). For this upgrade we don't change the storage as other SDX platforms. Signed-off-by: Frediano Ziglio <[email protected]>
@@ -560,10 +562,9 @@ def partitionTargetDisk(disk, existing, preserve_first_partition, create_sr_part | |||
|
|||
# Return install mode and numbers of primary, backup, SR, boot, log and swap partitions | |||
storage_partition = tool.getPartition(primary_part+2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be changed to ... tool.getPartition(part_nums[STORAGE])
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that would make it more readable, indeed.
@@ -940,6 +940,7 @@ class GPTPartitionTool(PartitionToolBase): | |||
# These are partition type GUIDs | |||
ID_LINUX_SWAP = "0657FD6D-A4AB-43C4-84E5-0933C84B4F4F" | |||
ID_LINUX = "EBD0A0A2-B9E5-4433-87C0-68B6B72699C7" | |||
ID_LINUX2 = "0FC63DAF-8483-4772-8E79-3D69D8477DE4" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In what cases would the host-installer need to handle a partition of this type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When you load the MBR using GPT tool for doing the conversion, it's the type gdisk
will use.
@@ -948,6 +949,7 @@ class GPTPartitionTool(PartitionToolBase): | |||
GUID_to_type_code = { | |||
ID_LINUX_SWAP: '8200', | |||
ID_LINUX: '0700', | |||
ID_LINUX2: '0700', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0FC63DAF-8483-4772-8E79-3D69D8477DE4
has a type code of 0x8300 according to gptfdisk, not 0x700.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but we want to end up with EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
for compatibility reasons.
@@ -948,6 +949,7 @@ class GPTPartitionTool(PartitionToolBase): | |||
GUID_to_type_code = { | |||
ID_LINUX_SWAP: '8200', | |||
ID_LINUX: '0700', | |||
ID_LINUX2: '0700', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than calling this ID_LINUX2
, I think it would be better to rename ID_LINUX
to reflect what gptfdisk calls it (at least since 0.7.2 from 2011).
0x700 == EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
== "Microsoft basic data"
0x8300 == 0FC63DAF-8483-4772-8E79-3D69D8477DE4
== "Linux filesystem"
(Although it is still not clear to me why this new constant is needed.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are using Microsoft basic type
type for Linux partitions. So, we want to tell sgdisk 0700
for both. Maybe use ID_LINUX
for 0FC63DAF-8483-4772-8E79-3D69D8477DE4
and ID_MS_BASIC
for EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
but maps both to 0700
?
logger.log("Installer booted in %s mode" % ("UEFI" if constants.UEFI_INSTALLER else "legacy")) | ||
|
||
(PRIMARY, BACKUP, STORAGE, BOOT, LOGS, SWAP) = list(range(6)) | ||
|
||
if target_platform == 'sdx8900': | ||
constants.boot_size = 2 | ||
constants.root_size = 4096 + 4096 - constants.boot_size - 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could use constants.root_mbr_size_old
and constants.backup_size_old
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, I was thinking the same, then I forgot.
logger.log("Installer booted in %s mode" % ("UEFI" if constants.UEFI_INSTALLER else "legacy")) | ||
|
||
(PRIMARY, BACKUP, STORAGE, BOOT, LOGS, SWAP) = list(range(6)) | ||
|
||
if target_platform == 'sdx8900': | ||
constants.boot_size = 2 | ||
constants.root_size = 4096 + 4096 - constants.boot_size - 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the 1
constant needed for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alignment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding a comment
@@ -640,14 +649,14 @@ def writeDom0DiskPartitions(disk, target_boot_mode, boot_partnum, primary_partnu | |||
# Otherwise start the partition following the utility partition. | |||
if logs_partnum > 0: | |||
if order == 1: | |||
tool.createPartition(tool.ID_LINUX, sizeBytes=logs_size * 2**20, startBytes=2**20, number=logs_partnum, order=order) | |||
tool.createPartition(tool.ID_LINUX, sizeBytes=constants.logs_size * 2**20, startBytes=2**20, number=logs_partnum, order=order) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps remove the from constants import *
line at the top of the file to avoid any accidental reference to the wrong size?
Even still, this is quite nasty since the constant changes above won't be visible in other modules that import from constants
rather than referencing constants
. To avoid this, can the partition sizes be made part of the mutable installation data, much like the partition numbers are?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't check all usage of constants (and I'm not sure how to do it safely to avoid crashes in unexpected code paths).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would avoid using mutable installation data unless we decide to support more of these alternated layout. And that would take surely more time to test it (for regressions). Also, the way we use these data would create functions with ton of parameters and specifiers which honestly is already not that readable now.
|
||
self.handleRestoreList(primary_fs.mount_point, restore_list, restore_file) | ||
logger.log("File list is:\n\t%s" % '\n\t'.join(files_list)) | ||
if util.runCmd2("tar -C '%s' -c -T - | tar -C '%s' -x" % (primary_fs.mount_point, backup_dir), inputtext='\n'.join(files_list)) != 0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are etc/passwd
and etc/group
handled specially with a double invocation of tar
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why specially? Normally they are not restored, but they are used in the restore process, so we need to save them. The double invocation is to copy all files and directories. Maybe I didn't get your point.
if not self.safe2mbrupgrade: | ||
return | ||
|
||
# SDX 8900 we keep old data | ||
if target_platform == 'sdx8900': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't you still need to convert from MBR to GPT, even if the partition resizing is not necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is done automatically, that's why the additional partition GUID.
These machines have limited disk space, change layout.