Author: jfthomps Date: Mon Apr 12 17:06:42 2010 New Revision: 933325 URL: http://svn.apache.org/viewvc?rev=933325&view=rev Log: VCL-220
utils.php: modified isAvailable - added condition to query that selects computers requiring virtualmachines to have a vmhostid that is not NULL computers.php: added check when adding computers that requires virtual machines to be in the maintenance state Modified: incubator/vcl/trunk/web/.ht-inc/computers.php incubator/vcl/trunk/web/.ht-inc/utils.php Modified: incubator/vcl/trunk/web/.ht-inc/computers.php URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/web/.ht-inc/computers.php?rev=933325&r1=933324&r2=933325&view=diff ============================================================================== --- incubator/vcl/trunk/web/.ht-inc/computers.php (original) +++ incubator/vcl/trunk/web/.ht-inc/computers.php Mon Apr 12 17:06:42 2010 @@ -42,6 +42,8 @@ define("IPADDRERR3", 1 << 8); define("IPADDRERR4", 1 << 9); /// signifies an error with the submitted start mac address define("MACADDRERR", 1 << 10); +/// signifies an error with the submitted machine type/state combination +define("VMAVAILERR", 1 << 11); //////////////////////////////////////////////////////////////////////////////// /// @@ -653,6 +655,9 @@ function editOrAddComputer($state) { print " <TD>\n"; printSelectInput("stateid", $states, $data["stateid"]); print " </TD>\n"; + print " <TD>"; + printSubmitErr(VMAVAILERR); + print "</TD>\n"; print " </TR>\n"; print " <TR>\n"; print " <TH align=right>Owner:</TH>\n"; @@ -2944,6 +2949,10 @@ function processComputerInput($checks=1) $submitErr |= OWNERERR; $submitErrMsg[OWNERERR] = "Submitted ID is not valid"; } + if($return['type'] == 'virtualmachine' && $return['stateid'] == 2) { + $submitErr |= VMAVAILERR; + $submitErrMsg[VMAVAILERR] = "Virtual machines can only be added in the maintenance state."; + } return $return; } Modified: incubator/vcl/trunk/web/.ht-inc/utils.php URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/web/.ht-inc/utils.php?rev=933325&r1=933324&r2=933325&view=diff ============================================================================== --- incubator/vcl/trunk/web/.ht-inc/utils.php (original) +++ incubator/vcl/trunk/web/.ht-inc/utils.php Mon Apr 12 17:06:42 2010 @@ -3324,7 +3324,8 @@ function isAvailable($images, $imageid, . "c.RAM >= i.minram AND " . "c.procnumber >= i.minprocnumber AND " . "c.procspeed >= i.minprocspeed AND " - . "c.network >= i.minnetwork AND "; + . "c.network >= i.minnetwork AND " + . "(c.type != 'virtualmachine' OR c.vmhostid IS NOT NULL) AND "; if(! $ignoreprivileges) $query .= "c.id IN ($usercomputers) AND "; $query .= "c.id IN ($mappedcomputers) AND "