From: hickert Date: Wed, 11 May 2011 14:14:46 +0000 (+0000) Subject: Updated partition dialog, it supports volume groups now X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=b77eed2aa7a9ec820ca8ae4014cd26d3cd57af9f;p=gosa.git Updated partition dialog, it supports volume groups now git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20807 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-plugins/goto/admin/systems/goto/Device/AddPartitionDialog.tpl b/gosa-plugins/goto/admin/systems/goto/Device/AddPartitionDialog.tpl index ec83157d8..ba93e6436 100644 --- a/gosa-plugins/goto/admin/systems/goto/Device/AddPartitionDialog.tpl +++ b/gosa-plugins/goto/admin/systems/goto/Device/AddPartitionDialog.tpl @@ -3,18 +3,51 @@ {t}Physical partition{/t}
-{t}Raid device{/t}
-{t}LVM Valume group{/t}
{t}LVM Valume{/t}

+{if $selected_type==4} + +

{t}LVM Volume{/t}

-{if $selected_type==2} +{elseif $selected_type==3} + +

{t}LVM Volume group{/t}

+ + + + + + + + + + + + + +
{t}Volume group name{/t} + +
{t}Physical extent{/t} + +
{t}Use LVM partitions{/t} + {foreach from=$freeLvmPartitions item=item key=key} +  {$item}
+ {/foreach} +
+ +{elseif $selected_type==2}

{t}Add raid device{/t}

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 f4406ba39..fa293e8f4 100644 --- a/gosa-plugins/goto/admin/systems/goto/Device/class_AddPartitionDialog.inc +++ b/gosa-plugins/goto/admin/systems/goto/Device/class_AddPartitionDialog.inc @@ -15,6 +15,16 @@ class AddPartitionDialog public $paritions = array(); public $selected_type = PARTITION; + // LVM Volume group properties + public $vg_name = ""; + public $vg_extend = 32; + public $vg_partitions = array(); + public $physicalExtendList = array(); + public $volumeGroups = array(); + public $lvmPartitions = array(); + public $usedLvmPartitions = array(); + public $freeLvmPartitions = array(); + // Raid device properties public $r_fsType = 'ext3'; public $r_fsOptions = ''; @@ -50,6 +60,9 @@ class AddPartitionDialog public $r_attributes = array("r_fsType", "r_mountPoint", "r_raidLevel", "r_partitions", "r_spares","r_encrypt", "r_fsOptions"); + // Volume group attributes + public $vg_attributes = array("vg_name", "vg_partitions", "vg_extend"); + /*! \brief Constructs the Dialog and loads all required informations * to be able to add partitions, raid devices, volumes groups ... * @param Config The GOsa configuration object. @@ -77,6 +90,13 @@ class AddPartitionDialog $this->raidLevelList[$lvl] = sprintf(_("Raid %s"), $lvl); } + // Create physical extend list for LVM Volume Groups + $this->physicalExtendList=array(); + for($i=0; $i<8; $i++){ + $number = pow(2, $i); + $this->physicalExtendList[$number] = $number; + } + // Load selectable disks $disks = $this->partitionObject->getDisks(); $this->disks = array(); @@ -87,18 +107,26 @@ class AddPartitionDialog // Get Free and used Raid Partitions $this->partitions = $this->partitionObject->getPartitions(); $this->raidDevices = $this->partitionObject->getRaidDevices(); + $this->volumeGroups = $this->partitionObject->getVolumeGroups(); $this->usedRaidPartitions = array(); $this->freeRaidPartitions = array(); $this->raidPartitions = array(); foreach($this->raidDevices as $dev){ $this->usedRaidPartitions = array_merge($dev['devices'], $this->usedRaidPartitions); } + foreach($this->volumeGroups as $vg){ + $this->usedLvmPartitions = array_merge($vg['partitions'], $this->usedLvmPartitions); + } foreach($this->partitions as $part){ if(preg_match("/^raid\./", $part['target'])){ $this->raidPartitions[] = $part['target']; } + if(preg_match("/^pv\./", $part['target'])){ + $this->lvmPartitions[] = $part['target']; + } } $this->freeRaidPartitions = array_remove_entries_ics($this->usedRaidPartitions, $this->raidPartitions); + $this->freeLvmPartitions = array_remove_entries_ics($this->usedLvmPartitions, $this->lvmPartitions); // Select first disk as default. $this->p_used_disk = key($this->disks); @@ -134,6 +162,10 @@ class AddPartitionDialog $bool_attrs = array("r_encrypt"); break; } + case VOLUME_GROUP: { + $attrs = $this->vg_attributes; + break; + } } // Assign properties to smarty. @@ -147,6 +179,8 @@ class AddPartitionDialog $smarty->assign('raidLevelList', $this->raidLevelList); $smarty->assign('freeRaidPartitions', $this->freeRaidPartitions); $smarty->assign('disks', $this->disks); + $smarty->assign('physicalExtendList', $this->physicalExtendList); + $smarty->assign('freeLvmPartitions', $this->freeLvmPartitions); return($smarty->fetch(get_template_path("goto/Device/AddPartitionDialog.tpl", TRUE))); } @@ -175,6 +209,16 @@ class AddPartitionDialog } break; } + case VOLUME_GROUP: { + $attrs = $this->vg_attributes; + $this->vg_partitions = array(); + foreach($this->freeLvmPartitions as $key => $part){ + if(isset($_POST['vg_partition_'.$key])){ + $this->vg_partitions[] = $part; + } + } + break; + } } // Get posted string values diff --git a/gosa-plugins/goto/admin/systems/goto/Device/class_DevicePartition.inc b/gosa-plugins/goto/admin/systems/goto/Device/class_DevicePartition.inc index 7aa5fa8a4..b9f67910d 100644 --- a/gosa-plugins/goto/admin/systems/goto/Device/class_DevicePartition.inc +++ b/gosa-plugins/goto/admin/systems/goto/Device/class_DevicePartition.inc @@ -29,8 +29,10 @@ class DevicePartition $this->object->addPartition('raid.00', 2000, NULL, FALSE, TRUE, FALSE, FALSE, NULL, NULL, FALSE, NULL, 'sda'); $this->object->addPartition('raid.01', 2000, NULL, FALSE, TRUE, FALSE, FALSE, NULL, NULL, FALSE, NULL, 'sda'); $this->object->addPartition('pv.00', 2333, NULL, FALSE, TRUE, FALSE, FALSE, NULL, NULL, FALSE, NULL, 'sda'); + $this->object->addPartition('pv.01', 2333, NULL, FALSE, TRUE, FALSE, FALSE, NULL, NULL, FALSE, NULL, 'sda'); + $this->object->addPartition('pv.02', 2333, NULL, FALSE, TRUE, FALSE, FALSE, NULL, NULL, FALSE, NULL, 'sda'); #$this->object->addRaidDevice('pv.01', 'md0', '0','0', NULL, NULL, TRUE, FALSE, array('raid.00', 'raid.01')); - #$this->object->addVolumeGroup('garnele', array('pv.00', 'pv.01')); + $this->object->addVolumeGroup('garnele', array('pv.00', 'pv.01')); #$this->object->addVolume('/home', 'garnele_home', 'garnele', 2000); // Prepare lists