summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 540e2d8)
raw | patch | inline | side by side (parent: 540e2d8)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 7 Aug 2009 09:34:42 +0000 (09:34 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 7 Aug 2009 09:34:42 +0000 (09:34 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13997 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-plugins/fai/admin/fai/class_faiDiskEntry.inc | patch | blob | history | |
gosa-plugins/fai/admin/fai/class_faiPartition.inc | patch | blob | history |
diff --git a/gosa-plugins/fai/admin/fai/class_faiDiskEntry.inc b/gosa-plugins/fai/admin/fai/class_faiDiskEntry.inc
index 2975fe0c072e775c4b5a5458488982ee4985dfee..6d4448ee439957c13968cb97f733dd6cefd0c344 100644 (file)
$this->deletePartitions[]=$values;
}else{
- /* If status is not new, set to edit mode.
- * New means that this partition currently wasn't saved to ldap.
+ /* If the partition status is not 'new', then set it to 'edit'.
+ * New means that this partition wasn't saved to ldap, yet.
*/
if($disk['partitions'][$name]['status']!="new"){
$disk['partitions'][$name]['status']="edited";
$disk['partitions'][$name][$attr]="";
}
}
+
if (preg_match('/^_/', $disk['partitions'][$name]['FAIfsType'])){
$disk['partitions'][$name]['FAIfsType']=
preg_replace('/^_/', '', $disk['partitions'][$name]['FAIfsType']);
$this->partitions = $disk['partitions'];
/* Load FAIdiskOptions.
- * Some options are disk related and some are used for partitions.
+ * Some options are disk related and others are used for partitions.
* - fstabkey -> disk
* - disklabel -> disk
* - bootable -> partition
if($this->dialog instanceOf plugin && isset($_POST['PartitionSave'])){
$this->dialog->save_object();
+ // Validate new partition
$new_partition = $this->dialog->save();
$msgs = $this->dialog->check();
$msgs = array_merge($msgs,$this->check_disks($new_partition));
return($display);
}
+
+ /* Creates a human readable list, that contains all physical
+ * devices that are used by a volume group.
+ * This list will then be displayed in a html select box.
+ * (lvm)
+ */
function getPartitionList()
{
$divlist = new divSelectBox("RaidList");
}
- /* Returns a list of available partitions that are useable in this
- * lvm disk setup.
+ /* Returns a list of available partitions that are useable in
+ * lvm disk setups.
*/
function getAvailablePartitions()
{
/* Remove the selected partition and shift the following partitions
* to fill the gap.
* Additionally update the partition numbers correspondingly.
+ * (Checks if the partition is in use, too)
*/
function removePartition($id)
{
}
/* Update the disk cn -
- * Do NOT touch the partition 'cn' in case of lvm devices.
+ * Do NOT touch the partition 'cn' in case of lvm or raid devices.
*/
if($this->FAIdiskType == "disk"){
$part['cn'] = $this->DISKcn.$part['FAIpartitionNr'];
}
- /* Check if we've to update lvm compilations.
+ /* Check if we've to update partition names of lvm compilations.
*/
if($this->FAIdiskType == "lvm"){
if(isset($this->partitions[$part['FAIpartitionNr']])){
}
}
- /* Check if we've to update lvm compilations.
+ /* Set raid names to md#
*/
if($this->FAIdiskType == "raid"){
$part['cn'] = 'md'.$part['FAIpartitionNr'];
}
+ /* This method generates the partition listing with all necessary info,
+ * depending on the disk type.
+ * The list is of type divSelectBox.
+ */
function generateParts()
{
-
$divlist = new divSelectBox("DiskEntries");
foreach($this->partitions as $key => $part){
+ // Create default table cols
$cn =array(
"string" => "<a href='?plug=".$_GET['plug']."&act=editPart&id={$key}'>".$part['cn']."</a>",
"attach" => "style='width:160px;'");
-
$desc =array(
"string" => "<a href='?plug=".$_GET['plug']."&act=editPart&id={$key}'>".
$part['description']."</a>",
"attach" => "style='width:200px;'");
-
$number =array(
"string" => $part['FAIpartitionNr'],
"attach" => "style='width:20px;'");
"string" => $part['FAIpartitionType'],
"attach" => "style='width:80px;'");
+ // Remove encryption info from the mount point.
$mnt = $part['FAImountPoint'];
if(preg_match("/:encrypt/", $mnt)){
$mnt = preg_replace("/:encrypt/","",$mnt);
}
$mntp =array("string" => $mnt);
+ // create human readable strings out of the flags.
$opt = "";
if(isset($part['encrypted']) && $part['encrypted']){
$opt.= " "._("encrypted").", ";
}
if(isset($part['preserve']) && $part['preserve']){
$opt.= " "._("preserve").": ".$part['preserveType'].", ";
- }
+ }
+
+ // Combine options to a single table col.
$opt =array(
"string" => "<i>".preg_replace('/, $/',"",$opt)."</i>");
+ // Depending on the FAIstatus (freeze?) we will display different options.
+ // We can't remove freezed branches -> Hide remove button.
if(!preg_match("/freeze/", $this->FAIstate)){
$action =array(
"string" => "<input type='image' src='images/lists/edit.png' name='EditPartition_".$key."'>".
"attach" => "style='width:40px; border-right: 0px;'");
}
-
-
+ // Build up info table, depending on the disk type.
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);
$tmp = array();
$tmp['cn'] = $this->DISKcn;
- /* Attach partitions */
+ /* Attach partitions.
+ * And prepare names and numbers.
+ */
foreach($this->partitions as $key=>$val) {
$this->partitions[$key]['FAIpartitionNr']=$key;
-
if($this->FAIdiskType == "disk"){
$this->partitions[$key]['cn'] = $this->DISKcn.$key;
}elseif($this->FAIdiskType == "lvm"){
}
}
- /* Attach deleted */
+ /* Attach deleted.
+ */
foreach($this->deletePartitions as $key=>$val) {
$this->partitions[$key."-delete"]=$val;
$this->partitions[$key."-delete"]['status']="delete";
$tmp['status'] = $this->status;
$tmp['FAIdiskType'] = $this->FAIdiskType;
+ // Add lvm devices if available.
$tmp['FAIlvmDevice'] = array();
foreach($this->lvmDevices as $dev){
$tmp['FAIlvmDevice'][] = $dev;
$preserve_always = "";
$preserve_reinstall = "";
+ /* Assemble boot, resize and preserve flags
+ */
foreach($tmp['partitions'] as $id => $part){
if(isset($part['bootable']) && $part['bootable']){
$bootable .= $id.",";
}
}
+ /* Assembe disk flags
+ */
if(!empty($bootable)){
$tmp['FAIdiskOption'][] = "bootable:".trim($bootable,",");
}
"FAIpartitionFlags" => _("Partition flags"))
));
}
-
}
diff --git a/gosa-plugins/fai/admin/fai/class_faiPartition.inc b/gosa-plugins/fai/admin/fai/class_faiPartition.inc
index a6b5ed8ffea2dbcb23cc802a8f1c6330e78a2b00..fe1d5277cd3e30fcdcff7025a6cae5e17529b606 100644 (file)
var $FAIdiskType = "disk";
+ // Size options.
var $FAIpartitionSizeType = "fixed";
var $sizeStart = 0;
var $sizeStop = 0;
var $sizeStart_Type = "MB";
var $sizeStop_Type = "MB";
-
+
+ // Flags
var $bootable = false;
var $resize = false;
+ var $encrypted = false;
var $preserve = false;
var $preserveType = "always";
- var $encrypted = false;
var $status = "";
var $raidDevices = array();
// Load attributes from existing partition
if($object){
-
foreach($this->attributes as $attr){
if(isset($object[$attr])){
$this->$attr = $object[$attr];
}
}elseif($type == "raid"){
-
+
+ // Extract raid devices out of the partition size attribute.
$usedDisks = split(",",$this->FAIpartitionSize);
foreach($usedDisks as $disk){
$name = preg_replace("/:.*$/","",$disk);
return($smarty->fetch(get_template_path("faiPartition.tpl", TRUE, dirname(__FILE__))));
}
-
+
+ /* Returns a list of all partitions that are useable
+ * for raid arrays.
+ */
function getPartitionList()
{
$array = array();
}
+ /* Creates a human readable list of all used partitions
+ * of a raid device.
+ */
function getRaidList()
{
$divlist = new divSelectBox("RaidList");
-
$disks = $this->parent->parent->disks;
$objs = array();
foreach($disks as $disk){
}
}elseif($this->FAIdiskType == "raid"){
+
+ // Save selected raid partitions in FAIpartitionSize
$ret['FAIpartitionSize'] = "";
foreach($this->raidDevices as $device){
$ret['FAIpartitionSize'] .= $device['name'];