From 47480ea3ece8100e8fc5f291aec7c73817b8073f Mon Sep 17 00:00:00 2001 From: hickert Date: Fri, 31 Jul 2009 13:31:18 +0000 Subject: [PATCH] Updated saving of disks. -New disk couldn't be saved. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13967 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../fai/admin/fai/class_faiDiskEntry.inc | 3 +- .../fai/admin/fai/class_faiPartition.inc | 29 +++++++++++------ .../fai/admin/fai/class_faiPartitionTable.inc | 32 +++++++++---------- 3 files changed, 37 insertions(+), 27 deletions(-) diff --git a/gosa-plugins/fai/admin/fai/class_faiDiskEntry.inc b/gosa-plugins/fai/admin/fai/class_faiDiskEntry.inc index a3db65c68..aa0dec8a6 100644 --- a/gosa-plugins/fai/admin/fai/class_faiDiskEntry.inc +++ b/gosa-plugins/fai/admin/fai/class_faiDiskEntry.inc @@ -350,8 +350,9 @@ class faiDiskEntry extends plugin { if(!isset($part['FAIpartitionNr']) || $part['FAIpartitionNr'] == "undefined"){ $part['FAIpartitionNr'] = count($this->partitions) + 1; - $part['cn'] = $this->cn.$part['FAIpartitionNr']; + $part['cn'] = $this->DISKcn.$part['FAIpartitionNr']; } + $part['cn'] = $this->DISKcn.$part['FAIpartitionNr']; $this->partitions[$part['FAIpartitionNr']] = $part; } diff --git a/gosa-plugins/fai/admin/fai/class_faiPartition.inc b/gosa-plugins/fai/admin/fai/class_faiPartition.inc index e3ed5dac8..f4802d569 100644 --- a/gosa-plugins/fai/admin/fai/class_faiPartition.inc +++ b/gosa-plugins/fai/admin/fai/class_faiPartition.inc @@ -43,7 +43,9 @@ class faiPartition extends plugin $this->parent = $parent; $this->status = "new"; - + $this->FAIdiskType = $type; + + // Load attributes from existing partition if($object){ @@ -54,7 +56,6 @@ class faiPartition extends plugin } $this->status = $object['status']; - $this->FAIdiskType = $type; if($type == "disk" || $type =="lvm"){ @@ -199,10 +200,12 @@ class faiPartition extends plugin { $array = array(); foreach($this->parent->parent->disks as $disk){ - foreach($disk['partitions'] as $key => $part){ - $name = $disk['cn']; - if(!isset($this->raidDevices[$name])){ - $array[$name] = $name; + if($disk['FAIdiskType'] != "raid"){ + foreach($disk['partitions'] as $key => $part){ + $name = $part['cn']; + if(!isset($this->raidDevices[$name])){ + $array[$name] = $name." (".$disk['cn'].")"; + } } } } @@ -215,13 +218,15 @@ class faiPartition extends plugin $divlist = new divSelectBox("RaidList"); $disks = $this->parent->parent->disks; - $objs = $disks; + $objs = array(); foreach($disks as $disk){ - foreach($disk['partitions'] as $id => $part){ - $objs[$disk['cn']] = $part; + if($disk['FAIdiskType'] != "raid"){ + foreach($disk['partitions'] as $id => $part){ + $objs[$part['cn']] = $part; + } } } - + $list = array(); foreach($this->raidDevices as $device){ $list[$device['name']] = $device['name']; @@ -313,6 +318,10 @@ class faiPartition extends plugin } } } + if($this->FAIdiskType == "raid"){ + #FIME raid checks missing + echo "Add raid checks here, disk combinations are not verified right now."; + } // check mount point if($this->FAIfsType != "swap"){ diff --git a/gosa-plugins/fai/admin/fai/class_faiPartitionTable.inc b/gosa-plugins/fai/admin/fai/class_faiPartitionTable.inc index 8b6a690ec..dd66cffbc 100644 --- a/gosa-plugins/fai/admin/fai/class_faiPartitionTable.inc +++ b/gosa-plugins/fai/admin/fai/class_faiPartitionTable.inc @@ -543,23 +543,8 @@ class faiPartitionTable extends plugin foreach($order as $cn=>$disk){ $disk_dn = "cn=".$disk['cn'].",".$this->dn; $disk_attrs['cn'] = $disk['cn']; - $disk_attrs['description'] = $disk['description']; - - if(isset($disk['FAIdiskType'])){ - $disk_attrs['FAIdiskType'] = $disk['FAIdiskType']; - } - if(isset($disk['FAIdiskOption'])){ - $disk_attrs['FAIdiskOption'] = $disk['FAIdiskOption']; - } - if(isset($disk['FAIlvmDevice'])){ - $disk_attrs['FAIlvmDevice'] = $disk['FAIlvmDevice']; - } - - if(empty($disk_attrs['description']) && $disk['status'] == "edited"){ - $disk_attrs['description'] = array(); - } - $disk_attrs['objectClass'] = array("top","FAIclass","FAIpartitionDisk"); + if($disk['status']=="new"){ $ldap->cat($disk_dn,array("objectClass")); @@ -568,6 +553,21 @@ class faiPartitionTable extends plugin } } + foreach(array("description","FAIdiskType","FAIdiskOption","FAIlvmDevice") as $attr){ + if($disk['status'] == "new"){ + if(isset($disk[$attr]) && !empty($disk[$attr])){ + $disk_attrs[$attr] = $disk[$attr]; + } + }else{ + if(isset($disk[$attr]) && !empty($disk[$attr])){ + $disk_attrs[$attr] = $disk[$attr]; + }else{ + $disk_attrs[$attr] = array(); + } + } + } + + /* Tag object */ $this->tag_attrs($disk_attrs, $disk_dn, $this->gosaUnitTag); -- 2.30.2