From 0fc9b70295a9cc49a6d35ff8fa11b076fb2d06a5 Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 12 May 2011 10:08:22 +0000 Subject: [PATCH] Add new device name detectoin methods git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20816 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../goto/Device/class_AddPartitionDialog.inc | 39 ++----------------- 1 file changed, 4 insertions(+), 35 deletions(-) diff --git a/gosa-plugins/goto/admin/systems/goto/Device/class_AddPartitionDialog.inc b/gosa-plugins/goto/admin/systems/goto/Device/class_AddPartitionDialog.inc index 810cab143..9620acf85 100644 --- a/gosa-plugins/goto/admin/systems/goto/Device/class_AddPartitionDialog.inc +++ b/gosa-plugins/goto/admin/systems/goto/Device/class_AddPartitionDialog.inc @@ -304,23 +304,7 @@ class AddPartitionDialog $spares = $this->r_spares; $encrypt = $this->r_encrypt; - // Get used raid-device names and then calculate the next free name - $usedNames = array(); - foreach($this->raidDevices as $raid){ - $usedNames[] = $raid['name']; - } - $name = "md"; - $id = 0; - while($id <= 16 && in_array($name.$id, $usedNames)){ - $id ++; - } - $name = $name.$id; - - // No free space for a raid device - if($id == 16){ - echo "No more raid device ids"; - return(FALSE); - } + $name = $this->partitionObject->getNextRaidDevice(); // Check selected target $partitions = $this->partitions; @@ -333,12 +317,7 @@ class AddPartitionDialog $usedTargets[] = $part['target']; } if($fsType == "pv"){ - $target="pv."; - $id = 0; - while($id < 100 && in_array($target.str_pad($id, 2, '0', STR_PAD_LEFT) , $usedTargets)){ - $id ++; - } - $target = $target.str_pad($id, 2, '0', STR_PAD_LEFT); + $target = $this->partitionObject->getNextPhysicalVolumeName(); $fsType = $fsOptions = NULL; }else{ $target = $this->r_mountPoint; @@ -385,24 +364,14 @@ class AddPartitionDialog // We've to create a raid disk if($this->p_fsType == "raid"){ - $target="raid."; - $id = 0; - while($id < 100 && in_array($target.str_pad($id, 2, '0', STR_PAD_LEFT) , $usedTargets)){ - $id ++; - } - $target = $target.str_pad($id, 2, '0', STR_PAD_LEFT); + $target = $this->partitionObject->getNextRaidName(); $fsType = $fsOptions = NULL; $encrypt = $format = FALSE; }else // We've to create a raid disk if($this->p_fsType == "pv"){ - $target="pv."; - $id = 0; - while($id < 100 && in_array($target.str_pad($id, 2, '0', STR_PAD_LEFT) , $usedTargets)){ - $id ++; - } - $target = $target.str_pad($id, 2, '0', STR_PAD_LEFT); + $target = $this->partitionObject->getNextPhysicalVolumeName(); $fsType = $fsOptions = NULL; $encrypt = $format = FALSE; }else{ -- 2.30.2