Code

Updated FAI partition handling.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 6 Aug 2009 11:28:02 +0000 (11:28 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 6 Aug 2009 11:28:02 +0000 (11:28 +0000)
-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

gosa-plugins/fai/admin/fai/class_faiDiskEntry.inc
gosa-plugins/fai/admin/fai/class_faiPartition.inc
gosa-plugins/fai/admin/fai/faiPartition.tpl

index c319fc3924195d0ed36ef021adfc3ba9578ba4f5..05cfb007c266ecc77e19499d6d8906dbbf000eab 100644 (file)
@@ -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);
       }
index 481df78319dfc51199c04e380603815c79af1184..f8a9a121514301de498068fb15049ef5989fa4e3 100644 (file)
@@ -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").":&nbsp;";
-        $list[$device['name']].= $objs[$device['name']]['FAIpartitionSize'];
+        $str .= _("Size").":&nbsp;";
+        $str .= $objs[$device['name']]['FAIpartitionSize'];
       }
-
-      $list[$device['name']].= " &nbsp; "._("Options").": ";
+      $str = str_pad($str,60," ");
+      $opt = "";
       if($device['spare']){
-        $list[$device['name']].= "&nbsp;"._("spare")."&nbsp;";
+        $opt.= "&nbsp;"._("spare")."&nbsp;";
       }
       if($device['missing']){
-        $list[$device['name']].= "&nbsp;"._("missing")."&nbsp;";
+        $opt.= "&nbsp;"._("missing")."&nbsp;";
       }
+      if($opt){
+        $str .= " &nbsp; "._("Options").": ".$opt;
+      }
+      $str = str_pad($str,80," ");
+      $list[$name] = preg_replace("/ /","&nbsp;",$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 
index cc4bd9f2255d5c95bf4949e1684606cb20ce2e3c..e641c4733aeac3f98d65f669b24e0a2356fe875d 100644 (file)
@@ -95,7 +95,7 @@
     <td colspan="4">
       <h2>{t}Combined physical partitions{/t}</h2>      
 
-      <select name='physicalPartition' size=5 style="width:100%;">
+      <select name='physicalPartition' size=5 style="width:100%; font-family: monospace;">
         {html_options options=$plist}
       </select>
       <br>