summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1951b63)
raw | patch | inline | side by side (parent: 1951b63)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 11 May 2011 14:14:46 +0000 (14:14 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 11 May 2011 14:14:46 +0000 (14:14 +0000) |
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 ec83157d840a3e3b13a312069e3b2c68e37c148a..ba93e6436e748c648b7a89171edd93eea246cfae 100644 (file)
<input {if $selected_type==1} checked {/if} onClick="document.mainform.submit();"
type="radio" value="1" name="selected_type">{t}Physical partition{/t}<br>
-<input {if !count($freeRaidPartitions)} disabled {/if}
+<input {if count($freeRaidPartitions) != 2} disabled {/if}
{if $selected_type==2} checked {/if} onClick="document.mainform.submit();"
type="radio" value="2" name="selected_type">{t}Raid device{/t}<br>
-<input {if $selected_type==3} checked {/if} onClick="document.mainform.submit();"
+<input {if !count($freeLvmPartitions)} disabled {/if}
+ {if $selected_type==3} checked {/if} onClick="document.mainform.submit();"
type="radio" value="3" name="selected_type">{t}LVM Valume group{/t}<br>
<input {if $selected_type==4} checked {/if} onClick="document.mainform.submit();"
type="radio" value="4" name="selected_type">{t}LVM Valume{/t}<br>
<hr>
+{if $selected_type==4}
+
+ <h3>{t}LVM Volume{/t}</h3>
-{if $selected_type==2}
+{elseif $selected_type==3}
+
+ <h3>{t}LVM Volume group{/t}</h3>
+ <table>
+ <tr>
+ <td>{t}Volume group name{/t}</td>
+ <td>
+ <input type="text" name="vg_name" value="{$vg_name}">
+ </td>
+ </tr>
+ <tr>
+ <td>{t}Physical extent{/t}</td>
+ <td>
+ <select name="vg_extend">
+ {html_options options=$physicalExtendList selected=$vg_extend}
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td>{t}Use LVM partitions{/t}</td>
+ <td>
+ {foreach from=$freeLvmPartitions item=item key=key}
+ <input type="checkbox" name="vg_partition_{$key}"
+ {if in_array($item, $vg_partitions)} checked {/if}> {$item}<br>
+ {/foreach}
+ </td>
+ </tr>
+ </table>
+
+{elseif $selected_type==2}
<h3>{t}Add raid device{/t}</h3>
<table>
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 f4406ba390a6d00235f3050bba7c47363096a4df..fa293e8f48025d160ded26cddacab05a7ead7bae 100644 (file)
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 = '';
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.
$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();
// 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);
$bool_attrs = array("r_encrypt");
break;
}
+ case VOLUME_GROUP: {
+ $attrs = $this->vg_attributes;
+ break;
+ }
}
// Assign properties to smarty.
$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)));
}
}
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 7aa5fa8a4be4c088a87385feafa4e41c6f9266a0..b9f67910dddf542ee8816c6bb15976692af1f28c 100644 (file)
$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