Auto-installation/Partition |
modules/AutoinstCommon.ycp |
Module representing a partitioning plan | |
|
|
This module has an unstable interface. |
Imports
Includes
Global FunctionsLocal Functions |
The general idea with this moduls is that it manages a single partition plan (AutoPartPlan) and the user can work on that plan without having to sepcify that variable on each method call. This is on the one hand convenient for the user and on the other hand we have control over the plan.
Function sets internal variable, which indicates, that any settings were modified, to "true"
Functions which returns if the settings were modified
- Return value:
-
settings were modified
Select a drive by its ID, as in the tree item strings (e.g. "drive_1" -> ID = 1).
- Parameters:
-
plan The partition plan which ID of the drive to return
- Return value:
-
The drive with the specified id, or the an empty map if no drive with that id exists.
Select a drive by its position in the drive list (a.k.a partition plan).
- Parameters:
-
index Index of drive in the list plan Partition plan.
- Return value:
-
The spcified drive, or an empty map if the index wasn't valid.
Get a list index for a drive id.
- Parameters:
-
plan Partition plan. which the drive id.
- Return value:
-
The list index or -1 if id wasn't found.
========== Mutators ==========
TODO: implement insertion constraints
Remove a drive from the plan.
- Parameters:
-
plan Partition plan. which The id of the drive to remove.
- Return value:
-
The partition plan lacking the drive that was removed if it was present.
Update a drive in the partition plan.
- Parameters:
-
drive The drive to be updated. plan Partition plan.
- Return value:
-
Partition plan containing the updated drive.
Get a list of all drives, that are of a volgroup type.
- Parameters:
-
plan The partition plan.
- Return value:
-
Partition plan containing only volgroups.
Get a list of all physical (not volgroup) drives.
- Parameters:
-
plan The partition plan.
- Return value:
-
Partition plan containing only physical drives.
Get a list of used mountpoint strings.
- Parameters:
-
plan The partition plan.
- Return value:
-
A list of mountpoint strings in use by any partition.
Volume group checks:
- check that each VG has at least one PV
-
- Parameters:
-
plan The partition plan
- Return value:
-
true if each volume group has a supplying physical volume.
Check the sanity of the partition plan.
- Parameters:
-
plan The partition plan
- Return value:
-
true if plan is sane, false otherwise.
Create tree structure from AutoPartPlan
Create a partition plan for the calling client
- Return value:
-
partition plan
PUBLIC INTERFACE
Return summary of configuration
- Return value:
-
configuration summary dialog
Get all the configuration from a map.
When called by inst_auto
- Parameters:
-
settings a list [...]
- Return value:
-
success
Dump the settings to a map, for autoinstallation use.
============================= General info about the plan =============================
Get the next free/unused mount point string.
- Return value:
-
Next free mount point string.
Get list of (device) names of volume groups present in the plan.
- Return value:
-
List of currently present volume group device names.
Triggers a sanity check over the current state of the plan.
- Return value:
-
true if plan is sane, false otherwise.
================== DRIVE OPERATIONS ==================
Get drive identified by its position in the partition plan.
- Parameters:
-
index The list index identifying the drive.
- Return value:
-
The drive identifyied by index, the empty list otherwise.
Returns the number of drives present in plan.
- Return value:
-
Number of drives present in plan.
Remove drive identified by drive ID from the partition plan. Selects preceeding drive, if deleted drive was last in list. Otherwise the successor is selected.
- Parameters:
-
which ID of drive to delete.
Add a new drive to the plan.
- Parameters:
-
drive The new drive to add.
Update a drive in the plan. If the drive didn't exist in the first place nothing happens (use add in that case).
- Parameters:
-
The drive to update.
====================== PARTITION OPERATIONS ======================
Update a partition on a drive.
Note: Partition index refers to the position of the partition in the list on the drive and thus is subject to invalidation on any modifications of that list.
- Parameters:
-
driveId The integer id of the drive containing the partition. partition The updated/new partition. partitionIdx Index of the partition to update.
- Return value:
-
true if update was successfull, false otherwise.
Create a new partition on a drive.
The new partition is assinged a default mountpoint and a default parition number, or, in case its parent drive is a LVM, a volume name.
- Parameters:
-
driveId The drive to create the new partition on.
- Return value:
-
The index of the newly created partition.
Delete a partition on a drive.
- Parameters:
-
driveId Drive containing the partition to be deleted. partitionIdx The partition index identifying the parition to be deleted.
- Return value:
-
true if removal was successfull, false otherwise.