Commit ff7807df authored by Nigel Kukard's avatar Nigel Kukard
Browse files

Merge branch 'nkupdates' into 'master'

Nkupdates

See merge request idms-linux-rolling/projects/idms-linux-installer!31
parents 2fa10559 40712555
Pipeline #113 passed with stage
in 48 seconds
......@@ -29,7 +29,7 @@ from idmslinux_installer.ilistate import IliState
from idmslinux_installer.plugin import PluginCollection
from idmslinux_installer.util.blockdevices import BlockDevices
__version__ = "0.1.2"
__version__ = "0.1.3"
class Ili:
......
......@@ -19,7 +19,7 @@ from typing import Callable, Dict, List, Optional
from idmslinux_installer.ilistate import IliState
from idmslinux_installer.plugin import Plugin
from idmslinux_installer.util.sfdisk import Sfdisk
from idmslinux_installer.util.sfdisk import Sfdisk, get_partition
# Ignore warning that we have not overridden all base class methods.
......@@ -61,9 +61,10 @@ class DiskUsageASIS(Plugin):
# Add the block devices to the installer
ili_state.output_callback('Adding block devices')
ili_state.add_blockdevice('efi', f'{disk}2')
ili_state.add_blockdevice('boot', f'{disk}3')
ili_state.add_blockdevice('root', f'{disk}4')
ili_state.add_blockdevice('efi', get_partition(disk, 2))
ili_state.add_blockdevice('boot', get_partition(disk, 3))
ili_state.add_blockdevice('root', get_partition(disk, 4))
# Add the MBR device to the installer
ili_state.output_callback('Adding device for MBR')
......
......@@ -21,7 +21,7 @@ from typing import List
from idmslinux_installer.ilistate import IliState
from idmslinux_installer.plugin import Plugin
from idmslinux_installer.util.mdadm import Mdadm
from idmslinux_installer.util.sfdisk import Sfdisk
from idmslinux_installer.util.sfdisk import Sfdisk, get_partition
# Ignore warning that we have not overridden all base class methods.
......@@ -95,15 +95,15 @@ class DiskUsageMDRAID(Plugin):
mdadm = Mdadm()
# Add all part3 to array
mdadm.create(boot_disk, 1, [f'{x}3' for x in ili_state.install_disks],
mdadm.create(boot_disk, 1, [get_partition(x, 3) for x in ili_state.install_disks],
output_callback=ili_state.output_callback)
# Add all part4 partitions to array
mdadm.create(root_disk, raid_level, [f'{x}4' for x in ili_state.install_disks],
mdadm.create(root_disk, raid_level, [get_partition(x, 4) for x in ili_state.install_disks],
output_callback=ili_state.output_callback)
# Add the block devices to the installer
ili_state.output_callback('Adding block devices')
ili_state.add_blockdevice('efi', f'{efi_disk}2')
ili_state.add_blockdevice('efi', get_partition(efi_disk, 2))
ili_state.add_blockdevice('boot', boot_disk)
ili_state.add_blockdevice('root', root_disk)
......
......@@ -111,3 +111,14 @@ def _sanitize_parm(pos: int) -> str:
return ''
return '%iM' % pos
def get_partition(disk: str, partition: int) -> str:
"""Return the partition name for a given disk and partition number."""
part_prefix = ''
# NVME drives have a 'p' before the partition number
if '/dev/nvme' in disk:
part_prefix = 'p'
return f'{disk}{part_prefix}{partition}'
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment