svn commit: r1028304 - /incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows.pm

2010-10-28 Thread arkurth
Author: arkurth
Date: Thu Oct 28 14:12:16 2010
New Revision: 1028304

URL: http://svn.apache.org/viewvc?rev=1028304view=rev
Log:
VCL-411
Added calls to Windows.pm::post_load and clean_hard_drive to delete the VCL*cmd 
logon and logoff scripts if they exist.  Added call to 
remove_group_policy_script to delete the file that was specified.

Modified:
incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows.pm

Modified: incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows.pm
URL: 
http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows.pm?rev=1028304r1=1028303r2=1028304view=diff
==
--- incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows.pm Thu Oct 28 
14:12:16 2010
@@ -751,6 +751,17 @@ sub post_load {
 
 =item *
 
+ Delete legacy VCL logon/logoff scripts
+
+=cut
+   
+   my $system32_path = $self-get_system32_path();
+   if 
(!$self-delete_files_by_pattern($system32_path/GroupPolicy/User/Scripts, 
.*VCL.*cmd, 2)) {
+   notify($ERRORS{'WARNING'}, 0, failed to delete legacy VCL 
logon and logoff scripts);
+   }
+
+=item *
+
  Check if the imagemeta postoption is set to reboot, reboot if necessary
 
 =cut
@@ -5441,7 +5452,7 @@ sub delete_capture_configuration_files {
# Delete VCL scheduled task if it exists
$self-delete_scheduled_task('VCL Startup Configuration');
 
-   ## Remove VCLprepare.cmd and VCLcleanup.cmd lines from scripts.ini file
+   # Remove VCLprepare.cmd and VCLcleanup.cmd lines from scripts.ini file
$self-remove_group_policy_script('logon', 'VCLprepare.cmd');
$self-remove_group_policy_script('logoff', 'VCLcleanup.cmd');
 
@@ -5753,6 +5764,9 @@ sub remove_group_policy_script {
else {
$opposite_stage_argument = 'Logon';
}
+   
+   # Attempt to delete batch or script files specified by the argument
+   
$self-delete_files_by_pattern($system32_path/GroupPolicy/User/Scripts, 
.*$cmdline_argument.*, 2);
 
# Path to scripts.ini file
my $scripts_ini = $system32_path . 
'/GroupPolicy/User/Scripts/scripts.ini';
@@ -6283,8 +6297,9 @@ sub clean_hard_drive {
'$SYSTEMDRIVE/Documents and Settings,.*Temporary Internet 
Files\\/Content.*\\/.*,10',
'$SYSTEMDRIVE,.*pagefile\\.sys,1',
'$SYSTEMDRIVE/cygwin/home/root,.*%USERPROFILE%,1',
+   $system32_path/GroupPolicy/User/Scripts,.*VCL.*cmd
);
-
+   
# Attempt to stop the AFS service, needed to delete AFS files
if ($self-service_exists('TransarcAFSDaemon')) {
$self-stop_service('TransarcAFSDaemon');




svn commit: r1028338 - in /incubator/vcl/trunk/web: .ht-inc/images.php .ht-inc/managementnodes.php .ht-inc/privileges.php .ht-inc/utils.php js/images.js

2010-10-28 Thread jfthomps
Author: jfthomps
Date: Thu Oct 28 14:54:17 2010
New Revision: 1028338

URL: http://svn.apache.org/viewvc?rev=1028338view=rev
Log:
VCL-401
add manageMapping resource attribute to control resource mapping

utils.php: added getResourcePrivs

managementnodes.php:
-modified these functions to look at manageMapping attribute instead of 
manageGroup for mapping privileges:
  -selectMgmtnodeOption, viewMgmtnodeMapping, submitMgmtnodeMapping

images.php:
-modified these functions to look at manageMapping attribute instead of 
manageGroup for mapping privileges:
  -selectImageOption, viewImageMapping, imageMappingGrid, submitImageMapping, 
jsonImageMapCompGroups, jsonImageMapImgGroups, AJaddCompGrpToImgGrp, 
AJremCompGrpFromImgGrp, AJaddImgGrpToCompGrp, and AJremImgGrpFromCompGrp
-converted all references to json-comment-filtered to just json and to use 
sendJSON function

privileges.php:
-modified viewNodes:
  -instead of hardcoding resource types, call getResourcePrivs to get them
  -call getResourcePrivRowHTML instead of printResourcePrivRow and then print 
the returned HTML and JS
  -for add resource dialog, loop through resource privs to print checkboxes 
instead of printing them all directly
-modified selectNode:
  -instead of hardcoding resource types, call getResourcePrivs to get them
  -due to combining printResourcePrivRow and getResourcePrivRowHTML, needed to 
add a few str_replace's to prepare html for sending in ajax response
-combined printResourcePrivRow and getResourcePrivRowHTML
-modified getResourcePrivRowHTML:
  -added newlines
  -added manageMapping to checkboxes that don't get printed if don't have 
proper rights
  -added check to not print available checkbox for schedule and management node 
groups
  -added check to not print manageMapping for schedule groups
  -removed preg_replace for single quote; moved replacing them to selectNode
-modified AJsubmitAddResoucePriv to get resource types from getResourcePrivs 
instead of hard coding them
 
js/images.js: converted all references to json-comment-filtered to just json

Modified:
incubator/vcl/trunk/web/.ht-inc/images.php
incubator/vcl/trunk/web/.ht-inc/managementnodes.php
incubator/vcl/trunk/web/.ht-inc/privileges.php
incubator/vcl/trunk/web/.ht-inc/utils.php
incubator/vcl/trunk/web/js/images.js

Modified: incubator/vcl/trunk/web/.ht-inc/images.php
URL: 
http://svn.apache.org/viewvc/incubator/vcl/trunk/web/.ht-inc/images.php?rev=1028338r1=1028337r2=1028338view=diff
==
--- incubator/vcl/trunk/web/.ht-inc/images.php (original)
+++ incubator/vcl/trunk/web/.ht-inc/images.php Thu Oct 28 14:54:17 2010
@@ -60,9 +60,11 @@ function selectImageOption() {
$tmp = getUserResources(array(imageAdmin), array(manageGroup), 1);
$imgGroupCnt = count($tmp['image']);
 
-   # get a count of computer groups user can manage
-   $tmp = getUserResources(array(computerAdmin), array(manageGroup), 
1);
-   $compGroupCnt = count($tmp['computer']);
+   # get a count of image groups and computer groups user can map
+   $tmp = getUserResources(array(imageAdmin), array(manageMapping), 1);
+   $imgMapCnt = count($tmp['image']);
+   $tmp = getUserResources(array(computerAdmin), array(manageMapping), 
1);
+   $compMapCnt = count($tmp['computer']);
 
print H2Manage Images/H2\n;
print FORM action=\ . BASEURL . SCRIPT . \ method=post\n;
@@ -78,12 +80,12 @@ function selectImageOption() {
$cont = addContinuationsEntry('viewImageGrouping');
print INPUT type=radio name=continuation value=\$cont\Edit 
;
print Image Groupingbr\n;
+   }
 
-   if($compGroupCnt) {
-   $cont = addContinuationsEntry('viewImageMapping');
-   print INPUT type=radio name=continuation 
value=\$cont\Edit ;
-   print Image Mappingbr\n;
-   }
+   if($imgMapCnt  $compMapCnt) {
+   $cont = addContinuationsEntry('viewImageMapping');
+   print INPUT type=radio name=continuation value=\$cont\Edit 
;
+   print Image Mappingbr\n;
}
 
if($imgCnt) {
@@ -448,12 +450,12 @@ function imageGroupingGrid() {
 function viewImageMapping() {
global $mode;
$tmp = getUserResources(array(imageAdmin),
-   array(manageGroup), 1);
+   array(manageMapping), 1);
$imagegroups = $tmp[image];
uasort($imagegroups, sortKeepIndex);
$imagecompmapping = getResourceMapping(image, computer);
$resources = getUserResources(array(computerAdmin),
- array(manageGroup), 1);
+ array(manageMapping), 1);
$compgroups = $resources[computer];
uasort($compgroups, sortKeepIndex);
if(! count($imagegroups) || ! count($compgroups)) {
@@ 

svn commit: r1028387 - /incubator/vcl/trunk/web/.ht-inc/requests.php

2010-10-28 Thread jfthomps
Author: jfthomps
Date: Thu Oct 28 17:09:32 2010
New Revision: 1028387

URL: http://svn.apache.org/viewvc?rev=1028387view=rev
Log:
VCL-412
clicking on tomaintenance reload reservation in timetable gives an error

modified viewRequestInfo - set $reservation to $request['reservations'][0] if 
request stateid or laststateid = 18

Modified:
incubator/vcl/trunk/web/.ht-inc/requests.php

Modified: incubator/vcl/trunk/web/.ht-inc/requests.php
URL: 
http://svn.apache.org/viewvc/incubator/vcl/trunk/web/.ht-inc/requests.php?rev=1028387r1=1028386r2=1028387view=diff
==
--- incubator/vcl/trunk/web/.ht-inc/requests.php (original)
+++ incubator/vcl/trunk/web/.ht-inc/requests.php Thu Oct 28 17:09:32 2010
@@ -1235,7 +1235,7 @@ function detailStatusHTML($reqid) {
 function viewRequestInfo() {
$requestid = getContinuationVar(requestid);
$request = getRequestInfo($requestid);
-   if($request['forimaging'])
+   if($request['forimaging'] || $request['stateid'] == 18 || 
$request['laststateid'] == 18)
$reservation = $request['reservations'][0];
else {
foreach($request[reservations] as $res) {




svn commit: r1028403 [2/2] - in /incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware: VIM_SSH.pm VMware.pm vSphere_SDK.pm

2010-10-28 Thread arkurth
Modified: 
incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/vSphere_SDK.pm
URL: 
http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/vSphere_SDK.pm?rev=1028403r1=1028402r2=1028403view=diff
==
--- 
incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/vSphere_SDK.pm
 (original)
+++ 
incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/vSphere_SDK.pm
 Thu Oct 28 18:00:57 2010
@@ -394,7 +394,7 @@ sub get_vm_power_state {
   -physical compatibility mode (pass-through) raw disk mapping
   -passes SCSI commands directly to the hardware
   -cannot participate in snapshots
-   -sparse2Gb
+   -sparse2Gb, 2Gbsparse
   -sparse disk with 2GB maximum extent size
   -can be used with other VMware products
   -2GB extent size makes these disks easier to burn to dvd or 
use on filesystems that don't support large files
@@ -447,6 +447,19 @@ sub copy_virtual_disk {
# Get the adapter type and disk type arguments if they were specified
# If not specified, set the default values
my $destination_disk_type = shift || 'thin';
+   
+   # Fix the disk type in case 2gbsparse was passed
+   if ($destination_disk_type =~ /2gbsparse/i) {
+   $destination_disk_type = 'sparse2Gb';
+   }
+   
+   # Check the disk type argument, the string must match exactly or the 
copy will fail
+   my @valid_disk_types = qw( eagerZeroedThick flatMonolithic preallocated 
raw rdm rdmp sparse2Gb sparseMonolithic thick thick2Gb thin );
+   if (!grep(/^$destination_disk_type$/, @valid_disk_types)) {
+   notify($ERRORS{'WARNING'}, 0, disk type argument is not valid: 
'$destination_disk_type', it must exactly match (case sensitive) one of the 
following strings:\n . join(\n, @valid_disk_types));
+   return;
+   }
+   
my $destination_adapter_type = shift;

# If the adapter type was not specified, retrieve it from the source 
vmdk file
@@ -465,13 +478,6 @@ sub copy_virtual_disk {
return;
}

-   # Check the disk type argument, the string must match exactly or the 
copy will fail
-   my @valid_disk_types = qw( eagerZeroedThick flatMonolithic preallocated 
raw rdm rdmp sparse2Gb sparseMonolithic thick thick2Gb thin );
-   if (!grep(/^$destination_disk_type$/, @valid_disk_types)) {
-   notify($ERRORS{'WARNING'}, 0, disk type argument is not valid: 
'$destination_disk_type', it must exactly match (case sensitive) one of the 
following strings:\n . join(\n, @valid_disk_types));
-   return;
-   }
-   
# Get a virtual disk manager object
my $service_content = Vim::get_service_content() || return;
if (!$service_content-{virtualDiskManager}) {
@@ -490,7 +496,7 @@ sub copy_virtual_disk {
);

# Get the source vmdk file info so the source adapter and disk type can 
be displayed
-   my $source_info = $self-get_file_info($source_path) || return;
+   my $source_info = $self-_get_file_info($source_path) || return;
notify($ERRORS{'DEBUG'}, 0, source file info:\n . 
format_data($source_info));
my @file_names = keys(%{$source_info});
my $info_file_name = $file_names[0];
@@ -590,7 +596,7 @@ sub move_virtual_disk {

# Create a datacenter object
my $datacenter = Vim::find_entity_view(view_type = 'Datacenter');
-   if (!$virtual_disk_manager) {
+   if (!$datacenter) {
notify($ERRORS{'WARNING'}, 0, failed to create vSphere SDK 
datacenter object);
return;
}
@@ -610,7 +616,7 @@ sub move_virtual_disk {
# Check if an error occurred
if (my $fault = $@) {
# Get the source file info
-   my $source_file_info = 
$self-get_file_info($source_path)-{$source_path};
+   my $source_file_info = 
$self-_get_file_info($source_path)-{$source_path};

# A FileNotFound fault will be generated if the source vmdk 
file exists but there is a problem with it
if ($fault-isa('SoapFault')  ref($fault-detail) eq 
'FileNotFound'  defined($source_file_info-{type})  
$source_file_info-{type} !~ /vmdisk/i) {
@@ -632,6 +638,36 @@ sub move_virtual_disk {
 
 #/
 
+=head2 set_file_permissions
+
+ Parameters  : 
+ Returns : boolean
+ Description : 
+
+=cut
+
+sub set_file_permissions {
+   my $self = shift;
+   if (ref($self) !~ /VCL::Module/i) {
+   notify($ERRORS{'CRITICAL'}, 0, subroutine was called as a 
function, it must be called as a class method);
+   return;
+