summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 14df5bb)
raw | patch | inline | side by side (parent: 14df5bb)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 7 Aug 2009 12:10:58 +0000 (12:10 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 7 Aug 2009 12:10:58 +0000 (12:10 +0000) |
-Save primary partition with numbers from 1-4, and logical > 5
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14002 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14002 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-plugins/fai/admin/fai/class_faiPartitionTable.inc | patch | blob | history |
diff --git a/gosa-plugins/fai/admin/fai/class_faiPartitionTable.inc b/gosa-plugins/fai/admin/fai/class_faiPartitionTable.inc
index 4f3c269aa214ae452a51a27464217b276671c6db..7732843e3cfaa721d695871716d40c06bd7d4668 100644 (file)
/* Save to LDAP */
function save()
{
-
plugin::save();
+
/* Save current settings.
* 1 : We must save the partition table, with its description and cn
* 2 : Append Disk with cn and description.
$order[$key] = $disk;
}
}
+
+
+ // Prepare disks to be saved.
+ $this->prepareDiskToBeSave();
+
foreach($this->disks as $key => $disk){
if($disk['status'] != "delete"){
$order[$key] = $disk;
}
+ function prepareDiskToBeSave()
+ {
+ foreach($this->disks as $id => $disk){
+
+ /* Correct FAIpartitionNr.
+ * If we've only primary partition then set the partition numbers from
+ * 1 to 4, else set the primary from 1 to 3 and logical >= 5
+ *
+ */
+ if($disk['FAIdiskType'] == "disk"){
+ $primary = $logical = array();
+ foreach($disk['partitions'] as $partid => $part){
+ if($part['FAIpartitionType'] == "primary"){
+ $primary[$partid] = $part;
+ }elseif($part['FAIpartitionType'] == "logical"){
+ $logical[$partid] = $part;
+ }else{
+ trigger_error("Fatal: unknown disk type? ".$part['FAIpartitionType']);
+ }
+ }
+ $newSetup = array();
+ $cnt = 1;
+ foreach($primary as $part){
+ $part['FAIpartitionNr'] = $cnt;
+ $part['cn'] = $disk['cn'].$cnt;
+ $newSetup[$cnt] = $part;
+ $cnt ++;
+ }
+ $cnt = 5;
+ foreach($logical as $part){
+ $part['FAIpartitionNr'] = $cnt;
+ $part['cn'] = $disk['cn'].$cnt;
+ $newSetup[$cnt] = $part;
+ $cnt ++;
+ }
+ $this->disks[$id]['partitions'] = $newSetup;
+ }
+ }
+ }
+
+
function PrepareForCopyPaste($source)
{
plugin::PrepareForCopyPaste($source);