From 82ddc2d3e038c9abe950b9a58fb96358b4eda3ae Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 6 Aug 2009 11:28:02 +0000 Subject: [PATCH] Updated FAI partition handling. -Added checks for raid devices. -Updated listing of raid devices. -Fixed saving git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13979 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../fai/admin/fai/class_faiDiskEntry.inc | 14 ++++++- .../fai/admin/fai/class_faiPartition.inc | 42 ++++++++++++------- gosa-plugins/fai/admin/fai/faiPartition.tpl | 2 +- 3 files changed, 41 insertions(+), 17 deletions(-) diff --git a/gosa-plugins/fai/admin/fai/class_faiDiskEntry.inc b/gosa-plugins/fai/admin/fai/class_faiDiskEntry.inc index c319fc392..05cfb007c 100644 --- a/gosa-plugins/fai/admin/fai/class_faiDiskEntry.inc +++ b/gosa-plugins/fai/admin/fai/class_faiDiskEntry.inc @@ -238,7 +238,7 @@ class faiDiskEntry extends plugin $new_partition = $this->dialog->save(); $msgs = $this->dialog->check(); - $msgs = array_merge($this->check_disks($new_partition)); + $msgs = array_merge($msgs,$this->check_disks($new_partition)); if(!count($msgs)){ $this->updatePartition($new_partition); @@ -437,6 +437,12 @@ class faiDiskEntry extends plugin } } + /* Check if we've to update lvm compilations. + */ + if($this->FAIdiskType == "raid"){ + $part['cn'] = 'md'.$part['FAIpartitionNr']; + } + $this->partitions[$part['FAIpartitionNr']] = $part; } @@ -492,6 +498,12 @@ class faiDiskEntry extends plugin if($this->FAIdiskType == "lvm"){ $fields = array($cn,$desc,$mntp,$opt,$size, $action); + }elseif($this->FAIdiskType == "raid"){ + + $raid_str = $part['FAIpartitionType']." (".$part['FAIpartitionSize'].")"; + $raid = array("string" => $raid_str); + + $fields = array($cn,$desc,$raid,$mntp,$opt,$action); }else{ $fields = array($number,$desc,$type,$mntp,$opt,$size,$action); } diff --git a/gosa-plugins/fai/admin/fai/class_faiPartition.inc b/gosa-plugins/fai/admin/fai/class_faiPartition.inc index 481df7831..f8a9a1215 100644 --- a/gosa-plugins/fai/admin/fai/class_faiPartition.inc +++ b/gosa-plugins/fai/admin/fai/class_faiPartition.inc @@ -120,11 +120,13 @@ class faiPartition extends plugin $name = preg_replace("/:.*$/","",$disk); $spare = preg_match("/:spare/",$disk); $missing = preg_match("/:missing/",$disk); - $this->raidDevices[$name] = - array( - "name" => $name, - "spare" => $spare, - "missing" => $missing); + if(!empty($name)){ + $this->raidDevices[$name] = + array( + "name" => $name, + "spare" => $spare, + "missing" => $missing); + } } } } @@ -255,20 +257,25 @@ class faiPartition extends plugin $list = array(); foreach($this->raidDevices as $device){ - $list[$device['name']] = $device['name']; - + $str = $name = $device['name']; + $str = str_pad($str,25," "); if(isset($objs[$device['name']]['FAIpartitionSize'])){ - $list[$device['name']].= _("Size").": "; - $list[$device['name']].= $objs[$device['name']]['FAIpartitionSize']; + $str .= _("Size").": "; + $str .= $objs[$device['name']]['FAIpartitionSize']; } - - $list[$device['name']].= "   "._("Options").": "; + $str = str_pad($str,60," "); + $opt = ""; if($device['spare']){ - $list[$device['name']].= " "._("spare")." "; + $opt.= " "._("spare")." "; } if($device['missing']){ - $list[$device['name']].= " "._("missing")." "; + $opt.= " "._("missing")." "; } + if($opt){ + $str .= "   "._("Options").": ".$opt; + } + $str = str_pad($str,80," "); + $list[$name] = preg_replace("/ /"," ",$str); } return($list); } @@ -349,9 +356,14 @@ class faiPartition extends plugin } } } + + // Add raid checks if($this->FAIdiskType == "raid"){ - #FIME raid checks missing - echo "Add raid checks here, disk combinations are not verified right now."; + if(count($this->raidDevices) < 2){ + $msgs[] = _("Raid arrays must contain at least two partitions!"); + }else if($this->FAIpartitionType == "raid0" && count($this->raidDevices) != 2){ + $msgs[] = _("Raid 0 arrays can only be realized with a combination of two partitions!"); + } } // check mount point diff --git a/gosa-plugins/fai/admin/fai/faiPartition.tpl b/gosa-plugins/fai/admin/fai/faiPartition.tpl index cc4bd9f22..e641c4733 100644 --- a/gosa-plugins/fai/admin/fai/faiPartition.tpl +++ b/gosa-plugins/fai/admin/fai/faiPartition.tpl @@ -95,7 +95,7 @@

{t}Combined physical partitions{/t}

- {html_options options=$plist}
-- 2.30.2