From: hickert Date: Thu, 6 Aug 2009 07:56:50 +0000 (+0000) Subject: Updated LVM handling for FAI partitions. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=75fd1f95119c298cf665906548951327b97f7ce4;p=gosa.git Updated LVM handling for FAI partitions. - Allow to remove multiple physical partitions. - Allow user defined partition names (cn). - Updated FAIpartitionTable class, do not act on POST in save_object while we are in sub dialogs. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13976 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-plugins/fai/admin/fai/class_faiDiskEntry.inc b/gosa-plugins/fai/admin/fai/class_faiDiskEntry.inc index a3819d5ce..3e3f8cc2a 100644 --- a/gosa-plugins/fai/admin/fai/class_faiDiskEntry.inc +++ b/gosa-plugins/fai/admin/fai/class_faiDiskEntry.inc @@ -175,12 +175,22 @@ class faiDiskEntry extends plugin $s_entry = ""; $display = ""; - // Remove partition + // Add partition to lvm compilation. if(isset($_POST['addLvmPartition']) && isset($_POST['lvmPartitionAdd'])){ - $name = $_POST['lvmPartitionAdd']; + $name = get_post('lvmPartitionAdd'); $this->lvmDevices[$name] = $name; } + // Remove partition from lvm compilation. + if(isset($_POST['delLvmPartition']) && isset($_POST['physicalPartition'])){ + $names = $_POST['physicalPartition']; + foreach($names as $name){ + if(isset($this->lvmDevices[$name])){ + unset($this->lvmDevices[$name]); + } + } + } + /* Check all Posts if there is something usefull for us, * For example : Delete is posted as Delete_1 * The number specifies the index we want to delete @@ -365,9 +375,14 @@ class faiDiskEntry extends plugin { if(!isset($part['FAIpartitionNr']) || $part['FAIpartitionNr'] == "undefined"){ $part['FAIpartitionNr'] = count($this->partitions) + 1; + } + + /* Update the disk cn - + * Do NOT touch the partition 'cn' in case of lvm devices. + */ + if($this->FAIdiskType == "disk"){ $part['cn'] = $this->DISKcn.$part['FAIpartitionNr']; } - $part['cn'] = $this->DISKcn.$part['FAIpartitionNr']; $this->partitions[$part['FAIpartitionNr']] = $part; } @@ -404,10 +419,13 @@ class faiDiskEntry extends plugin $action =array( "string" => "". "", - "attach" => "style='width:40px;'"); + "attach" => "style='width:40px; border-right: 0px;'"); - - $fields = array($number,$type,$mntp,$size,$fstype, $opt,$fsopt,$flags,$action); + if($this->FAIdiskType == "lvm"){ + $fields = array($type,$mntp,$size,$fstype, $opt,$fsopt,$flags,$action); + }else{ + $fields = array($number,$type,$mntp,$size,$fstype, $opt,$fsopt,$flags,$action); + } $divlist->AddEntry($fields); } return($divlist->DrawList()); @@ -422,7 +440,10 @@ class faiDiskEntry extends plugin /* Attach partitions */ foreach($this->partitions as $key=>$val) { $this->partitions[$key]['FAIpartitionNr']=$key; - $this->partitions[$key]['cn'] = $this->DISKcn.$key; + + if($this->FAIdiskType == "disk"){ + $this->partitions[$key]['cn'] = $this->DISKcn.$key; + } } /* Attach deleted */ diff --git a/gosa-plugins/fai/admin/fai/class_faiPartition.inc b/gosa-plugins/fai/admin/fai/class_faiPartition.inc index 4e8ef7eb1..296f83abd 100644 --- a/gosa-plugins/fai/admin/fai/class_faiPartition.inc +++ b/gosa-plugins/fai/admin/fai/class_faiPartition.inc @@ -63,6 +63,8 @@ class faiPartition extends plugin } } } + + print_a($object); // Load attributes from existing partition if($object){ @@ -294,6 +296,11 @@ class faiPartition extends plugin } } + // Allow user defined partition names for lvm disks. + if($this->FAIdiskType == "lvm" && isset($_POST['cn'])){ + $this->cn = get_post('cn'); + } + // Remove partition if(isset($_POST['delPhysicalPartition']) && isset($_POST['physicalPartition'])){ unset($this->raidDevices[$_POST['physicalPartition']]); @@ -404,7 +411,7 @@ class faiPartition extends plugin if($this->FAIfsType == "swap"){ $ret['FAImountPoint'] = "swap"; } - + return($ret); } } diff --git a/gosa-plugins/fai/admin/fai/class_faiPartitionTable.inc b/gosa-plugins/fai/admin/fai/class_faiPartitionTable.inc index 492d3c882..4caa07c09 100644 --- a/gosa-plugins/fai/admin/fai/class_faiPartitionTable.inc +++ b/gosa-plugins/fai/admin/fai/class_faiPartitionTable.inc @@ -466,14 +466,14 @@ class faiPartitionTable extends plugin */ function save_object() { - if (preg_match("/freeze/", $this->FAIstate)) return; - plugin::save_object(); - foreach($this->attributes as $attrs){ - if(isset($_POST[$attrs])){ - $this->$attrs = $_POST[$attrs]; + if(isset($_POST['FAIpartitionTablePosted'])){ + if (preg_match("/freeze/", $this->FAIstate)) return; + plugin::save_object(); + foreach($this->attributes as $attrs){ + if(isset($_POST[$attrs])){ + $this->$attrs = $_POST[$attrs]; + } } - } - if(isset($_POST['faiPartitionTable'])){ if(!count($this->disks)){ if(isset($_POST['mode'])){ $this->FAIpartitionMethod = "setup-storage"; diff --git a/gosa-plugins/fai/admin/fai/faiDiskEntry.tpl b/gosa-plugins/fai/admin/fai/faiDiskEntry.tpl index 7e25562fa..1481fd8e0 100644 --- a/gosa-plugins/fai/admin/fai/faiDiskEntry.tpl +++ b/gosa-plugins/fai/admin/fai/faiDiskEntry.tpl @@ -71,7 +71,7 @@

{t}Combined physical partitions{/t}


diff --git a/gosa-plugins/fai/admin/fai/faiPartition.tpl b/gosa-plugins/fai/admin/fai/faiPartition.tpl index 5ca713cdc..cc4bd9f22 100644 --- a/gosa-plugins/fai/admin/fai/faiPartition.tpl +++ b/gosa-plugins/fai/admin/fai/faiPartition.tpl @@ -6,7 +6,7 @@ {if $FAIdiskType == "lvm"} {t}Name{/t} - + {else} {t}Type{/t} diff --git a/gosa-plugins/fai/admin/fai/faiPartitionTable.tpl b/gosa-plugins/fai/admin/fai/faiPartitionTable.tpl index 4e976aec0..7ac1c6058 100644 --- a/gosa-plugins/fai/admin/fai/faiPartitionTable.tpl +++ b/gosa-plugins/fai/admin/fai/faiPartitionTable.tpl @@ -55,7 +55,7 @@ - +