Code

Completed lvm partition changes
[gosa.git] / gosa-plugins / fai / admin / fai / class_faiDiskEntry.inc
1 <?php
3 class faiDiskEntry extends plugin
4 {
5   /* attribute list for save action */
6   var $ignore_account= TRUE;
7   var $attributes   = array("DISKcn","DISKdescription");
8   var $UsedAttrs            = array("cn","description","FAIpartitionType",
9       "FAIpartitionNr","FAIfsType","FAImountPoint","FAIpartitionSize",
10       "FAIfsTuneOptions", "FAIfsCreateOptions", "FAImountOptions",
11       "FAIfsOptions","FAIpartitionFlags","FAIdiskOption");
13   var $objectclasses= array();
15   var $DISKcn              = "";
16   var $DISKdescription     = "";
17   var $DISKFAIdiskOptions  = "";
18   
19   var $partitions          = array();
20   var $is_edit             = false;
21   var $old_cn              = "";
22   var $fstabkey            = "device";
23   var $disklabel           = "msdos";
24   var $FAIstate            = "";
25   var $FAIdiskType         = "disk";
26   
27   var $lvmDevices          = array();
29   function faiDiskEntry (&$config, $dn= NULL,$parent,$disk,$type)
30   {
31     plugin::plugin ($config, $dn);
32   
33     // Set default attributes 
34     $this->parent = $parent;
35     $this->FAIdiskType = $type;
37     // If disk is not empty, then we are going to edit 
38     //  an existing disk, load disk info now. 
39     if($disk){
41       // Get devices used in volume base disks.
42       if(isset($disk['FAIlvmDevice'])){
43         $this->lvmDevices = $disk['FAIlvmDevice'];
44       }
46       // Load default attributes 
47       $this->DISKcn          = $disk['cn'];
48       $this->DISKdescription = $disk['description'];
49       $this->is_edit         = true;
50       $this->old_cn          = $disk['cn'];
52       // Load partition info 
53       foreach($disk['partitions'] as $values){
55         $name = $values['FAIpartitionNr'];
57         // Load partition attributes  
58         $disk['partitions'][$name]['old_cn']= $disk['partitions'][$name]['cn'];
59         $disk['partitions'][$name]['FAIdiskType']= $this->FAIdiskType;
60         foreach($this->UsedAttrs as $attr){
61           if(!isset($values[$attr])){
62             $disk['partitions'][$name][$attr]="";  
63           }
64         }
66         if (preg_match('/^_/', $disk['partitions'][$name]['FAIfsType'])){
67           $disk['partitions'][$name]['FAIfsType']= 
68             preg_replace('/^_/', '', $disk['partitions'][$name]['FAIfsType']);
69         }
70       }
72       $this->partitions      = $disk['partitions'];
74       /* Load FAIdiskOptions.
75        * Some options are disk related and others are used for partitions.
76        *  - fstabkey    -> disk
77        *  - disklabel   -> disk
78        *  - bootable    -> partition
79        *  - preserve    -> partition
80        *  - resize      -> partition
81        */
82       if (isset($disk['FAIdiskOption'])){
83         foreach($disk['FAIdiskOption'] as $option) {
85           // Get fstab key  
86           if (preg_match("/fstabkey:(device|label|uuid)/", $option)){
87             $this->fstabkey= preg_replace("/^.*fstabkey:(device|label|uuid).*$/", "$1", $option);
88             continue;
89           }
91           // Get disk label
92           if (preg_match("/disklabel:(msdos|gpt)/", $option)){
93             $this->disklabel= preg_replace("/^.*disklabel:(msdos|gpt).*$/", "$1", $option);
94             continue;
95           }
97           // Load bootable flag for partitions 
98           if (preg_match("/^bootable:/", $option)){
99             $bootable = explode(",", trim(preg_replace("/^bootable:/","",$option),","));
100             foreach($bootable as $bootflag){
101               if(isset($this->partitions[$bootflag])){
102                 $this->partitions[$bootflag]['bootable'] = TRUE;  
103               }
104             }
105             continue;
106           }
108           // Load resize flag for partitions 
109           if (preg_match("/^resize:/", $option)){
110             $resize = explode(",", trim(preg_replace("/^resize:/","",$option),","));
111             foreach($resize as $id){
112               if(isset($this->partitions[$id])){
113                 $this->partitions[$id]['resize'] = TRUE;  
114               }
115             }
116             continue;
117           }
119           // Load preserve_always flag for partitions 
120           if (preg_match("/^preserve_always:/", $option)){
121             $preserve = explode(",", trim(preg_replace("/^preserve_always:/","",$option),","));
122             foreach($preserve as $presflag){
123               if(isset($this->partitions[$presflag])){
124                 $this->partitions[$presflag]['preserve'] = TRUE;  
125                 $this->partitions[$presflag]['preserveType'] = 'always';  
126               }
127             }
128             continue;
129           }
131           // Load preserve_reinstall flag for partitions 
132           if (preg_match("/^preserve_reinstall:/", $option)){
133             $preserve = explode(",", trim(preg_replace("/^preserve_reinstall:/","",$option),","));
134             foreach($preserve as $presflag){
135               if(isset($this->partitions[$bootflag])){
136                 $this->partitions[$presflag]['preserve'] = TRUE;  
137                 $this->partitions[$presflag]['preserveType'] = 'reinstall'; 
138               } 
139             }
140             continue;
141           }
142         }
143       } else {
144         $this->fstabkey= "device";
145       }
146     }
147   }
150   function execute()
151   {
152     /* Call parent execute */
153     plugin::execute();
155     // Fill templating stuff
156     $smarty     = get_smarty();
157     $s_action   = "";
158     $s_entry    = "";
159     $display    = "";
161     // Add partition to lvm compilation.
162     if(isset($_POST['addLvmPartition']) && isset($_POST['lvmPartitionAdd'])){
163       $name = get_post('lvmPartitionAdd');
164       $this->lvmDevices[$name] = $name;
165     }
167     // Remove partition from lvm compilation.
168     if(isset($_POST['delLvmPartition']) && isset($_POST['physicalPartition'])){
169       $names = $_POST['physicalPartition'];
170       foreach($names as $name){
171         if(isset($this->lvmDevices[$name])){
172           unset($this->lvmDevices[$name]);
173         }
174       }
175     }
177     /* Check all Posts if there is something usefull for us,
178      * For example : Delete is posted as Delete_1 
179      * The number specifies the index we want to delete
180      */
181     foreach($_POST as $name => $value){
182       if((preg_match("/RemovePartition_/",$name)) && 
183           $this->acl_is_removeable() && 
184           !preg_match("/freeze/i",$this->FAIstate)){
185         $tmp = explode("_",$name);
186         $this->removePartition($tmp[1]);
187         break;
188       }
189       if(preg_match("/^EditPartition_/",$name)){
190         $id = preg_replace("/^EditPartition_/","",$name);
191         $id = preg_replace("/_.*$/","",$id);
192         if(isset($this->partitions[$id])){
193           $this->dialog = new faiPartition($this->config,$this->partitions[$id], $this,$this->FAIdiskType);
194           break;
195         }
196       } 
197     }
199     /* Act on _GET edit request
200      */
201     if(isset($_GET['act']) && $_GET['act'] == "editPart" && isset($_GET['id'])){
202       $id = $_GET['id'];
203       if(isset($this->partitions[$id])){
204         $this->dialog = new faiPartition($this->config,$this->partitions[$id], $this,$this->FAIdiskType);
205       }
206     }
208     /* Create a new partition for this disk.
209      */
210     if(isset($_POST['AddPartition']) && !preg_match("/freeze/i",$this->FAIstate)){
211       $this->dialog = new faiPartition($this->config, array(), $this,$this->FAIdiskType);
212     }
214     /* Handle partition dialogs.
215      */
216     if($this->dialog instanceOf plugin && isset($_POST['PartitionCancel'])){
217       $this->dialog = null;
218     }
219     if($this->dialog instanceOf plugin && isset($_POST['PartitionSave'])){
220       $this->dialog->save_object();
222       // Validate new partition
223       $new_partition = $this->dialog->save(); 
224       $msgs = $this->dialog->check();
225       $msgs = array_merge($msgs,$this->check_disks($new_partition));
227       if(!count($msgs)){
228         $this->updatePartition($new_partition);
229         $this->dialog = null;
230       }else{
231         msg_dialog::displayChecks($msgs);
232       }
233     }
234     if($this->dialog instanceOf plugin){
235       $this->dialog->save_object();
236       return($this->dialog->execute());
237     }
239     // Assign checkbox related values.
240     foreach($this->attributes as $attrs){
241       $smarty->assign($attrs,$this->$attrs);
242       if($this->$attrs){
243         $smarty->assign($attrs."CHK"," ");
244       }else{
245         $smarty->assign($attrs."CHK"," disabled ");
246       }
247     }
249     // Assign disk info to smarty.
250     $smarty->assign("setup", $this->generateParts());
251     $smarty->assign("sub_object_is_createable",$this->acl_is_createable());
252     $smarty->assign("freeze",preg_match("/freeze/i",$this->FAIstate));
253     $smarty->assign("fstabkeys", array("device" => _("Device"), "label" => _("Label"), "uuid" => _("UUID")));
254     $smarty->assign("disklabels", array("msdos" => "MSDOS", "gpt" => "GPT"));
255     $smarty->assign("fstabkey", $this->fstabkey);
256     $smarty->assign("disklabel", $this->disklabel);
257     $smarty->assign("FAIdiskType", $this->FAIdiskType);
258     $smarty->assign("plist", $this->getPartitionList());
259     $smarty->assign("physicalPartitionList", $this->getAvailablePartitions());
261     foreach($this->attributes as $attr){
262       $smarty->assign($attr,$this->$attr);
263     }
265     // Assign partitions
266     $tmp = $this->plInfo();
267     $sacl = "";
268     foreach($tmp['plProvidedAcls'] as $name => $translated){
269       $acl = $this->getacl($name, preg_match("/freeze/i",$this->FAIstate));
270       $smarty->assign($name."ACL",$acl);
271     }
272    
273     $display.= $smarty->fetch(get_template_path('faiDiskEntry.tpl', TRUE));
274     return($display);
275   }
278   /* Creates a human readable list, that contains all physical 
279    *  devices that are used by the volume group.
280    * This list will then be displayed in a html select box.
281    * (lvm)
282    */
283   function getPartitionList()
284   {
285     $divlist = new divSelectBox("RaidList");
287     /* Create a list of all available disks and partitions. 
288      * This list will then be used to display detailed info.
289      */
290     $disks = $this->parent->disks;
291     foreach($disks as $dname => $disk){
293       // Skip currently edited disk 
294       if($disk['cn'] == $this->old_cn) continue;
295    
296       // Add disk 
297       $objs[$dname] = $disk;
299       // Add disk partitions
300       foreach($disk['partitions'] as $id => $part){
301         $part['parentDisk'] = $disk;
302         $objs[$part['cn']] = $part;
303       }
304     }
306     // Attach current disk setup to the details list.
307     $data = $this->save();
308     $objs[$data['cn']] = $data;
309     foreach($data['partitions'] as $part){
310       $part['parentDisk'] = $data;
311       $objs[$part['cn']] = $part;
312     }
314     // Walk through physical partition combinations and build up 
315     //  user friendly list with partition details.
316     $list = array();
317     foreach($this->lvmDevices as $device){
319       // We've a html select box here, add spaces for better readability
320       $str = $device;
321       $str = preg_replace("/ /","&nbsp;",str_pad($str,20," "));
323       // Add disk/partition details.
324       if(isset($objs[$device])){
325         if(isset($objs[$device]['FAIpartitionSize'])){
326           if($objs[$device]['parentDisk']['FAIdiskType'] == "raid"){
327             $str .= _("Disks").":&nbsp;";
328             $str .= preg_replace("/(:spare|:missing)/i","",$objs[$device]['FAIpartitionSize']);
329           }else{
330             $str .= _("Size").":&nbsp;";
331             $str .= $objs[$device]['FAIpartitionSize'];
332           } 
333         }
334       }
335       $list[$device] = $str;
336     }
337     return($list);
338   }
340  
341   /* Returns a list of available partitions that are useable in 
342    *  lvm disk setups.
343    */ 
344   function getAvailablePartitions()
345   {
346     $may = $used = array();
347     foreach($this->parent->disks as $disk){
349       // Skip ourselves
350       if($disk['cn'] == $this->DISKcn) continue;
352       // Add partition from lvm combinations
353       if($disk['FAIdiskType'] == "lvm"){
354         $used = array_merge($used,$disk['FAIlvmDevice']);
355       }
357       foreach($disk['partitions'] as $key => $part){
359         // Add disks of raid arrays, to the used list.
360         if($disk['FAIdiskType'] == "raid"){
361           foreach(explode(",",$part['FAIpartitionSize']) as $rDevice){
362             $used[] = preg_replace("/:.*$/i","",$rDevice);
363           }
364         }
366         // Collect all available partitions
367         if($disk['FAIdiskType'] == "disk" || $disk['FAIdiskType'] == "raid"){
368           $name = $part['cn'];
369           if(!isset($this->lvmDevices[$name])){
370             $may[] = $name;
371           }
372         }
373       }
374     }
376     // Check which of the available disks are unused.
377     $ret = array();
378     foreach($may as $val){
379       if(!in_array($val,$used)){
380         $ret[$val] = $val;
381       }
382     }
383     return($ret);
384   }
387   /* Remove the selected partition and shift the following partitions 
388    *  to fill the gap.
389    * Additionally update the partition numbers correspondingly.
390    *  (Checks if the partition is in use, too)
391    */
392   function removePartition($id)
393   {
394     $start = false;
396     /* Create a list of all partitions that are used in
397      *  lvm or raid compilations.
398      */
399     $list = array();
400     foreach($this->parent->disks as $dname => $disk){
401       if($disk['FAIdiskType'] != "disk"){
402         if($disk['FAIdiskType'] == "lvm"){
403           foreach($disk['FAIlvmDevice'] as $partname){
404             $list[preg_replace("/:.*$/","",$partname)][] = $disk;
405           }
406         }
407         foreach($disk['partitions'] as $partkey => $part){
408           if($disk['FAIdiskType'] == "raid"){
409             foreach(explode(",",$part['FAIpartitionSize']) as $partname){
410               $list[preg_replace("/:.*$/","",$partname)][] = $disk;
411             }
412           }
413         }
414       }
415     }
417     /* Now that we've a list of all partition references, lets check if
418      *  one of the partitions we are going to remove is still in use.
419      */
420     if(isset($list[$this->partitions[$id]['cn']])){
421       $used = array();
422       foreach($list[$this->partitions[$id]['cn']] as $disk){
423         $used[$disk['cn']] = $disk['cn'];
424       }
425       $used = implode(",",$used);
426       msg_dialog::display(_("Error"),
427           sprintf(_("The disk cannot be deleted while it is used in the '%s' disk definition!"),
428             $used), ERROR_DIALOG);
429     }else{
430       unset($this->partitions[$id]);
431     }
432   }
434   
435   function get_free_partition_number()
436   {
437     $used = array();
438     foreach($this->partitions as $key => $part){
439       $used[$key] = $part['FAIpartitionNr'];
440     }
441     $id = 1;
442     while(in_array($id,$used) && $id < 16 ){
443       $id++;
444     }
445     return($id);
446   }
450   /* Add or update a partition 
451    */
452   function updatePartition($part)
453   {
454     if(!isset($part['FAIpartitionNr']) || $part['FAIpartitionNr'] == "undefined"){
455       $part['FAIpartitionNr'] = $this->get_free_partition_number();
456     }
458     /* Update the disk cn -       
459      * Do NOT touch the partition 'cn' in case of lvm or raid devices. 
460      */
461     if($this->FAIdiskType == "disk"){
462       $part['cn'] = $this->DISKcn.$part['FAIpartitionNr'];
463     }
465     /* Check if we've to update partition names of lvm compilations.
466      */ 
467     if($this->FAIdiskType == "lvm"){
468       if(isset($this->partitions[$part['FAIpartitionNr']])){
469         $old_cn = $this->partitions[$part['FAIpartitionNr']]['cn'];
470         $new_cn = $part['cn'];
471         if(isset($this->lvmDevices[$old_cn])){
472           unset($this->lvmDevices[$old_cn]);
473           $this->lvmDevices[$new_cn] = $new_cn;
474         }
475       }
476     }
478     /* Set raid names to md#
479      */ 
480     if($this->FAIdiskType == "raid"){
481       $part['cn'] = 'md'.$part['FAIpartitionNr'];
482     }
484     $this->partitions[$part['FAIpartitionNr']] = $part;
485   }
488   /* This method generates the partition listing with all necessary info,
489    *  depending on the disk type.
490    * The list is of type divSelectBox.
491    */
492   function generateParts()
493   {
494     $divlist = new divSelectBox("DiskEntries"); 
495     foreach($this->partitions as $key => $part){
497       // Create default table cols 
498       $cn =array(
499           "string" => "<a href='?plug=".$_GET['plug']."&amp;act=editPart&amp;id={$key}'>".$part['cn']."</a>",
500           "attach" => "style='width:160px;'");
501       $desc =array(
502           "string" => "<a href='?plug=".$_GET['plug']."&amp;act=editPart&amp;id={$key}'>".
503           $part['description']."</a>",
504           "attach" => "style='width:200px;'");
505       $number =array(
506           "string" => $part['FAIpartitionNr'],
507           "attach" => "style='width:20px;'");
508       $size   =array(
509           "string" => $part['FAIpartitionSize'],
510           "attach" => "style='width:100px;'");
511       $type   =array(
512           "string" => $part['FAIpartitionType'],
513           "attach" => "style='width:80px;'");
515       // Remove encryption info from the mount point.
516       $mnt = $part['FAImountPoint'];
517       if(preg_match("/:encrypt/", $mnt)){
518         $mnt = preg_replace("/:encrypt/","",$mnt);
519       }
520       $mntp   =array("string" => $mnt);
522       // create human readable strings out of the flags.
523       $opt = "";
524       if(isset($part['encrypted']) && $part['encrypted']){
525         $opt.= "&nbsp;"._("encrypted").", ";
526       }      
527       if(isset($part['bootable']) && $part['bootable']){
528         $opt.= "&nbsp;"._("bootable").", ";
529       }      
530       if(isset($part['preserve']) && $part['preserve']){
531         $opt.= "&nbsp;"._("preserve").":&nbsp;".$part['preserveType'].", ";
532       }     
534       // Combine options to a single table col. 
535       $opt    =array(
536           "string" => "<i>".preg_replace('/, $/',"",$opt)."&nbsp;</i>");
538       // Depending on the FAIstatus (freeze?) we will display different options. 
539       // We can't remove freezed branches -> Hide remove button.
540       if(!preg_match("/freeze/", $this->FAIstate)){
541         $action =array(
542             "string" => 
543               image('images/lists/edit.png','EditPartition_'.$key).
544               image('images/lists/trash.png','RemovePartition_'.$key),
545             "attach" => "style='width:40px; border-right: 0px;'");
546       }else{
547         $action =array(
548             "string" => 
549               image('images/lists/edit.png','EditPartition_'.$key),
550             "attach" => "style='width:40px; border-right: 0px;'");
551       }
553       // Build up info table, depending on the disk type. 
554       if($this->FAIdiskType == "lvm"){ 
555         $fields = array($cn,$desc,$mntp,$opt,$size, $action);
556       }elseif($this->FAIdiskType == "raid"){
557         $raid_str = $part['FAIpartitionType']." (".$part['FAIpartitionSize'].")";
558         $raid = array("string" => $raid_str);
559         $fields = array($cn,$desc,$raid,$mntp,$opt,$action);
560       }else{
561         $fields = array($desc,$type,$mntp,$opt,$size,$action);
562       }
563       $divlist->AddEntry($fields);
564     }
565     return($divlist->DrawList());    
566   }
569   function save()
570   {
571     $tmp = array();
572     $tmp['cn']          = $this->DISKcn;
574     /* Attach partitions. 
575      * And prepare names and numbers.
576      */
577     foreach($this->partitions as $key=>$val) {
578       $this->partitions[$key]['FAIpartitionNr']=$key;
579       if($this->FAIdiskType == "disk"){
580         $this->partitions[$key]['cn'] = $this->DISKcn.$key;
581       }elseif($this->FAIdiskType == "lvm"){
582         $this->partitions[$key]['FAIpartitionType'] = 'lvm';
583       }
584     }
586     $tmp['description'] = $this->DISKdescription;
587     $tmp['partitions']  = $this->partitions;
588     $tmp['FAIdiskType'] = $this->FAIdiskType;
590     // Add lvm devices if available.
591     $tmp['FAIlvmDevice'] = array();
592     foreach($this->lvmDevices as $dev){
593       $tmp['FAIlvmDevice'][] = $dev;
594     } 
596     /* Assemble flags */
597     $tmp['FAIdiskOption'] = array("fstabkey:".$this->fstabkey, "disklabel:".$this->disklabel);
599     /* If hdd name has changed, tell partitionTable to rename it */
600     if(($this->is_edit)&&($this->old_cn != $this->DISKcn)){
601       $tmp['rename']['from']  = $this->old_cn;
602       $tmp['rename']['to']    = $this->DISKcn;
603     }
605     // Build up disk options 
606     $bootable = "";
607     $resize = "";
608     $preserve_always = "";
609     $preserve_reinstall = "";
611     /* Assemble boot, resize and preserve flags 
612      */
613     foreach($tmp['partitions'] as $id => $part){
614       if(isset($part['bootable']) && $part['bootable']){
615         $bootable .= $id.",";
616       }
617       if(isset($part['resize']) && $part['resize']){
618         $resize .= $id.",";
619       }
620       if(isset($part['preserve']) && $part['preserve']){
621         if($part['preserveType'] == "always"){
622           $preserve_always .= $id.",";
623         }else{
624           $preserve_reinstall .= $id.",";
625         }
626       }
628       // Unset non valid attributes 
629       foreach(array("bootable","encrypted","preserve","preserveType","resize","FAIdiskType") as $attr){
630         if(isset($tmp['partitions'][$id][$attr])){
631           unset($tmp['partitions'][$id][$attr]);
632         }
633       }
634     }    
636     /* Assembe disk flags
637      */
638     if(!empty($bootable)){
639       $tmp['FAIdiskOption'][] = "bootable:".trim($bootable,",");
640     }
641     if(!empty($resize)){
642       $tmp['FAIdiskOption'][] = "resize:".trim($resize,",");
643     }
644     if(!empty($preserve_always)){
645       $tmp['FAIdiskOption'][] = "preserve_always:".trim($preserve_always,",");
646     }
647     if(!empty($preserve_reinstall)){
648       $tmp['FAIdiskOption'][] = "preserve_reinstall:".trim($preserve_reinstall,",");
649     }
651     return($tmp);
652   }
655   /* Save data to object */
656   function save_object()
657   {
658     if((isset($_POST['TableEntryFrameSubmitted'])) && !preg_match("/freeze/", $this->FAIstate) ){
659       plugin::save_object();
661       // Save posted disk label and fstab key
662       if (isset($_POST['disklabel']) && preg_match("/^(msdos|gpt)$/", $_POST['disklabel'])){
663         $this->disklabel= $_POST['disklabel'];
664       }
665       if (isset($_POST['fstabkey']) && preg_match("/^(device|label|uuid)$/", $_POST['fstabkey'])){
666         $this->fstabkey= $_POST['fstabkey'];
667       }
668     }
669   }
672   /* Check supplied data */
673   function check()
674   {
675     /* Call common method to give check the hook */
676     $message= plugin::check();
677   
678     /* Check for an empty disk name */
679     $d = trim($this->DISKcn);
680     if($d == "" ){
681       $message[] = msgPool::required(_("Name"));
682     }
683     if(preg_match("/[^a-z0-9_\-]/i",$d)){
684       $message[] = msgPool::invalid(_("Name"),$d,"/[a-z0-9_\-]/i");
685     }
687     return ($message);
688   }
691   /* Checks the disk combinations.
692    * 
693    */  
694   function check_disks($disk_to_add = array())
695   {
696     $msgs = array();
698     /* Check 'disk' combinations. 
699      *  - There can be four primary partitions.
700      *  - If there is at least one 'logical' partition, then there can be only 
701      *     three 'primary' partitions.
702      */    
703     if($this->FAIdiskType == "disk"){
704      
705       $types = array('logical' => array(), 'primary' => array());
706       $types[$disk_to_add['FAIpartitionType']][$disk_to_add['FAIpartitionNr']] = 1;
707       foreach($this->partitions as $key => $part){
708         $types[$part['FAIpartitionType']][$part['FAIpartitionNr']] = 1;
709       }
711       // There can only be four primary partitions per disk - without any logical partition.
712       if(count($types['logical']) == 0){
713         if(count($types['primary']) > 4){
714           $msgs[] = _("You have more than four primary partition table entries in your configuration, please check your configuration twice.");
715         }
716       }else{
717         if(count($types['primary']) > 3){
718           $msgs[] = _("You cannot have more than three primary partition while using logical partitions, please check your configuration twice.");
719         }
720       }
721     }
723     return($msgs);
724   }  
727   /* Return plugin informations for acl handling */
728   static function plInfo()
729   {
730     return (array(
731           "plShortName" => _("Partition table entry"),
732           "plDescription" => _("FAI partition table entry"),
733           "plSelfModify"  => FALSE,
734           "plDepends"     => array(),
735           "plPriority"    => 27,
736           "plSection"     => array("administration"),
737           "plCategory"    => array("fai"),
738           "plProvidedAcls" => array(
739             "DISKcn"           => _("Name"),
740             "DISKdescription"  => _("Description"),
741             "DISKFAIdiskOption"  => _("Disk options"),
742             "FAIpartitionType"  => _("Partition type"),
743             "FAIpartitionNr"    => _("Partition no."),
744             "FAIfsType"         => _("File system type"),
745             "FAImountPoint"     => _("Mount point"),
746             "FAIpartitionSize"  => _("Partition size"),
747             "FAImountOptions"   => _("Mount options"),
748             "FAIfsOptions"      => _("File system options"),
749             "FAIpartitionFlags" => _("Partition flags"))
750           ));
751   }
752  
755 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
756 ?>