vcl-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arku...@apache.org
Subject svn commit: r1647402 - in /vcl/trunk: managementnode/lib/VCL/DataStructure.pm managementnode/lib/VCL/Module/Provisioning/VMware/VMware.pm mysql/update-vcl.sql mysql/vcl.sql
Date Mon, 22 Dec 2014 21:06:30 GMT
Author: arkurth
Date: Mon Dec 22 21:06:29 2014
New Revision: 1647402

URL: http://svn.apache.org/r1647402
Log:
VCL-781
Added OS.minram column to database. Added explicit get_image_minram subroutine to DataStructure.pm
which returns the larger of the image.minram and OS.minram values. Removed code from VMware.pm
which determined minimum OS RAM values as it is now replaced by OS.minram.

Modified:
    vcl/trunk/managementnode/lib/VCL/DataStructure.pm
    vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/VMware.pm
    vcl/trunk/mysql/update-vcl.sql
    vcl/trunk/mysql/vcl.sql

Modified: vcl/trunk/managementnode/lib/VCL/DataStructure.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/DataStructure.pm?rev=1647402&r1=1647401&r2=1647402&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/DataStructure.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/DataStructure.pm Mon Dec 22 21:06:29 2014
@@ -377,7 +377,7 @@ $SUBROUTINE_MAPPINGS{image_maxinitialtim
 $SUBROUTINE_MAPPINGS{image_minnetwork} = '$self->request_data->{reservation}{RESERVATION_ID}{image}{minnetwork}';
 $SUBROUTINE_MAPPINGS{image_minprocnumber} = '$self->request_data->{reservation}{RESERVATION_ID}{image}{minprocnumber}';
 $SUBROUTINE_MAPPINGS{image_minprocspeed} = '$self->request_data->{reservation}{RESERVATION_ID}{image}{minprocspeed}';
-$SUBROUTINE_MAPPINGS{image_minram} = '$self->request_data->{reservation}{RESERVATION_ID}{image}{minram}';
+#$SUBROUTINE_MAPPINGS{image_minram} = '$self->request_data->{reservation}{RESERVATION_ID}{image}{minram}';
 #$SUBROUTINE_MAPPINGS{image_name} = '$self->request_data->{reservation}{RESERVATION_ID}{image}{name}';
 #$SUBROUTINE_MAPPINGS{image_osid} = '$self->request_data->{reservation}{RESERVATION_ID}{image}{OSid}';
 $SUBROUTINE_MAPPINGS{image_os_id} = '$self->request_data->{reservation}{RESERVATION_ID}{image}{OSid}';
@@ -402,6 +402,7 @@ $SUBROUTINE_MAPPINGS{image_os_name} = '$
 $SUBROUTINE_MAPPINGS{image_os_prettyname} = '$self->request_data->{reservation}{RESERVATION_ID}{image}{OS}{prettyname}';
 $SUBROUTINE_MAPPINGS{image_os_type} = '$self->request_data->{reservation}{RESERVATION_ID}{image}{OS}{type}';
 $SUBROUTINE_MAPPINGS{image_os_install_type} = '$self->request_data->{reservation}{RESERVATION_ID}{image}{OS}{installtype}';
+$SUBROUTINE_MAPPINGS{image_os_minram} = '$self->request_data->{reservation}{RESERVATION_ID}{image}{OS}{minram}';
 $SUBROUTINE_MAPPINGS{image_os_source_path} = '$self->request_data->{reservation}{RESERVATION_ID}{image}{OS}{sourcepath}';
 $SUBROUTINE_MAPPINGS{image_os_moduleid} = '$self->request_data->{reservation}{RESERVATION_ID}{image}{OS}{moduleid}';
 
@@ -2163,6 +2164,33 @@ sub get_reservation_user_login_ids {
 }
 
 #/////////////////////////////////////////////////////////////////////////////
+
+=head2 get_image_minram
+
+ Parameters  : none
+ Returns     : integer
+ Description : Returns the larger of the image.minram and OS.minram values.
+
+=cut
+
+
+sub get_image_minram {
+	my $self = shift;
+	# Check if subroutine was called as an object method
+	unless (ref($self) && $self->isa('VCL::DataStructure')) {
+		notify($ERRORS{'CRITICAL'}, 0, "subroutine can only be called as a VCL::DataStructure module
object method");
+		return;
+	}
+	
+	my $reservation_id = $self->reservation_id;
+	my $image_minram = $self->request_data->{reservation}{$reservation_id}{image}{minram};
+	my $os_minram = $self->request_data->{reservation}{$reservation_id}{image}{OS}{minram};
+	my $minram = max ($image_minram, $os_minram);
+	#notify($ERRORS{'DEBUG'}, 0, "image minram: $image_minram, OS minram: $os_minram, result:
$minram");
+	return $minram;
+}
+
+#/////////////////////////////////////////////////////////////////////////////
 
 1;
 __END__

Modified: vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/VMware.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/VMware.pm?rev=1647402&r1=1647401&r2=1647402&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/VMware.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/VMware.pm Mon Dec 22 21:06:29
2014
@@ -119,42 +119,36 @@ our %VM_OS_CONFIGURATION = (
 		"guestOS" => "winvista",
 		"ethernet-virtualDev" => "e1000",
 		"scsi-virtualDev" => "lsiLogic",
-		"memsize" => 1024,
 		"cpu_socket_limit" => 2,
 	},
 	"vista-x86_64" => {
 		"guestOS" => "winvista-64",
 		"ethernet-virtualDev" => "e1000",
 		"scsi-virtualDev" => "lsiLogic",
-		"memsize" => 1024,
 		"cpu_socket_limit" => 2,
 	}, 
 	"win7-x86" => {
 		"guestOS" => "windows7",
 		"ethernet-virtualDev" => "e1000",
 		"scsi-virtualDev" => "lsiLogic",
-		"memsize" => 1024,
 		"cpu_socket_limit" => 2,
 	},
 	"win7-x86_64" => {
 		"guestOS" => "windows7-64",
 		"ethernet-virtualDev" => "e1000",
 		"scsi-virtualDev" => "lsiLogic",
-		"memsize" => 2048,
 		"cpu_socket_limit" => 2,
 	},
 	"win8-x86" => {
 		"guestOS" => "windows8",
 		"ethernet-virtualDev" => "e1000",
 		"scsi-virtualDev" => "lsiLogic",
-		"memsize" => 1024,
 		"cpu_socket_limit" => 2,
 	}, 
 	"win8-x86_64" => {
 		"guestOS" => "windows8-64",
 		"ethernet-virtualDev" => "e1000",
 		"scsi-virtualDev" => "lsiLogic",
-		"memsize" => 2048,
 		"cpu_socket_limit" => 2,
 	}, 
 	"win2003-x86" => {
@@ -167,7 +161,6 @@ our %VM_OS_CONFIGURATION = (
 		"guestOS" => "winNetEnterprise-64",
 		"ethernet-virtualDev" => "e1000",
 		"scsi-virtualDev" => "lsiLogic",
-		"memsize" => 1024,
 		"cpu_socket_limit" => 64,
 	},
 	"win2008-x86" => {
@@ -212,16 +205,6 @@ our %VM_OS_CONFIGURATION = (
 	},
 );
 
-=head2 $VM_MINIMUM_MEMORY_MB
-
- Data type   : string
- Description : Minimum amount of memory in megabytes to be allocated to any VM.
-
-=cut
-
-our $VM_MINIMUM_MEMORY_MB = 512;
-
-
 =head2 $VSPHERE_SDK_PACKAGE
 
  Data type   : string
@@ -4846,16 +4829,12 @@ sub get_vm_ethernet_adapter_type {
  Parameters  : none
  Returns     : integer
  Description : Returns the amount of RAM in MB to be assigned to the VM. The
-               VCL minimum RAM value configured for the image is used as the
+               larger of the image and OS table 'minram' values is used as the
                base value.
                
                The RAM setting in the vmx file must be a multiple of 4. The
                minimum RAM value is checked to make sure it is a multiple of 4.
                If not, the value is rounded down.
-               
-               The RAM value is also checked to make sure it is not lower than
-               the $VM_MINIMUM_MEMORY_MB value. If so, the $VM_MINIMUM_MEMORY_MB
-               is returned.
 
 =cut
 
@@ -4880,18 +4859,7 @@ sub get_vm_ram {
 		notify($ERRORS{'DEBUG'}, 0, "image minimum RAM value ($image_minram_mb_original MB) is
not a multiple of 4, adjusting to $image_minram_mb MB");
 	}
 	
-	# Check if the image setting is too low
-	# Get the minimum memory size for the OS
-	my $vm_os_configuration = $self->get_vm_os_configuration();
-	my $vm_guest_os = $vm_os_configuration->{guestOS} || 'unknown';
-	my $vm_os_memsize = $vm_os_configuration->{memsize} || $VM_MINIMUM_MEMORY_MB;
-	if ($image_minram_mb < $vm_os_memsize) {
-		notify($ERRORS{'DEBUG'}, 0, "image minimum RAM value ($image_minram_mb MB) is too low for
the $vm_guest_os guest OS, adjusting to $vm_os_memsize MB");
-		return $vm_os_memsize;
-	}
-	else {
-		return $image_minram_mb;
-	}
+	return $image_minram_mb;
 }
 
 #/////////////////////////////////////////////////////////////////////////////

Modified: vcl/trunk/mysql/update-vcl.sql
URL: http://svn.apache.org/viewvc/vcl/trunk/mysql/update-vcl.sql?rev=1647402&r1=1647401&r2=1647402&view=diff
==============================================================================
--- vcl/trunk/mysql/update-vcl.sql (original)
+++ vcl/trunk/mysql/update-vcl.sql Mon Dec 22 21:06:29 2014
@@ -1041,6 +1041,7 @@ CREATE TABLE IF NOT EXISTS `natport` (
 --
 
 ALTER TABLE `OS` CHANGE `prettyname` `prettyname` varchar(64) NOT NULL default '';
+CALL AddColumnIfNotExists('OS', 'minram', "MEDIUMINT UNSIGNED NOT NULL DEFAULT '512' AFTER
installtype");
 
 -- --------------------------------------------------------
 
@@ -1513,6 +1514,10 @@ INSERT IGNORE INTO `OS` (`name`, `pretty
 INSERT IGNORE INTO `OS` (`name`, `prettyname`, `type`, `installtype`, `sourcepath`, `moduleid`)
VALUES ('centos7image', 'CentOS 7 Image', 'linux', 'partimage', 'image', (SELECT `id` FROM
`module` WHERE `name` LIKE 'os_linux'));
 INSERT IGNORE INTO `OS` (`name`, `prettyname`, `type`, `installtype`, `sourcepath`, `moduleid`)
VALUES ('rhelimage', 'General Red Hat Based Image', 'linux', 'partimage', 'image', (SELECT
`id` FROM `module` WHERE `name` LIKE 'os_linux'));
 
+UPDATE OS SET minram = 1024 WHERE name REGEXP 'win.*';
+UPDATE OS SET minram = 2048 WHERE name REGEXP 'win.*(7|8|2008|2012)';
+UPDATE OS SET minram = 1024 WHERE name REGEXP '(centos|rh|rhel)(5|6|7)';
+
 -- --------------------------------------------------------
 
 --

Modified: vcl/trunk/mysql/vcl.sql
URL: http://svn.apache.org/viewvc/vcl/trunk/mysql/vcl.sql?rev=1647402&r1=1647401&r2=1647402&view=diff
==============================================================================
--- vcl/trunk/mysql/vcl.sql (original)
+++ vcl/trunk/mysql/vcl.sql Mon Dec 22 21:06:29 2014
@@ -714,6 +714,7 @@ CREATE TABLE IF NOT EXISTS `OS` (
   `prettyname` varchar(64) NOT NULL default '',
   `type` varchar(30) NOT NULL,
   `installtype` varchar(30) NOT NULL default 'image',
+  `minram` mediumint(8) unsigned NOT NULL DEFAULT '512',
   `sourcepath` varchar(30) default NULL,
   `moduleid` smallint(5) unsigned default NULL,
   PRIMARY KEY  (`id`),
@@ -1731,6 +1732,10 @@ INSERT IGNORE INTO `OS` (`id`, `name`, `
 (53, 'centos7image', 'CentOS 7 (Bare Metal) Image', 'linux', 'partimage', 'image', 5),
 (54, 'rhelimage', 'Red Hat Based Image', 'linux', 'partimage', 'image', 5);
 
+UPDATE OS SET minram = 1024 WHERE name REGEXP 'win.*';
+UPDATE OS SET minram = 2048 WHERE name REGEXP 'win.*(7|8|2008|2012)';
+UPDATE OS SET minram = 1024 WHERE name REGEXP '(centos|rh|rhel)(5|6|7)';
+
 -- 
 -- Dumping data for table `OSinstalltype`
 -- 
@@ -2170,7 +2175,7 @@ ALTER TABLE `computerloadflow` ADD CONST
 ALTER TABLE `computerloadflow` ADD CONSTRAINT FOREIGN KEY (nextstateid) REFERENCES `computerloadstate`
(`id`) ON UPDATE CASCADE;
 
 -- 
--- Constraints for table `computerloadlog`
+-- Constraints for table `computerloadlog` 
 -- 
 ALTER TABLE `computerloadlog` ADD CONSTRAINT FOREIGN KEY (`reservationid`) REFERENCES `reservation`
(`id`) ON DELETE CASCADE;
 ALTER TABLE `computerloadlog` ADD CONSTRAINT FOREIGN KEY (`loadstateid`) REFERENCES `computerloadstate`
(`id`);



Mime
View raw message