From fb67332c94eee06ea5203b9f5a936fd34af323f2 Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 12 May 2011 09:05:47 +0000 Subject: [PATCH] Added disk creation option git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20812 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../goto/Device/AddPartitionDialog.tpl | 149 ++++++++++-------- .../goto/Device/class_AddPartitionDialog.inc | 33 +++- .../goto/Device/class_DevicePartition.inc | 22 +-- 3 files changed, 125 insertions(+), 79 deletions(-) diff --git a/gosa-plugins/goto/admin/systems/goto/Device/AddPartitionDialog.tpl b/gosa-plugins/goto/admin/systems/goto/Device/AddPartitionDialog.tpl index 35ddb9c64..03597c8c6 100644 --- a/gosa-plugins/goto/admin/systems/goto/Device/AddPartitionDialog.tpl +++ b/gosa-plugins/goto/admin/systems/goto/Device/AddPartitionDialog.tpl @@ -1,7 +1,10 @@

{t}Type{/t}

+{t}Disk{/t}
{t}Physical partition{/t}
{t}LVM Volume group{/t}
{t}LVM Volume{/t}

@@ -136,78 +140,93 @@ {elseif $selected_type==1} -

{t}Add Partition{/t}

- - - - - - - - - - - - -
{t}Mount point{/t} - {if $p_fsType == "raid" || $p_fsType == "swap" || $p_fsType == "pv"} - - {else} - - {/if} -
{t}File system type{/t} - -
{t}Allowable drives{/t} - {foreach from=$disks item=item key=key} - {$item} - {/foreach} + + + + + - - - - - - - - - - - -
+

{t}Add Partition{/t}

+ + + + + + + + + + + + + + + + + + + + + + + + + +
{t}Mount point{/t} + {if $p_fsType == "raid" || $p_fsType == "swap" || $p_fsType == "pv"} + + {else} + + {/if} +
{t}File system type{/t} + +
{t}Allowable drives{/t} + +
{t}Size{/t} + +
{t}Force to be primary partition{/t}
{t}Encrypt{/t}
+
+ +

{t}Additional size options{/t}

+ + + + + + + + + + + + + +
{t}Fixed size{/t}
{t}Fill to maximum allowable size{/t}
{t}Fill all space up to{/t} +  {t}MB{/t} +
{t}Size{/t} - -
{t}Force to be primary partition{/t}
{t}Encrypt{/t}
- -
- -

{t}Additional size options{/t}

+{elseif $selected_type==0} +

{t}Add disk{/t}

- - - - - - + - - - -
{t}Fixed size{/t}
{t}Fill all space up to{/t} -  {t}MB{/t} + {t}Disk name{/t} +
{t}Fill to maximum allowable size{/t}
{/if} 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 95a324466..ce55f3564 100644 --- a/gosa-plugins/goto/admin/systems/goto/Device/class_AddPartitionDialog.inc +++ b/gosa-plugins/goto/admin/systems/goto/Device/class_AddPartitionDialog.inc @@ -1,6 +1,7 @@ p_used_disk = key($this->diskList); + + // Preselect partition creation if we've already created a disk + if(count($this->disks)){ + $this->selected_type = PARTITION; + } } @@ -154,6 +166,10 @@ class AddPartitionDialog $bool_attrs = array("v_encrypt"); break; } + case DISK: { + $attrs = $this->d_attributes; + break; + } } // Assign properties to smarty. @@ -211,6 +227,10 @@ class AddPartitionDialog $bool_attrs = array("v_encrypt"); break; } + case DISK: { + $attrs = $this->d_attributes; + break; + } } // Get posted string values @@ -233,7 +253,14 @@ class AddPartitionDialog */ function save() { - if($this->selected_type == VOLUME_GROUP){ + if($this->selected_type == DISK){ + + // Get volume group properties + $name = $this->d_name; + $this->partitionObject->addDisk($name); + return($this->partitionObject->success()); + + }elseif($this->selected_type == VOLUME_GROUP){ // Get volume group properties $devices = $this->vg_partitions; @@ -377,7 +404,7 @@ class AddPartitionDialog }else{ // Add normal-physical partition - $target = $this->mountPoint; + $target = $this->p_mountPoint; if($fsType == "swap"){ $target = "swap"; } 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 b9f67910d..c20cd2776 100644 --- a/gosa-plugins/goto/admin/systems/goto/Device/class_DevicePartition.inc +++ b/gosa-plugins/goto/admin/systems/goto/Device/class_DevicePartition.inc @@ -21,18 +21,18 @@ class DevicePartition $rpc = $this->config->getRpcHandle(); $this->object = $rpc->openObject('libinst.preseed.diskdefinition', ''); - $this->object->addDisk('sda'); - $this->object->addDisk('sdb'); - $this->object->addDisk('sdc'); - $this->object->addPartition('/kekse', 2333, NULL, FALSE, TRUE, FALSE, FALSE, 'ext3','ro,user,nosuid' , FALSE, NULL, 'sda'); - $this->object->addPartition('/wurst', 2000, NULL, FALSE, TRUE, FALSE, FALSE, NULL, NULL, FALSE, NULL, 'sda'); - $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->addDisk('sda'); + #$this->object->addDisk('sdb'); + #$this->object->addDisk('sdc'); + #$this->object->addPartition('/kekse', 2333, NULL, FALSE, TRUE, FALSE, FALSE, 'ext3','ro,user,nosuid' , FALSE, NULL, 'sda'); + #$this->object->addPartition('/wurst', 2000, NULL, FALSE, TRUE, FALSE, FALSE, NULL, NULL, FALSE, NULL, 'sda'); + #$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 -- 2.30.2