summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 75fd1f9)
raw | patch | inline | side by side (parent: 75fd1f9)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 6 Aug 2009 08:49:13 +0000 (08:49 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 6 Aug 2009 08:49:13 +0000 (08:49 +0000) |
- Do not allow to add partitions to 'FAIlvmDevice' which are part of the currently edited disk. (Loop)
- Updated listing of lvm partitions.
- Save cn, instead of 'disk' + 'PartitionNr', e.g. lvm1.
- Fixed some loading errors for lvm devices.
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13977 594d385d-05f5-0310-b6e9-bd551577e9d8
- Updated listing of lvm partitions.
- Save cn, instead of 'disk' + 'PartitionNr', e.g. lvm1.
- Fixed some loading errors for lvm devices.
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13977 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 3e3f8cc2aa1bfa70413d8d140bdccbf0e90126b1..b8759f524a49030aeda9cc86ca733e703963dbd0 100644 (file)
if (preg_match("/^resize:/", $option)){
$resize = split(",", trim(preg_replace("/^resize:/","",$option),","));
foreach($resize as $id){
- if(isset($this->partitions[$bootflag])){
+ if(isset($this->partitions[$id])){
$this->partitions[$id]['resize'] = TRUE;
}
}
if (preg_match("/^preserve_always:/", $option)){
$preserve = split(",", trim(preg_replace("/^preserve_always:/","",$option),","));
foreach($preserve as $presflag){
- if(isset($this->partitions[$bootflag])){
+ if(isset($this->partitions[$presflag])){
$this->partitions[$presflag]['preserve'] = TRUE;
$this->partitions[$presflag]['preserveType'] = 'always';
}
function getPartitionList()
{
$divlist = new divSelectBox("RaidList");
+
+ /* Create a list of all available disks and partitions.
+ * This list will then be used to display detailed info.
+ */
$disks = $this->parent->disks;
- $objs = $disks;
- foreach($disks as $disk){
+ foreach($disks as $dname => $disk){
+
+ // Skip currently edited disk
+ if($disk['cn'] == $this->old_cn) continue;
+
+ // Add disk
+ $objs[$dname] = $disk;
+
+ // Add disk partitions
foreach($disk['partitions'] as $id => $part){
$part['parentDisk'] = $disk;
$objs[$part['cn']] = $part;
}
}
+ // Attach current disk setup to the details list.
+ $data = $this->save();
+ $objs[$data['cn']] = $data;
+ foreach($data['partitions'] as $part){
+ $part['parentDisk'] = $data;
+ $objs[$part['cn']] = $part;
+ }
+
+ // Walk through physical partition combinations and build up
+ // user friendly list with partition details.
$list = array();
foreach($this->lvmDevices as $device){
+ // We've a html select box here, add spaces for better readability
$str = $device;
$str = preg_replace("/ /"," ",str_pad($str,20," "));
+ // Add disk/partition details.
if(isset($objs[$device])){
-
if(isset($objs[$device]['FAIpartitionSize'])){
if($objs[$device]['parentDisk']['FAIdiskType'] == "raid"){
$str .= _("Disks").": ";
return($list);
}
-
- function getAvailablePartitions(){
+
+ /* Returns a list of available partitions that are useable in this
+ * lvm disk setup.
+ */
+ function getAvailablePartitions()
+ {
$array = array();
foreach($this->parent->disks as $disk){
+
+ // We can't add ourselves to the available partitions
+ if($disk['cn'] == $this->old_cn) continue;
+
+ // Add partitions to the list.
foreach($disk['partitions'] as $key => $part){
$name = $part['cn'];
if(!isset($this->lvmDevices[$name])){
if($this->FAIdiskType == "disk"){
$part['cn'] = $this->DISKcn.$part['FAIpartitionNr'];
}
+
+ /* Check if we've to update lvm compilations.
+ */
+ if($this->FAIdiskType == "lvm"){
+ if(isset($this->partitions[$part['FAIpartitionNr']])){
+ $old_cn = $this->partitions[$part['FAIpartitionNr']]['cn'];
+ $new_cn = $part['cn'];
+ if(isset($this->lvmDevices[$old_cn])){
+ unset($this->lvmDevices[$old_cn]);
+ $this->lvmDevices[$new_cn] = $new_cn;
+ }
+ }
+ }
+
$this->partitions[$part['FAIpartitionNr']] = $part;
}
$divlist = new divSelectBox("DiskEntries");
foreach($this->partitions as $key => $part){
+ $cn =array(
+ "string" => $part['cn'],
+ "attach" => "style='width:20px;'");
$number =array(
"string" => $part['FAIpartitionNr'],
"attach" => "style='width:20px;'");
"attach" => "style='width:40px; border-right: 0px;'");
if($this->FAIdiskType == "lvm"){
- $fields = array($type,$mntp,$size,$fstype, $opt,$fsopt,$flags,$action);
+ $fields = array($cn,$mntp,$size,$fstype, $opt,$fsopt,$flags,$action);
}else{
$fields = array($number,$type,$mntp,$size,$fstype, $opt,$fsopt,$flags,$action);
}
if($this->FAIdiskType == "disk"){
$this->partitions[$key]['cn'] = $this->DISKcn.$key;
+ }elseif($this->FAIdiskType == "lvm"){
+ $this->partitions[$key]['FAIpartitionType'] = 'lvm';
}
}
diff --git a/gosa-plugins/fai/admin/fai/class_faiPartition.inc b/gosa-plugins/fai/admin/fai/class_faiPartition.inc
index 296f83abd538d130afb90dce3468032be4189a7e..481df78319dfc51199c04e380603815c79af1184 100644 (file)
}
}
- print_a($object);
-
// Load attributes from existing partition
if($object){