diff --git a/gosa-plugins/fai/admin/fai/class_faiPartition.inc b/gosa-plugins/fai/admin/fai/class_faiPartition.inc
index 059ebda2b7162e13b3b0b4b5c6c27d56ba9d4e60..ad553a2348acd2107c0841b3b4bd92271772a260 100644 (file)
var $preserve = false;
var $preserveType = "always";
var $preserve = false;
var $preserveType = "always";
- var $status = "";
var $raidDevices = array();
// Once we've exceeded the primary partition limit,
var $raidDevices = array();
// Once we've exceeded the primary partition limit,
{
$this->parent = $parent;
{
$this->parent = $parent;
- $this->status = "new";
$this->FAIdiskType = $type;
// Check if we should be able to add primary partitions.
$this->FAIdiskType = $type;
// Check if we should be able to add primary partitions.
}
}
}
}
- $this->status = $object['status'];
-
if($type == "disk" || $type =="lvm"){
/* Prepare size attribute
if($type == "disk" || $type =="lvm"){
/* Prepare size attribute
}elseif($type == "raid"){
// Extract raid devices out of the partition size attribute.
}elseif($type == "raid"){
// Extract raid devices out of the partition size attribute.
- $usedDisks = split(",",$this->FAIpartitionSize);
+ $usedDisks = explode(",",$this->FAIpartitionSize);
foreach($usedDisks as $disk){
$name = preg_replace("/:.*$/","",$disk);
$spare = preg_match("/:spare/",$disk);
foreach($usedDisks as $disk){
$name = preg_replace("/:.*$/","",$disk);
$spare = preg_match("/:spare/",$disk);
"ext4" => _("ext4"),
"reiserfs" => _("reiser fs"),
"xfs" => _("xfs"),
"ext4" => _("ext4"),
"reiserfs" => _("reiser fs"),
"xfs" => _("xfs"),
- "btrfs" => _("btrfs"));
+ "btrfs" => _("btrfs"),
+ "-" => "-");
$smarty->assign("partitionTypes", $types);
$smarty->assign("partitionSizeTypes", $partitionSizeTypes);
$smarty->assign("partitionTypes", $types);
$smarty->assign("partitionSizeTypes", $partitionSizeTypes);
*/
function getPartitionList()
{
*/
function getPartitionList()
{
- $array = array();
+ $may = $used = array();
foreach($this->parent->parent->disks as $disk){
foreach($this->parent->parent->disks as $disk){
- if($disk['FAIdiskType'] != "raid"){
- foreach($disk['partitions'] as $key => $part){
+
+ // Skip ourselves
+ if($disk['cn'] == $this->parent->DISKcn) continue;
+
+ // Add partition from lvm combinations
+ if($disk['FAIdiskType'] == "lvm"){
+ $used = array_merge($used,$disk['FAIlvmDevice']);
+ }
+
+ foreach($disk['partitions'] as $key => $part){
+
+ // Add disks of raid arrays, to the used list.
+ if($disk['FAIdiskType'] == "raid"){
+ foreach(explode(",",$part['FAIpartitionSize']) as $rDevice){
+ $used[] = preg_replace("/:.*$/i","",$rDevice);
+ }
+ }
+
+ // Collect all available disks
+ if($disk['FAIdiskType'] == "disk"){
$name = $part['cn'];
if(!isset($this->raidDevices[$name])){
$name = $part['cn'];
if(!isset($this->raidDevices[$name])){
- $array[$name] = $name." (".$disk['cn'].")";
+ $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);
}
}
}
// check mount point
}
// check mount point
- if($this->FAIfsType != "swap"){
+ if($this->FAIfsType != "swap" && $this->FAIfsType != "-"){
if(!preg_match("#^/#",$this->FAImountPoint)){
$msgs[] = msgPool::invalid(_("Mount point"));
}
if(!preg_match("#^/#",$this->FAImountPoint)){
$msgs[] = msgPool::invalid(_("Mount point"));
}
}
$ret['FAIpartitionSize'] = trim($ret['FAIpartitionSize'],",");
}
}
$ret['FAIpartitionSize'] = trim($ret['FAIpartitionSize'],",");
}
- $ret['status'] = $this->status;
if($this->FAIfsType == "swap"){
$ret['FAImountPoint'] = "swap";
if($this->FAIfsType == "swap"){
$ret['FAImountPoint'] = "swap";