From: hickert Date: Wed, 11 May 2011 14:35:07 +0000 (+0000) Subject: Enabled saving of LVM Volumes X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=814ef88cac3adb350c2b59a3cefa27c0eb401058;p=gosa.git Enabled saving of LVM Volumes git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20809 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 ba93e6436..4e6dc0132 100644 --- a/gosa-plugins/goto/admin/systems/goto/Device/AddPartitionDialog.tpl +++ b/gosa-plugins/goto/admin/systems/goto/Device/AddPartitionDialog.tpl @@ -17,6 +17,50 @@ {if $selected_type==4}

{t}LVM Volume{/t}

+ + + + + + + + + + + + + + + + + + + + + + + + + +
{t}Volume name{/t} + +
{t}Volume group{/t} + +
{t}Mount point{/t} + {if $v_fsType == "swap"} + + {else} + + {/if} +
{t}File system type{/t} + +
{t}Size{/t} + +
{t}Encrypt{/t}
{elseif $selected_type==3} 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 87d0bcdff..fb86911a9 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,7 @@ class AddPartitionDialog public $paritions = array(); public $selected_type = PARTITION; + // LVM Volume group properties public $vg_name = ""; public $vg_extend = 32; @@ -25,6 +26,16 @@ class AddPartitionDialog public $usedLvmPartitions = array(); public $freeLvmPartitions = array(); + // Volume properties + public $v_name = ""; + public $v_group = ""; + public $v_mountPoint = ""; + public $v_fsType = "ext3"; + public $v_fsOptions = ""; + public $v_size = 1000; + public $v_encrypt = FALSE; + public $volumeGroupList = array(); + // Raid device properties public $r_fsType = 'ext3'; public $r_fsOptions = ''; @@ -63,6 +74,10 @@ class AddPartitionDialog // Volume group attributes public $vg_attributes = array("vg_name", "vg_partitions", "vg_extend"); + // Volume attributes + public $v_attributes = array("v_name", "v_group", "v_mountPoint", "v_fsType", + "v_size", "v_encrypt", "v_fsOptions"); + /*! \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. @@ -115,6 +130,7 @@ class AddPartitionDialog $this->usedRaidPartitions = array_merge($dev['devices'], $this->usedRaidPartitions); } foreach($this->volumeGroups as $vg){ + $this->volumeGroupList[$vg['name']] = $vg['name']; $this->usedLvmPartitions = array_merge($vg['partitions'], $this->usedLvmPartitions); } foreach($this->partitions as $part){ @@ -166,6 +182,13 @@ class AddPartitionDialog $attrs = $this->vg_attributes; break; } + case VOLUME: { + $attrs = $this->v_attributes; + unset($fsTypes['raid']); + unset($fsTypes['pv']); + $bool_attrs = array("v_encrypt"); + break; + } } // Assign properties to smarty. @@ -180,6 +203,7 @@ class AddPartitionDialog $smarty->assign('freeRaidPartitions', $this->freeRaidPartitions); $smarty->assign('disks', $this->disks); $smarty->assign('physicalExtendList', $this->physicalExtendList); + $smarty->assign('volumeGroupList', $this->volumeGroupList); $smarty->assign('freeLvmPartitions', $this->freeLvmPartitions); return($smarty->fetch(get_template_path("goto/Device/AddPartitionDialog.tpl", TRUE))); } @@ -200,7 +224,6 @@ class AddPartitionDialog case RAID_DEVICE: { $attrs = $this->r_attributes; $bool_attrs = array("r_encrypt"); - $this->r_partitions = array(); foreach($this->freeRaidPartitions as $key => $part){ if(isset($_POST['r_partition_'.$key])){ @@ -219,6 +242,11 @@ class AddPartitionDialog } break; } + case VOLUME: { + $attrs = $this->v_attributes; + $bool_attrs = array("v_encrypt"); + break; + } } // Get posted string values @@ -243,13 +271,38 @@ class AddPartitionDialog { if($this->selected_type == VOLUME_GROUP){ - // Get raid device properties + // Get volume group properties $devices = $this->vg_partitions; $extend = $this->vg_extend; $name = $this->vg_name; $this->partitionObject->addVolumeGroup($name, $devices, $format=TRUE, $use_existing=FALSE, $extend); return($this->partitionObject->success()); + }elseif($this->selected_type == VOLUME){ + + // Get volume properties + $name = $this->v_name; + $fsType = $this->v_fsType; + $fsOptions = $this->v_fsOptions; + $group = $this->v_group; + $target = $this->v_mountPoint; + $size = $this->v_size; + $encrypt = $this->v_encrypt; + + $maxSize = NULL; + $grow = FALSE; + $format = TRUE; + $use_existing = FALSE; + + if($fsType == "swap"){ + $target = "swap"; + } + + $this->partitionObject->addVolume($target, $name, $group, $size, $maxSize, + $grow, $format, $use_existing, $fsType, $fsOptions); + + return($this->partitionObject->success()); + }elseif($this->selected_type == RAID_DEVICE){ // Get raid device properties