summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: bfc2ab4)
raw | patch | inline | side by side (parent: bfc2ab4)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 7 Aug 2009 13:58:13 +0000 (13:58 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 7 Aug 2009 13:58:13 +0000 (13:58 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14005 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 b07b37715f01c54d307047202a1c4467eeca276f..77a6adc0a2116af85414a1edde3dab8ece1473d8 100644 (file)
/* Creates a human readable list, that contains all physical
- * devices that are used by a volume group.
+ * devices that are used by the volume group.
* This list will then be displayed in a html select box.
* (lvm)
*/
*/
function getAvailablePartitions()
{
- $array = array();
+
+ $may = $used = array();
foreach($this->parent->disks as $disk){
- // We can't add ourselves to the available partitions
- if($disk['cn'] == $this->old_cn) continue;
+ // Skip ourselves
+ if($disk['cn'] == $this->DISKcn) continue;
+ if($disk['status'] == "delete") continue;
+
+ // Add partition from lvm combinations
+ if($disk['FAIdiskType'] == "lvm"){
+ $used = array_merge($used,$disk['FAIlvmDevice']);
+ }
- // Add partitions to the list.
foreach($disk['partitions'] as $key => $part){
- $name = $part['cn'];
- if(!isset($this->lvmDevices[$name])){
- $array[$name] = $name;
+
+ if($part['status'] == "delete") continue;
+
+ // Add disks of raid arrays, to the used list.
+ if($disk['FAIdiskType'] == "raid"){
+ foreach(split(",",$part['FAIpartitionSize']) as $rDevice){
+ $used[] = preg_replace("/:.*$/i","",$rDevice);
+ }
+ }
+
+ // Collect all available disks
+ if($disk['FAIdiskType'] == "disk"){
+ $name = $part['cn'];
+ if(!isset($this->lvmDevices[$name])){
+ $may[] = $name;
+ }
}
}
}
- return($array);
+ // Check which of the available disks are unused.
+ $ret = array();
+ foreach($may as $val){
+ if(!in_array($val,$used)){
+ $ret[$val] = $val;
+ }
+ }
+ return($ret);
}
diff --git a/gosa-plugins/fai/admin/fai/class_faiPartition.inc b/gosa-plugins/fai/admin/fai/class_faiPartition.inc
index 673d263fa885f8fc1f6e02316a1fe595379903b7..dc5220b470bb7dd2d30c471804942150863e9b38 100644 (file)
// Skip ourselves
if($disk['cn'] == $this->parent->DISKcn) continue;
+ if($disk['status'] == "delete") continue;
// Add partition from lvm combinations
if($disk['FAIdiskType'] == "lvm"){
foreach($disk['partitions'] as $key => $part){
+ if($part['status'] == "delete") continue;
+
// Add disks of raid arrays, to the used list.
if($disk['FAIdiskType'] == "raid"){
foreach(split(",",$part['FAIpartitionSize']) as $rDevice){