You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@vcl.apache.org by jf...@apache.org on 2010/08/20 20:16:36 UTC
svn commit: r987596 - in /incubator/vcl/trunk/web:
.ht-inc/managementnodes.php .ht-inc/utils.php .ht-inc/vm.php
js/managementnodes.js js/vm.js
Author: jfthomps
Date: Fri Aug 20 18:16:35 2010
New Revision: 987596
URL: http://svn.apache.org/viewvc?rev=987596&view=rev
Log:
VCL-224
Move settings from vcld.conf to database except for database connection settings
utils.php:
-modified getManagementNodes - added publicIPconfiguration, publicSubnetMask, publicDefaultGateway, puclicDNSserver, sysadminEmailAddress, and sharedMailBox to the query
-modified getVMProfiles - changed 'name' to 'profilename'; added vmware_mac_eth0_generated and vmware_mac_eth1_generated
-modified getDojoHTML - added dijit.Tooltip to editMgmtNode case; added dijit.form.Select to editVMInfo case
managementnodes.php:
-added publicnetmask, publicgateway, publicdnsserver, sysadminemail, and sharedmailbox to set of fields that can be modified for a management node; this required adding 5 global defines and modifying editOrAddMgmtnode, confirmEditOrAddMgmtnode, updateMgmtnode, addMgmtnode, and processMgmtnodeInput
-converted help popups to be a ? icon with an associated dijit.Tooltip
-fixed bug in submitMgmtnodeGroups where getUserResources should have been called with mgmtNodeAdmin instead of groupAdmin
vm.php:
-modified editVMInfo to reference name of vm profile from 'name' to 'profilename' to fix bug where profiles could not be renamed
-added vmware_mac_eth[01]_generated (touched editVMInfo and AJupdateVMprofileItem)
-converted use of json-comment-filtered to normal json with a leading {} (touched vmhostdata, AJvmToHost, AJvmFromHost, AJvmFromHostDelayed, AJcancelVMmove, AJprofileData, AJnewProfile, AJdelProfile)
-added better input validation to AJupdateVMprofileItem
js/managementnodes.js:
-removed 3 global vars: xhrobj, blockHide, timeout
-removed showHelp
-removed clearHelpbox
-removed clearHelpbox2
-removed blockClear
-added togglePublic
js/vm.js:
-converted use of json-comment-filtered to normal json with a leading {} (touched getVMHostData, submitChangeProfile, vmToHost, vmFromHost, vmFromHostDelayed, cancelVMmove, getVMprofileData, newProfile, and delProfile)
-changed references to name of profile as 'name' to 'profilename' (touched VMHostDataCB, getVMprofileDataCB, newProfileCB, and delProfile)
-added vmware_mac_eth[01]_generated to getVMprofileDataCB and delProfile
-modified getVMprofileDataCB to check for vmtypeid, imageid, vmdiskid being 0 before setting the value of the filteringselect
Modified:
incubator/vcl/trunk/web/.ht-inc/managementnodes.php
incubator/vcl/trunk/web/.ht-inc/utils.php
incubator/vcl/trunk/web/.ht-inc/vm.php
incubator/vcl/trunk/web/js/managementnodes.js
incubator/vcl/trunk/web/js/vm.js
Modified: incubator/vcl/trunk/web/.ht-inc/managementnodes.php
URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/web/.ht-inc/managementnodes.php?rev=987596&r1=987595&r2=987596&view=diff
==============================================================================
--- incubator/vcl/trunk/web/.ht-inc/managementnodes.php (original)
+++ incubator/vcl/trunk/web/.ht-inc/managementnodes.php Fri Aug 20 18:16:35 2010
@@ -38,6 +38,16 @@ define("MNSSHPORTERR", 1 << 6);
define("MNSSHIDKEYSERR", 1 << 7);
/// signifies an error with submitted image library group id
define("MNIMGLIBGRPIDERR", 1 << 8);
+/// signifies an error with submitted public netmask
+define("MNPUBLICNETMASKERR", 1 << 9);
+/// signifies an error with submitted public gateway
+define("MNPUBLICGATEWAYERR", 1 << 10);
+/// signifies an error with submitted public dns server
+define("MNPUBLICDNSSERVERERR", 1 << 11);
+/// signifies an error with submitted sysadmin email address list
+define("MNSYSADMINEMAILERR", 1 << 12);
+/// signifies an error with submitted shared email address
+define("MNSHAREDMAILBOXERR", 1 << 13);
////////////////////////////////////////////////////////////////////////////////
@@ -220,15 +230,23 @@ function editOrAddMgmtnode($state) {
else
$data['imagelibenable'] = "";
$data['imagelibgroupid'] = $mgmtnodes[$id]['imagelibgroupid'];
- $data['imagelibgroup'] = $mgmtnodes[$id]['imagelibgroup']; # TODO this can be removed
$data['imagelibuser'] = $mgmtnodes[$id]['imagelibuser'];
$data['imagelibkey'] = $mgmtnodes[$id]['imagelibkey'];
$data['keys'] = $mgmtnodes[$id]['keys'];
$data['sshport'] = $mgmtnodes[$id]['sshport'];
+ $data['publicIPconfig'] = $mgmtnodes[$id]['publicIPconfig'];
+ $data['publicnetmask'] = $mgmtnodes[$id]['publicnetmask'];
+ $data['publicgateway'] = $mgmtnodes[$id]['publicgateway'];
+ $data['publicdnsserver'] = $mgmtnodes[$id]['publicdnsserver'];
+ $data['sysadminemail'] = $mgmtnodes[$id]['sysadminemail'];
+ $data['sharedmailbox'] = $mgmtnodes[$id]['sharedmailbox'];
}
$disabled = '';
if(! $data['imagelibenable'])
$disabled = 'disabled';
+ $disabled2 = '';
+ if($data['publicIPconfig'] != 'static')
+ $disabled2 = 'disabled';
print "<FORM action=\"" . BASEURL . SCRIPT . "\" method=post>\n";
print "<DIV align=center>\n";
@@ -271,20 +289,37 @@ function editOrAddMgmtnode($state) {
printSelectInput("stateid", $mgmtnodestates, $data["stateid"]);
print " </TD>\n";
print " </TR>\n";
+ # sysadmin email
+ print " <TR>\n";
+ print " <TH align=right>SysAdmin Email Address(es):</TH>\n";
+ print " <TD><INPUT type=text name=sysadminemail value=\"";
+ print $data["sysadminemail"] . "\" maxlength=128 id=sysadminemail>";
+ print "<img src=\"images/helpicon.png\" id=\"sysadminemailhelp\" /></TD>\n";
+ print " <TD>";
+ printSubmitErr(MNSYSADMINEMAILERR);
+ print "</TD>\n";
+ print " </TR>\n";
+ # shared mailbox
+ print " <TR>\n";
+ print " <TH align=right>Address for Shadow Emails:</TH>\n";
+ print " <TD><INPUT type=text name=sharedmailbox value=\"";
+ print $data["sharedmailbox"] . "\" maxlength=128 id=sharedmailbox>";
+ print "<img src=\"images/helpicon.png\" id=\"sharedmailboxhelp\" /></TD>\n";
+ print " <TD>";
+ printSubmitErr(MNSHAREDMAILBOXERR);
+ print "</TD>\n";
+ print " </TR>\n";
print " <TR>\n";
print " <TH align=right>Predictive Loading Module:</TH>\n";
- print " <TD>\n";
+ print " <TD nowrap>\n";
printSelectInput("premoduleid", $premodules, $data["premoduleid"]);
+ print " <img src=\"images/helpicon.png\" id=\"predictivehelp\" />\n";
print " </TD>\n";
print " </TR>\n";
# checkininterval
print " <TR>\n";
- print " <TH id=th1 align=right\n";
- print " onmouseover=\"showHelp('interval between database checks for new tasks', 'th1');\"\n";
- print " onmouseout=\"clearHelpbox();\">\n";
- print " Check-in Interval (sec):\n";
- print " </TH>\n";
+ print " <TH align=right>Check-in Interval (sec):</TH>\n";
print " <TD>\n";
print " <input dojoType=\"dijit.form.NumberSpinner\"\n";
print " value=\"{$data['checkininterval']}\"\n";
@@ -292,40 +327,32 @@ function editOrAddMgmtnode($state) {
print " maxlength=\"2\"\n";
print " id=\"checkininterval\"\n";
print " name=\"checkininterval\">\n";
+ print " <img src=\"images/helpicon.png\" id=\"checkinhelp\" />\n";
print " </TD>\n";
- print " <TD></TD>";
print " </TR>\n";
# installpath
print " <TR>\n";
- print " <TH id=th2 align=right\n";
- print " onmouseover=\"showHelp('path to parent directory of image repository directories', 'th2');\"\n";
- print " onmouseout=\"clearHelpbox();\">\n";
- print " Install Path:</TH>\n";
+ print " <TH align=right>Install Path:</TH>\n";
print " <TD><INPUT type=text name=installpath value=\"";
- print $data["installpath"] . "\" maxlength=100></TD>\n";
+ print $data["installpath"] . "\" maxlength=100>";
+ print "<img src=\"images/helpicon.png\" id=\"installpathhelp\" /></TD>\n";
print " <TD>";
printSubmitErr(MNINSTPATHERR);
print "</TD>\n";
print " </TR>\n";
# keys
print " <TR>\n";
- print " <TH id=th5 align=right\n";
- print " onmouseover=\"showHelp('comma delimited list of full paths to ssh identity keys to try when connecting to end nodes (optional)', 'th5');\"\n";
- print " onmouseout=\"clearHelpbox();\">\n";
- print " End Node SSH Identity Key Files:</TH>\n";
+ print " <TH align=right>End Node SSH Identity Key Files:</TH>\n";
print " <TD><INPUT type=text name=keys value=\"";
- print $data["keys"] . "\" maxlength=1024></TD>\n";
+ print $data["keys"] . "\" maxlength=1024>";
+ print "<img src=\"images/helpicon.png\" id=\"identityhelp\" /></TD>\n";
print " <TD>";
printSubmitErr(MNSSHIDKEYSERR);
print "</TD>\n";
print " </TR>\n";
# sshport
print " <TR>\n";
- print " <TH id=th6 align=right\n";
- print " onmouseover=\"showHelp('SSH port this node is listening on for image file transfers', 'th6');\"\n";
- print " onmouseout=\"clearHelpbox();\">\n";
- print " SSH Port for this node:\n";
- print " </TH>\n";
+ print " <TH align=right>SSH Port for this node:</TH>\n";
print " <TD>\n";
print " <input dojoType=\"dijit.form.NumberSpinner\"\n";
print " value=\"{$data['sshport']}\"\n";
@@ -333,6 +360,7 @@ function editOrAddMgmtnode($state) {
print " maxlength=\"5\"\n";
print " id=\"sshport\"\n";
print " name=\"sshport\">\n";
+ print " <img src=\"images/helpicon.png\" id=\"sshporthelp\" />\n";
print " </TD>\n";
print " <TD>";
printSubmitErr(MNSSHPORTERR);
@@ -340,27 +368,23 @@ function editOrAddMgmtnode($state) {
print " </TR>\n";
# imagelibenable
print " <TR>\n";
- print " <TH id=th7 align=right\n";
- print " onmouseover=\"showHelp('path to parent directory of image repository directories', 'th7');\"\n";
- print " onmouseout=\"clearHelpbox();\">\n";
- print " Enable Image Library:</TH>\n";
+ print " <TH align=right>Enable Image Library:</TH>\n";
print " <TD><input type=checkbox name=imagelibenable value=1 ";
- print $data["imagelibenable"] . " onchange=\"toggleImageLibrary();\" \n";
+ print $data["imagelibenable"] . " onchange=\"toggleImageLibrary();\" ";
if($data['imagelibenable'])
- print "id=imagelibenable checked></TD>\n";
+ print "id=imagelibenable checked>";
else
- print "id=imagelibenable></TD>\n";
- print " <TD></TD>\n";
+ print "id=imagelibenable>";
+ print "<img src=\"images/helpicon.png\" id=\"imagelibhelp\" /></TD>\n";
print " </TR>\n";
# imagelibgroupid
print " <TR>\n";
- print " <TH id=th8 align=right\n";
- print " onmouseover=\"showHelp('this management node will try to get image files from other nodes in the selected group', 'th8');\"\n";
- print " onmouseout=\"clearHelpbox();\">\n";
- print " Image Library Management Node Group:</TH>\n";
+ print " <TH align=right>Image Library Management Node Group:</TH>\n";
print " <TD>";
$mgmtnodegroups = getUserResources(array('mgmtNodeAdmin'), array("manageGroup"), 1);
- printSelectInput("imagelibgroupid", $mgmtnodegroups['managementnode'], -1, 0, 0, 'imagelibgroupid', $disabled);
+ printSelectInput("imagelibgroupid", $mgmtnodegroups['managementnode'],
+ $data['imagelibgroupid'], 0, 0, 'imagelibgroupid', $disabled);
+ print " <img src=\"images/helpicon.png\" id=\"imagelibgrouphelp\" />\n";
print " </TD>\n";
print " <TD>";
printSubmitErr(MNIMGLIBGRPIDERR);
@@ -368,42 +392,82 @@ function editOrAddMgmtnode($state) {
print " </TR>\n";
# imagelibuser
print " <TR>\n";
- print " <TH id=th3 align=right\n";
- print " onmouseover=\"showHelp('userid to use when scp\'ing image files from another management node', 'th3');\"\n";
- print " onmouseout=\"clearHelpbox();\">\n";
- print " Image Library User:</TH>\n";
+ print " <TH align=right>Image Library User:</TH>\n";
print " <TD><INPUT type=text name=imagelibuser value=\"";
- print $data["imagelibuser"] . "\" $disabled id=imagelibuser></TD>\n";
+ print $data["imagelibuser"] . "\" $disabled id=imagelibuser>";
+ print "<img src=\"images/helpicon.png\" id=\"imagelibuserhelp\" /></TD>\n";
print " <TD>";
printSubmitErr(MNIMGLIBUSERERR);
print "</TD>\n";
print " </TR>\n";
# imagelibkey
print " <TR>\n";
- print " <TH id=th4 align=right\n";
- print " onmouseover=\"showHelp('path to ssh identity key file to use when scp\'ing image files from another management node', 'th4');\"\n";
- print " onmouseout=\"clearHelpbox();\">\n";
- print " Image Library SSH Identity Key File:</TH>\n";
+ print " <TH align=right>Image Library SSH Identity Key File:</TH>\n";
print " <TD><INPUT type=text name=imagelibkey value=\"";
- print $data["imagelibkey"] . "\" maxlength=100 $disabled id=imagelibkey></TD>\n";
+ print $data["imagelibkey"] . "\" maxlength=100 $disabled id=imagelibkey>";
+ print "<img src=\"images/helpicon.png\" id=\"imagelibkeyhelp\" /></TD>\n";
print " <TD>";
printSubmitErr(MNIMGLIBKEYERR);
print "</TD>\n";
print " </TR>\n";
+ # publicIPconfig
+ print " <TR>\n";
+ print " <TH align=right>Public NIC configuration method:</TH>\n";
+ print " <TD>";
+ $publicipconfigs = array('dynamicDHCP' => 'Dynamic DHCP',
+ 'manualDHCP' => 'Manual DHCP',
+ 'static' => 'Static');
+ printSelectInput("publicIPconfig", $publicipconfigs, $data['publicIPconfig'],
+ 0, 0, 'publicIPconfig', "onChange=\"togglePublic();\"");
+ print " <img src=\"images/helpicon.png\" id=\"ipconfighelp\" />\n";
+ print " </TD>\n";
+ print " </TR>\n";
+ # public netmask
+ print " <TR>\n";
+ print " <TH align=right>Public Netmask:</TH>\n";
+ print " <TD><INPUT type=text name=publicnetmask value=\"";
+ print $data["publicnetmask"] . "\" maxlength=15 $disabled2 id=publicnetmask>";
+ print "<img src=\"images/helpicon.png\" id=\"netmaskhelp\" /></TD>\n";
+ print " <TD>";
+ printSubmitErr(MNPUBLICNETMASKERR);
+ print "</TD>\n";
+ print " </TR>\n";
+ # public gateway
+ print " <TR>\n";
+ print " <TH align=right>Public Gateway:</TH>\n";
+ print " <TD><INPUT type=text name=publicgateway value=\"";
+ print $data["publicgateway"] . "\" maxlength=56 $disabled2 id=publicgateway>";
+ print "<img src=\"images/helpicon.png\" id=\"gatewayhelp\" /></TD>\n";
+ print " <TD>";
+ printSubmitErr(MNPUBLICGATEWAYERR);
+ print "</TD>\n";
+ print " </TR>\n";
+ # public dnsserver
+ print " <TR>\n";
+ print " <TH align=right>Public DNS Server:</TH>\n";
+ print " <TD><INPUT type=text name=publicdnsserver value=\"";
+ print $data["publicdnsserver"] . "\" maxlength=56 $disabled2 id=publicdnsserver>";
+ print "<img src=\"images/helpicon.png\" id=\"dnsserverhelp\" /></TD>\n";
+ print " <TD>";
+ printSubmitErr(MNPUBLICDNSSERVERERR);
+ print "</TD>\n";
+ print " </TR>\n";
print "</TABLE>\n";
print "<TABLE>\n";
print " <TR valign=top>\n";
print " <TD>\n";
if($state) {
- $cdata = array('mgmtgroups' => $mgmtnodegroups['managementnode']);
+ $cdata = array('mgmtgroups' => $mgmtnodegroups['managementnode'],
+ 'publicipconfigs' => $publicipconfigs);
$cont = addContinuationsEntry('confirmAddMgmtnode', $cdata, SECINDAY, 0, 1, 1);
print " <INPUT type=hidden name=continuation value=\"$cont\">\n";
print " <INPUT type=submit value=\"Confirm Management Node\">\n";
}
else {
$cdata = array('mgmtnodeid' => $data['mgmtnodeid'],
- 'mgmtgroups' => $mgmtnodegroups['managementnode']);
+ 'mgmtgroups' => $mgmtnodegroups['managementnode'],
+ 'publicipconfigs' => $publicipconfigs);
$cont = addContinuationsEntry('confirmEditMgmtnode', $cdata, SECINDAY, 0, 1, 1);
print " <INPUT type=hidden name=continuation value=\"$cont\">\n";
print " <INPUT type=submit value=\"Confirm Changes\">\n";
@@ -420,6 +484,79 @@ function editOrAddMgmtnode($state) {
print " </TR>\n";
print "</TABLE>\n";
print "<div id=helpbox onmouseover=\"blockClear();\" onmouseout=\"clearHelpbox2(0);\"></div>\n";
+
+ # tooltips
+ print <<<END
+<div dojoType="dijit.Tooltip" connectId="sysadminemailhelp">
+Comma delimited list of email addresses for sysadmins<br>
+who should receive error emails from this management<br>
+node. Leave empty to disable this feature.
+</div>
+<div dojoType="dijit.Tooltip" connectId="sharedmailboxhelp">
+Single email address to which copies of all user<br>
+emails should be sent. This is a high traffic set<br>
+of emails. Leave empty to disable this feature.
+</div>
+<div dojoType="dijit.Tooltip" connectId="predictivehelp">
+This is the method used to determine which image should<br>
+be loaded on a computer at the end of a reservation.
+</div>
+<div dojoType="dijit.Tooltip" connectId="checkinhelp">
+the number of seconds that this management node<br>
+will wait before checking the database for tasks.
+</div>
+<div dojoType="dijit.Tooltip" connectId="installpathhelp">
+path to parent directory of image repository<br>
+directories (typically /install)
+</div>
+<div dojoType="dijit.Tooltip" connectId="identityhelp">
+comma delimited list of full paths to ssh identity<br>
+keys to try when connecting to end nodes (optional)
+</div>
+<div dojoType="dijit.Tooltip" connectId="sshporthelp">
+SSH port this node is listening on for image file transfers
+</div>
+<div dojoType="dijit.Tooltip" connectId="imagelibhelp">
+Enable sharing of images between management nodes. This allows<br>
+a management node to attempt fetching files for a requested<br>
+image from other management nodes if it does not have them.
+</div>
+<div dojoType="dijit.Tooltip" connectId="imagelibgrouphelp">
+This management node will try to get image<br>
+files from other nodes in the selected group.
+</div>
+<div dojoType="dijit.Tooltip" connectId="imagelibuserhelp">
+userid to use for scp when copying image<br>
+files from another management node
+</div>
+<div dojoType="dijit.Tooltip" connectId="imagelibkeyhelp">
+path to ssh identity key file to use for scp when<br>
+copying image files from another management node
+</div>
+<div dojoType="dijit.Tooltip" connectId="ipconfighelp">
+Method by which public NIC on nodes controlled by<br>
+this management node recive their network configuration
+<ul>
+<li>Dynamic DHCP - nodes receive an address<br>
+ via DHCP from a pool of addresses</li>
+<li>Manual DHCP - nodes always receive the<br>
+ same address via DHCP</li>
+<li>Static - VCL will configure the public<br>
+ address of the node</li>
+</ul>
+</div>
+<div dojoType="dijit.Tooltip" connectId="netmaskhelp">
+Netmask for public NIC
+</div>
+<div dojoType="dijit.Tooltip" connectId="gatewayhelp">
+IP address of gateway for public NIC
+</div>
+<div dojoType="dijit.Tooltip" connectId="dnsserverhelp">
+comma delimited list of IP addresses of DNS servers for public network
+</div>
+<div dojoType="dijit.Tooltip" connectId="wkdayshelp">
+</div>
+END;
}
////////////////////////////////////////////////////////////////////////////////
@@ -436,6 +573,7 @@ function confirmEditOrAddMgmtnode($state
$data = processMgmtnodeInput(1);
$premodules = getPredictiveModules();
+ $publicipconfigs = getContinuationVar('publicipconfigs');
if($submitErr) {
editOrAddMgmtnode($state);
@@ -475,6 +613,20 @@ function confirmEditOrAddMgmtnode($state
print " <TD>{$mgmtnodestates[$data["stateid"]]}</TD>\n";
print " </TR>\n";
print " <TR>\n";
+ print " <TH align=right>SysAdmin Email Address(es):</TH>\n";
+ if(empty($data['sysadminemail']))
+ print " <TD>(SysAdmin emails disabled)</TD>\n";
+ else
+ print " <TD>{$data["sysadminemail"]}</TD>\n";
+ print " </TR>\n";
+ print " <TR>\n";
+ print " <TH align=right>Address for Shadow Emails:</TH>\n";
+ if(empty($data['sharedmailbox']))
+ print " <TD>(Shadow emails disabled)</TD>\n";
+ else
+ print " <TD>{$data["sharedmailbox"]}</TD>\n";
+ print " </TR>\n";
+ print " <TR>\n";
print " <TH align=right>Predictive Loading Module:</TH>\n";
print " <TD>{$premodules[$data["premoduleid"]]['prettyname']}</TD>\n";
print " </TR>\n";
@@ -519,6 +671,24 @@ function confirmEditOrAddMgmtnode($state
print " <TD>disabled</TD>\n";
print " </TR>\n";
}
+ print " <TR>\n";
+ print " <TH align=right>Public NIC configuration method:</TH>\n";
+ print " <TD>{$publicipconfigs[$data["publicIPconfig"]]}</TD>\n";
+ print " </TR>\n";
+ if($data['publicIPconfig'] == 'static') {
+ print " <TR>\n";
+ print " <TH align=right>Public Netmask:</TH>\n";
+ print " <TD>{$data["publicnetmask"]}</TD>\n";
+ print " </TR>\n";
+ print " <TR>\n";
+ print " <TH align=right>Public Gateway:</TH>\n";
+ print " <TD>{$data["publicgateway"]}</TD>\n";
+ print " </TR>\n";
+ print " <TR>\n";
+ print " <TH align=right>Public DNS Server:</TH>\n";
+ print " <TD>{$data["publicdnsserver"]}</TD>\n";
+ print " </TR>\n";
+ }
print "</TABLE>\n";
print "<TABLE>\n";
print " <TR valign=top>\n";
@@ -716,7 +886,7 @@ function submitMgmtnodeGroups() {
$mgmtnodes = getManagementNodes();
# build an array of memberships currently in the db
- $tmp = getUserResources(array("groupAdmin"), array("manageGroup"), 1);
+ $tmp = getUserResources(array("mgmtNodeAdmin"), array("manageGroup"), 1);
$mgmtnodegroupsIDs = array_keys($tmp["managementnode"]); // ids of groups that user can manage
$resources = getUserResources(array("mgmtNodeAdmin"),
array("manageGroup"));
@@ -997,6 +1167,14 @@ function submitMgmtnodeMapping() {
///
////////////////////////////////////////////////////////////////////////////////
function updateMgmtnode($data) {
+ if(empty($data['sysadminemail']))
+ $data['sysadminemail'] = 'NULL';
+ else
+ $data['sysadminemail'] = "'" . mysql_real_escape_string($data['sysadminemail']) . "'";
+ if(empty($data['sharedmailbox']))
+ $data['sharedmailbox'] = 'NULL';
+ else
+ $data['sharedmailbox'] = "'" . mysql_real_escape_string($data['sharedmailbox']) . "'";
$ownerid = getUserlistID($data["owner"]);
$data['installpath'] = mysql_real_escape_string($data['installpath']);
$data['keys'] = mysql_real_escape_string($data['keys']);
@@ -1012,6 +1190,16 @@ function updateMgmtnode($data) {
$data['keys'] = 'NULL';
else
$data['keys'] = "'{$data['keys']}'";
+ if($data['publicIPconfig'] != 'static') {
+ $data['publicnetmask'] = 'NULL';
+ $data['publicgateway'] = 'NULL';
+ $data['publicdnsserver'] = 'NULL';
+ }
+ else {
+ $data['publicnetmask'] = "'" . mysql_real_escape_string($data['publicnetmask']) . "'";
+ $data['publicgateway'] = "'" . mysql_real_escape_string($data['publicgateway']) . "'";
+ $data['publicdnsserver'] = "'" . mysql_real_escape_string($data['publicdnsserver']) . "'";
+ }
$query = "UPDATE managementnode "
. "SET hostname = '{$data["hostname"]}', "
. "IPaddress = '{$data["IPaddress"]}', "
@@ -1025,7 +1213,13 @@ function updateMgmtnode($data) {
. "imagelibenable = {$data["imagelibenable"]}, "
. "imagelibgroupid = {$data["imagelibgroupid"]}, "
. "imagelibuser = {$data["imagelibuser"]}, "
- . "imagelibkey = {$data["imagelibkey"]} "
+ . "imagelibkey = {$data["imagelibkey"]}, "
+ . "publicIPconfiguration = '{$data["publicIPconfig"]}', "
+ . "publicSubnetMask = {$data["publicnetmask"]}, "
+ . "publicDefaultGateway = {$data["publicgateway"]}, "
+ . "publicDNSserver = {$data["publicdnsserver"]}, "
+ . "sysadminEmailAddress = {$data["sysadminemail"]}, "
+ . "sharedMailBox = {$data["sharedmailbox"]} "
. "WHERE id = " . $data["mgmtnodeid"];
$qh = doQuery($query, 101);
return mysql_affected_rows($GLOBALS["mysql_link_vcl"]);
@@ -1044,6 +1238,14 @@ function updateMgmtnode($data) {
////////////////////////////////////////////////////////////////////////////////
function addMgmtnode($data) {
$ownerid = getUserlistID($data["owner"]);
+ if(empty($data['sysadminemail']))
+ $data['sysadminemail'] = 'NULL';
+ else
+ $data['sysadminemail'] = "'" . mysql_real_escape_string($data['sysadminemail']) . "'";
+ if(empty($data['sharedmailbox']))
+ $data['sharedmailbox'] = 'NULL';
+ else
+ $data['sharedmailbox'] = "'" . mysql_real_escape_string($data['sharedmailbox']) . "'";
$data['installpath'] = mysql_real_escape_string($data['installpath']);
$data['keys'] = mysql_real_escape_string($data['keys']);
$data['imagelibuser'] = mysql_real_escape_string($data['imagelibuser']);
@@ -1058,6 +1260,16 @@ function addMgmtnode($data) {
$data['keys'] = 'NULL';
else
$data['keys'] = "'{$data['keys']}'";
+ if($data['publicIPconfig'] != 'static') {
+ $data['publicnetmask'] = 'NULL';
+ $data['publicgateway'] = 'NULL';
+ $data['publicdnsserver'] = 'NULL';
+ }
+ else {
+ $data['publicnetmask'] = "'" . mysql_real_escape_string($data['publicnetmask']) . "'";
+ $data['publicgateway'] = "'" . mysql_real_escape_string($data['publicgateway']) . "'";
+ $data['publicdnsserver'] = "'" . mysql_real_escape_string($data['publicdnsserver']) . "'";
+ }
$query = "INSERT INTO managementnode "
. "(hostname, "
. "IPaddress, "
@@ -1071,7 +1283,13 @@ function addMgmtnode($data) {
. "imagelibkey, "
. "`keys`, "
. "predictivemoduleid, "
- . "sshport) "
+ . "sshport, "
+ . "publicIPconfiguration, "
+ . "publicSubnetMask, "
+ . "publicDefaultGateway, "
+ . "publiDNSserver, "
+ . "sysadminEmailAddress, "
+ . "sharedMailBox "
. "VALUES ('{$data["hostname"]}', "
. "'{$data["IPaddress"]}', "
. "$ownerid, "
@@ -1084,7 +1302,13 @@ function addMgmtnode($data) {
. "{$data["imagelibkey"]}, "
. "{$data["keys"]}, "
. "{$data["premoduleid"]}, "
- . "{$data["sshport"]}) ";
+ . "{$data["sshport"]}, "
+ . "'{$data["publicIPconfig"]}', "
+ . "{$data["publicnetmask"]}, "
+ . "{$data["publicgateway"]}, "
+ . "{$data["publicdnsserver"]}, "
+ . "{$data["sysadminemail"]}, "
+ . "{$data["sharedmailbox"]})";
doQuery($query, 205);
// get last insert id
@@ -1138,6 +1362,13 @@ function processMgmtnodeInput($checks=1)
$return["imagelibuser"] = getContinuationVar("imagelibuser", processInputVar("imagelibuser", ARG_STRING));
$return["imagelibkey"] = getContinuationVar("imagelibkey", processInputVar("imagelibkey", ARG_STRING));
+ $return['publicIPconfig'] = getContinuationVar("publicIPconfig", processInputVar("publicIPconfig", ARG_STRING));
+ $return['publicnetmask'] = getContinuationVar("publicnetmask", processInputVar("publicnetmask", ARG_STRING));
+ $return['publicgateway'] = getContinuationVar("publicgateway", processInputVar("publicgateway", ARG_STRING));
+ $return['publicdnsserver'] = getContinuationVar("publicdnsserver", processInputVar("publicdnsserver", ARG_STRING));
+ $return['sysadminemail'] = getContinuationVar("sysadminemail", processInputVar("sysadminemail", ARG_STRING));
+ $return['sharedmailbox'] = getContinuationVar("sharedmailbox", processInputVar("sharedmailbox", ARG_STRING));
+
if($return['checkininterval'] < 5)
$return['checkininterval'] = 5;
if($return['checkininterval'] > 30)
@@ -1216,6 +1447,73 @@ function processMgmtnodeInput($checks=1)
$return["imagelibkey"] = 'NULL';
}
+ if(! preg_match('/^(dynamicDHCP|manualDHCP|static)$/', $return['publicIPconfig']))
+ $return['publicIPconfig'] = 'dynamicDHCP';
+
+ if($return['publicIPconfig'] == 'static') {
+ if(! preg_match('/^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/', $return['publicnetmask'], $matches) ||
+ $matches[1] < 0 || $matches[1] > 255 ||
+ $matches[2] < 0 || $matches[2] > 255 ||
+ $matches[3] < 0 || $matches[3] > 255 ||
+ $matches[4] < 0 || $matches[4] > 255) {
+ $submitErr |= MNPUBLICNETMASKERR;
+ $submitErrMsg[MNPUBLICNETMASKERR] = "Invalid subnet mask entered";
+ }
+ if(preg_match('/^([0-9]{1,3}(\.?))+$/', $return['publicgateway'])) {
+ if(preg_match('/^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/', $return['publicgateway'], $matches)) {
+ if($matches[1] < 0 || $matches[1] > 255 ||
+ $matches[2] < 0 || $matches[2] > 255 ||
+ $matches[3] < 0 || $matches[3] > 255 ||
+ $matches[4] < 0 || $matches[4] > 255) {
+ $submitErr |= MNPUBLICGATEWAYERR;
+ $submitErrMsg[MNPUBLICGATEWAYERR] = "Invalid ip address entered";
+ }
+ }
+ else {
+ $submitErr |= MNPUBLICGATEWAYERR;
+ $submitErrMsg[MNPUBLICGATEWAYERR] = "Invalid ip address entered";
+ }
+ }
+ elseif(! preg_match('/^[a-zA-Z0-9_][-a-zA-Z0-9_\.]{1,56}$/', $return["publicgateway"], $matches)) {
+ $submitErr |= MNPUBLICGATEWAYERR;
+ $submitErrMsg[MNPUBLICGATEWAYERR] = "Public gateway must be an IP address or a hostname containing only letters, numbers, dashes(-), periods(.), and underscores(_). It can be up to 56 characters long";
+ }
+ $servers = explode(',', $return['publicdnsserver']);
+ if(empty($servers)) {
+ $submitErr |= MNPUBLICDNSSERVERERR;
+ $submitErrMsg[MNPUBLICDNSSERVERERR] = "Please enter at least one dns server";
+ }
+ else {
+ foreach($servers as $server) {
+ if(! preg_match('/^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})+$/', $server, $matches) ||
+ $matches[1] < 0 || $matches[1] > 255 ||
+ $matches[2] < 0 || $matches[2] > 255 ||
+ $matches[3] < 0 || $matches[3] > 255 ||
+ $matches[4] < 0 || $matches[4] > 255) {
+ $submitErr |= MNPUBLICDNSSERVERERR;
+ $submitErrMsg[MNPUBLICDNSSERVERERR] = "Invalid ip address entered";
+ }
+ }
+ }
+ }
+ else {
+ $return['publicnetmask'] = '';
+ $return['publicgateway'] = '';
+ $return['publicdnsserver'] = '';
+ }
+ if(strlen($return['sysadminemail']) &&
+ (! preg_match('/^([A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}(,?))+$/i', $return['sysadminemail']) ||
+ strlen($return['sysadminemail']) > 128)) {
+ $submitErr |= MNSYSADMINEMAILERR;
+ $submitErrMsg[MNSYSADMINEMAILERR] = "Invalid email address(es) entered or field too long (128 char max)";
+ }
+ if(strlen($return['sharedmailbox']) &&
+ (! preg_match('/^([A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4})$/i', $return['sharedmailbox']) ||
+ strlen($return['sharedmailbox']) > 128)) {
+ $submitErr |= MNSHAREDMAILBOXERR;
+ $submitErrMsg[MNSHAREDMAILBOXERR] = "Invalid email address entered";
+ }
+
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=987596&r1=987595&r2=987596&view=diff
==============================================================================
--- incubator/vcl/trunk/web/.ht-inc/utils.php (original)
+++ incubator/vcl/trunk/web/.ht-inc/utils.php Fri Aug 20 18:16:35 2010
@@ -5103,6 +5103,12 @@ function getManagementNodes($alive="neit
. "m.imagelibkey, "
. "m.keys, "
. "m.sshport, "
+ . "m.publicIPconfiguration AS publicIPconfig, "
+ . "m.publicSubnetMask AS publicnetmask, "
+ . "m.publicDefaultGateway AS publicgateway, "
+ . "m.publicDNSserver AS publicdnsserver, "
+ . "m.sysadminEmailAddress AS sysadminemail, "
+ . "m.sharedMailBox AS sharedmailbox, "
. "r.id as resourceid, "
. "m.predictivemoduleid, "
. "mo.prettyname AS predictivemodule "
@@ -7608,7 +7614,7 @@ function generateString($length=8) {
///
/// \return an array of profiles where each key is the profile id and each
/// element is an array with these keys:\n
-/// \b name - name of profile\n
+/// \b profilename - name of profile\n
/// \b type - name of vm type\n
/// \b typeid - id of vm type\n
/// \b image - name of image used for this profile\n
@@ -7628,7 +7634,7 @@ function generateString($length=8) {
////////////////////////////////////////////////////////////////////////////////
function getVMProfiles($id="") {
$query = "SELECT vp.id, "
- . "vp.profilename AS name, "
+ . "vp.profilename, "
. "vt.name AS type, "
. "vp.vmtypeid, "
. "i.prettyname AS image, "
@@ -7640,7 +7646,9 @@ function getVMProfiles($id="") {
. "vp.virtualswitch1, "
. "vp.vmdisk, "
. "vp.username, "
- . "vp.password "
+ . "vp.password, "
+ . "vp.vmware_mac_eth0_generated, "
+ . "vp.vmware_mac_eth1_generated "
. "FROM vmprofile vp "
. "LEFT JOIN vmtype vt ON (vp.vmtypeid = vt.id) "
. "LEFT JOIN image i ON (vp.imageid = i.id)";
@@ -8788,8 +8796,9 @@ function getDojoHTML($refresh) {
case 'addMgmtNode':
case 'confirmEditMgmtnode':
case 'confirmAddMgmtnode':
- $dojoRequires = array('dojo.parser');
- $dojoRequires = array('dijit.form.NumberSpinner');
+ $dojoRequires = array('dojo.parser',
+ 'dijit.Tooltip',
+ 'dijit.form.NumberSpinner');
break;
case 'selectauth':
$dojoRequires = array('dojo.parser');
@@ -8801,6 +8810,7 @@ function getDojoHTML($refresh) {
'dijit.form.Button',
'dijit.form.TextBox',
'dijit.form.FilteringSelect',
+ 'dijit.form.Select',
'dijit.TitlePane',
'dijit.layout.ContentPane',
'dijit.layout.TabContainer',
Modified: incubator/vcl/trunk/web/.ht-inc/vm.php
URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/web/.ht-inc/vm.php?rev=987596&r1=987595&r2=987596&view=diff
==============================================================================
--- incubator/vcl/trunk/web/.ht-inc/vm.php (original)
+++ incubator/vcl/trunk/web/.ht-inc/vm.php Fri Aug 20 18:16:35 2010
@@ -169,7 +169,10 @@ function editVMInfo() {
return;
print "<div id=\"vmprofiles\" dojoType=\"dijit.layout.ContentPane\" title=\"VM Host Profiles\">\n";
print "<br>Select a profile to configure:<br>\n";
- printSelectInput("profileid", $profiles, -1, 0, 0, 'profileid');
+ print "<select name=\"profileid\" id=\"profileid\">\n";
+ foreach($profiles as $id => $item)
+ print " <option value=\"$id\">{$item['profilename']}</option>\n";
+ print "</select>\n";
$cont = addContinuationsEntry('AJprofiledata');
print "<button dojoType=\"dijit.form.Button\" id=\"fetchProfilesBtn\">\n";
print " Configure Profile\n";
@@ -200,7 +203,7 @@ function editVMInfo() {
print "<table summary=\"\">\n";
print " <tr>\n";
print " <th align=right>Name:</th>\n";
- print " <td><span id=pname dojoType=\"dijit.InlineEditBox\" onChange=\"updateProfile('pname', 'name');\"></span></td>\n";
+ print " <td><span id=pname dojoType=\"dijit.InlineEditBox\" onChange=\"updateProfile('pname', 'profilename');\"></span></td>\n";
print " </tr>\n";
print " <tr>\n";
print " <th align=right>Type:</th>\n";
@@ -232,7 +235,21 @@ function editVMInfo() {
print " </tr>\n";
print " <tr>\n";
print " <th align=right>VM Disk:</th>\n";
- print " <td><select id=pvmdisk dojoType=\"dijit.form.FilteringSelect\" searchAttr=\"name\" onchange=\"updateProfile('pvmdisk', 'vmdisk');\"></span></td>\n";
+ print " <td><select id=pvmdisk dojoType=\"dijit.form.FilteringSelect\" searchAttr=\"name\" onchange=\"updateProfile('pvmdisk', 'vmdisk');\"></select></td>\n";
+ print " </tr>\n";
+ print " <tr>\n";
+ print " <th align=right>Generate eth0 MAC:</th>\n";
+ print " <td><select id=pgenmac0 dojoType=\"dijit.form.Select\" searchAttr=\"name\" onchange=\"updateProfile('pgenmac0', 'vmware_mac_eth0_generated');\">\n";
+ print " <option value=\"1\">Yes</option>\n";
+ print " <option value=\"0\">No</option>\n";
+ print " </select></td>\n";
+ print " </tr>\n";
+ print " <tr>\n";
+ print " <th align=right>Generate eth1 MAC:</th>\n";
+ print " <td><select id=pgenmac1 dojoType=\"dijit.form.Select\" searchAttr=\"name\" onchange=\"updateProfile('pgenmac1', 'vmware_mac_eth1_generated');\">\n";
+ print " <option value=\"1\">Yes</option>\n";
+ print " <option value=\"0\">No</option>\n";
+ print " </select></td>\n";
print " </tr>\n";
print " <tr>\n";
print " <th align=right>Username:</th>\n";
@@ -283,9 +300,7 @@ function vmhostdata() {
$resources = getUserResources(array("computerAdmin"), array("administer"));
if(! array_key_exists($data[$vmhostid]['computerid'], $resources['computer'])) {
- $arr = array('failed' => 'noaccess');
- header('Content-Type: text/json-comment-filtered; charset=utf-8');
- print '/*{"items":' . json_encode($arr) . '}*/';
+ sendJSON(array('failed' => 'noaccess'));
return;
}
@@ -365,8 +380,7 @@ function vmhostdata() {
'currvms' => $currvms,
'freevms' => $freevms,
'movevms' => $movevms);
- header('Content-Type: text/json-comment-filtered; charset=utf-8');
- print '/*{"items":' . json_encode($arr) . '}*/';
+ sendJSON($arr);
}
////////////////////////////////////////////////////////////////////////////////
@@ -460,9 +474,7 @@ function AJvmToHost() {
$hostdata = getVMHostData($hostid);
$resources = getUserResources(array("computerAdmin"), array("administer"));
if(! array_key_exists($hostdata[$hostid]['computerid'], $resources['computer'])) {
- $arr = array('failed' => 'nohostaccess');
- header('Content-Type: text/json-comment-filtered; charset=utf-8');
- print '/*{"items":' . json_encode($arr) . '}*/';
+ sendJSON(array('failed' => 'nohostaccess'));
return;
}
@@ -473,9 +485,7 @@ function AJvmToHost() {
$qh = doQuery($query, 101);
$row = mysql_fetch_row($qh);
if($row[0] >= $hostdata[$hostid]['vmlimit']) {
- $arr = array('failed' => 'vmlimit');
- header('Content-Type: text/json-comment-filtered; charset=utf-8');
- print '/*{"items":' . json_encode($arr) . '}*/';
+ sendJSON(array('failed' => 'vmlimit'));
return;
}
@@ -520,9 +530,8 @@ function AJvmToHost() {
else
$fails[] = array('id' => $compid, 'name' => $vmdata[$compid]['hostname'], 'reason' => 'otherhost');
}
- header('Content-Type: text/json-comment-filtered; charset=utf-8');
$arr = array('vms' => $adds, 'fails' => $fails, 'addrem' => 1);
- print '/*{"items":' . json_encode($arr) . '}*/';
+ sendJSON($arr);
}
////////////////////////////////////////////////////////////////////////////////
@@ -545,9 +554,7 @@ function AJvmFromHost() {
$hostdata = getVMHostData($hostid);
$resources = getUserResources(array("computerAdmin"), array("administer"));
if(! array_key_exists($hostdata[$hostid]['computerid'], $resources['computer'])) {
- $arr = array('failed' => 'nohostaccess');
- header('Content-Type: text/json-comment-filtered; charset=utf-8');
- print '/*{"items":' . json_encode($arr) . '}*/';
+ sendJSON(array('failed' => 'nohostaccess'));
return;
}
@@ -616,13 +623,12 @@ function AJvmFromHost() {
$cont = addContinuationsEntry('AJvmFromHostDelayed', $checks, 120, 1, 0);
else
$cont = '';
- header('Content-Type: text/json-comment-filtered; charset=utf-8');
$arr = array('vms' => $rems,
'checks' => $checks,
'fails' => $fails,
'addrem' => 0,
'cont' => $cont);
- print '/*{"items":' . json_encode($arr) . '}*/';
+ sendJSON($arr);
}
////////////////////////////////////////////////////////////////////////////////
@@ -644,10 +650,9 @@ function AJvmFromHostDelayed() {
$fails[] = array('name' => $comp['hostname'],
'reason' => 'nomgtnode');
}
- header('Content-Type: text/json-comment-filtered; charset=utf-8');
$cont = addContinuationsEntry('vmhostdata');
$arr = array('msg' => 'SUCCESS', 'cont' => $cont, 'fails' => $fails);
- print '/*{"items":' . json_encode($arr) . '}*/';
+ sendJSON($arr);
}
////////////////////////////////////////////////////////////////////////////////
@@ -666,10 +671,9 @@ function AJchangeVMprofile() {
// if no reservations on any vms, create reload reservation
# else try to create reservation to handle in future
# else return error message
- header('Content-Type: text/json-comment-filtered; charset=utf-8');
$cont = addContinuationsEntry('AJchangeVMprofile', array(), 3600, 1, 0);
$arr = array('msg' => 'function not implemented', 'continuation' => $cont);
- print '/*{"items":' . json_encode($arr) . '}*/';
+ sendJSON($arr);
}
////////////////////////////////////////////////////////////////////////////////
@@ -686,9 +690,7 @@ function AJcancelVMmove() {
$hostdata = getVMHostData($hostid);
$resources = getUserResources(array("computerAdmin"), array("administer"));
if(! array_key_exists($hostdata[$hostid]['computerid'], $resources['computer'])) {
- $arr = array('failed' => 'nohostaccess');
- header('Content-Type: text/json-comment-filtered; charset=utf-8');
- print '/*{"items":' . json_encode($arr) . '}*/';
+ sendJSON(array('failed' => 'nohostaccess'));
return;
}
@@ -721,15 +723,14 @@ function AJcancelVMmove() {
$msg = 'SUCCESS';
}
- header('Content-Type: text/json-comment-filtered; charset=utf-8');
$cont = addContinuationsEntry('vmhostdata');
$arr = array('msg' => $msg, 'cont' => $cont, 'fails' => $fails);
- print '/*{"items":' . json_encode($arr) . '}*/';
+ sendJSON($arr);
}
////////////////////////////////////////////////////////////////////////////////
///
-/// \fn AJprofiledata()
+/// \fn AJprofileData()
///
/// \param $profileid - (optional) id of a vm profile
///
@@ -744,9 +745,7 @@ function AJcancelVMmove() {
function AJprofileData($profileid="") {
global $viewmode;
if($viewmode != ADMIN_DEVELOPER) {
- $arr = array('failed' => 'noaccess');
- header('Content-Type: text/json-comment-filtered; charset=utf-8');
- print '/*{"items":' . json_encode($arr) . '}*/';
+ sendJSON(array('failed' => 'noaccess'));
return;
}
$profileid = processInputVar('profileid', ARG_NUMERIC, $profileid);
@@ -772,13 +771,12 @@ function AJprofileData($profileid="") {
$vmdiskitems[] = array('id' => 'localdisk', 'name' => 'localdisk');
$vmdiskitems[] = array('id' => 'networkdisk', 'name' => 'networkdisk');
$vmdisk = array('identifier' => 'id', 'items' => $vmdiskitems);
-
- header('Content-Type: text/json-comment-filtered; charset=utf-8');
+
$arr = array('profile' => $profiledata[$profileid],
'types' => $typedata,
'vmdisk' => $vmdisk,
'images' => $imagedata);
- print '/*{"items":' . json_encode($arr) . '}*/';
+ sendJSON($arr);
}
////////////////////////////////////////////////////////////////////////////////
@@ -797,7 +795,16 @@ function AJupdateVMprofileItem() {
}
$profileid = processInputVar('profileid', ARG_NUMERIC);
$item = processInputVar('item', ARG_STRING);
- if($item == 'password')
+ if(! preg_match('/^(profilename|vmtypeid|imageid|nasshare|datastorepath|vmpath|virtualswitch0|virtualswitch1|vmdisk|username|password|vmware_mac_eth0_generated|vmware_mac_eth1_generated)$/', $item)) {
+ print "alert('Invalid data submitted.');";
+ return;
+ }
+ if(preg_match('/^vmware_mac_eth[01]_generated$/', $item)) {
+ $newvalue = processInputVar('newvalue', ARG_NUMERIC);
+ if($newvalue != 0 && $newvalue != 1)
+ $newvalue = 0;
+ }
+ elseif($item == 'password')
$newvalue = $_POST['newvalue'];
else
$newvalue = processInputVar('newvalue', ARG_STRING);
@@ -810,6 +817,7 @@ function AJupdateVMprofileItem() {
$newvalue2 = "'$newvalue2'";
}
+ $item = mysql_real_escape_string($item);
$profile = getVMProfiles($profileid);
if($profile[$profileid][$item] == $newvalue)
return;
@@ -843,9 +851,7 @@ function AJnewProfile() {
$query = "SELECT id FROM vmprofile WHERE profilename = '$newprofile'";
$qh = doQuery($query, 101);
if($row = mysql_fetch_assoc($qh)) {
- header('Content-Type: text/json-comment-filtered; charset=utf-8');
- $arr = array('failed' => 'exists');
- print '/*{"items":' . json_encode($arr) . '}*/';
+ sendJSON(array('failed' => 'exists'));
return;
}
$query = "INSERT INTO vmprofile (profilename) VALUES ('$newprofile')";
@@ -866,9 +872,7 @@ function AJnewProfile() {
function AJdelProfile() {
global $viewmode;
if($viewmode != ADMIN_DEVELOPER) {
- $arr = array('failed' => 'noaccess');
- header('Content-Type: text/json-comment-filtered; charset=utf-8');
- print '/*{"items":' . json_encode($arr) . '}*/';
+ sendJSON(array('failed' => 'noaccess'));
return;
}
$profileid = processInputVar('profileid', ARG_NUMERIC);
@@ -884,16 +888,12 @@ function AJdelProfile() {
. "vh.vmprofileid = $profileid";
$qh = doQuery($query, 101);
if($row = mysql_fetch_assoc($qh)) {
- $arr = array('failed' => 'inuse');
- header('Content-Type: text/json-comment-filtered; charset=utf-8');
- print '/*{"items":' . json_encode($arr) . '}*/';
+ sendJSON(array('failed' => 'inuse'));
return;
}
$query = "DELETE FROM vmprofile WHERE id = $profileid";
doQuery($query, 101);
- header('Content-Type: text/json-comment-filtered; charset=utf-8');
- $arr = array('SUCCESS');
- print '/*{"items":' . json_encode($arr) . '}*/';
+ sendJSON(array('SUCCESS'));
}
?>
Modified: incubator/vcl/trunk/web/js/managementnodes.js
URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/web/js/managementnodes.js?rev=987596&r1=987595&r2=987596&view=diff
==============================================================================
--- incubator/vcl/trunk/web/js/managementnodes.js (original)
+++ incubator/vcl/trunk/web/js/managementnodes.js Fri Aug 20 18:16:35 2010
@@ -14,42 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-var xhrobj;
-var blockHide = 0;
-var timeout = 0;
-
-function showHelp(msg, id) {
- if(timeout)
- clearTimeout(timeout);
- var obj = document.getElementById(id);
- var x = findPosX(obj);
- var y = findPosY(obj) - 10;
- obj = document.getElementById('helpbox');
- obj.innerHTML = msg;
- obj.style.left = x + "px";
- obj.style.top = y + "px";
- obj.style.zIndex = 10;
-}
-
-function clearHelpbox() {
- if(timeout)
- clearTimeout(timeout);
- timeout = setTimeout(function() {clearHelpbox2(1);}, 50);
-}
-
-function clearHelpbox2(fromicon) {
- if(fromicon && blockHide)
- return;
- blockHide = 0;
- var obj = document.getElementById('helpbox');
- obj.innerHTML = '';
- obj.style.zIndex = -10;
-}
-
-function blockClear() {
- blockHide = 1;
-}
-
function toggleImageLibrary() {
var obj = document.getElementById('imagelibenable');
if(obj.checked) {
@@ -69,3 +33,16 @@ function toggleImageLibrary() {
document.getElementById('imagelibkey').disabled = true;
}
}
+
+function togglePublic() {
+ if(dojo.byId('publicIPconfig').value == 'static') {
+ dojo.byId('publicnetmask').disabled = false;
+ dojo.byId('publicgateway').disabled = false;
+ dojo.byId('publicdnsserver').disabled = false;
+ }
+ else {
+ dojo.byId('publicnetmask').disabled = true;
+ dojo.byId('publicgateway').disabled = true;
+ dojo.byId('publicdnsserver').disabled = true;
+ }
+}
Modified: incubator/vcl/trunk/web/js/vm.js
URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/web/js/vm.js?rev=987596&r1=987595&r2=987596&view=diff
==============================================================================
--- incubator/vcl/trunk/web/js/vm.js (original)
+++ incubator/vcl/trunk/web/js/vm.js Fri Aug 20 18:16:35 2010
@@ -44,7 +44,7 @@ function getVMHostData(cont) {
dojo.xhrPost({
url: 'index.php',
load: VMHostDataCB,
- handleAs: "json-comment-filtered",
+ handleAs: "json",
error: errorHandler,
content: {continuation: cont,
vmhostid: hostid},
@@ -73,7 +73,7 @@ function VMHostDataCB(data, ioArgs) {
}*/
var profile = data.items.profile;
var obj = dijit.byId('vmprofile');
- obj.setTitle(profile.name);
+ obj.setTitle(profile.profilename);
var ct = '<table>';
ct += '<tr><th align=right>VM type:</th><td>' + profile.type + '</td></tr>';
ct += '<tr><th align=right>Image:</th><td>' + profile.image + '</td></tr>';
@@ -187,7 +187,7 @@ function submitChangeProfile() {
dojo.xhrPost({
url: 'index.php',
load: submitChangeProfileCB,
- handleAs: "json-comment-filtered",
+ handleAs: "json",
error: errorHandler,
content: {continuation: cont,
vmhostid: hostid,
@@ -232,7 +232,7 @@ function vmToHost(cont) {
dojo.xhrPost({
url: 'index.php',
load: vmToHostCB,
- handleAs: "json-comment-filtered",
+ handleAs: "json",
error: errorHandler,
content: {continuation: cont,
listids: listids.join(','),
@@ -360,7 +360,7 @@ function vmFromHost(cont) {
dojo.xhrPost({
url: 'index.php',
load: vmFromHostCB,
- handleAs: "json-comment-filtered",
+ handleAs: "json",
error: errorHandler,
content: {continuation: cont,
listids: listids.join(','),
@@ -465,7 +465,7 @@ function vmFromHostDelayed(cont) {
dojo.xhrPost({
url: 'index.php',
load: reloadVMhostCB,
- handleAs: "json-comment-filtered",
+ handleAs: "json",
error: errorHandler,
content: {continuation: cont},
timeout: 15000
@@ -525,7 +525,7 @@ function cancelVMmove(cont) {
dojo.xhrPost({
url: 'index.php',
load: reloadVMhostCB,
- handleAs: "json-comment-filtered",
+ handleAs: "json",
error: errorHandler,
content: {continuation: cont,
listids: listids.join(','),
@@ -542,7 +542,7 @@ function getVMprofileData(cont) {
dojo.xhrPost({
url: 'index.php',
load: getVMprofileDataCB,
- handleAs: "json-comment-filtered",
+ handleAs: "json",
error: errorHandler,
content: {continuation: cont,
profileid: profileid},
@@ -560,17 +560,20 @@ function getVMprofileDataCB(data, ioArgs
var obj = dijit.byId('ptype');
var store = new dojo.data.ItemFileReadStore({data: data.items.types});
obj.store = store;
- obj.setValue(curprofile.vmtypeid);
+ if(curprofile.vmtypeid != 0)
+ obj.setValue(curprofile.vmtypeid);
var obj = dijit.byId('pimage');
var store = new dojo.data.ItemFileReadStore({data: data.items.images});
obj.store = store;
- obj.setValue(curprofile.imageid);
+ if(curprofile.imageid != 0)
+ obj.setValue(curprofile.imageid);
var obj = dijit.byId('pvmdisk');
var store = new dojo.data.ItemFileReadStore({data: data.items.vmdisk});
obj.store = store;
- obj.setValue(curprofile.vmdisk);
+ if(curprofile.vmdisk != 0)
+ obj.setValue(curprofile.vmdisk);
dijit.byId('pname').noValueIndicator = '(empty)';
dijit.byId('pnasshare').noValueIndicator = '(empty)';
@@ -580,13 +583,15 @@ function getVMprofileDataCB(data, ioArgs
dijit.byId('pvs1').noValueIndicator = '(empty)';
dijit.byId('pusername').noValueIndicator = '(empty)';
- dijit.byId('pname').setValue(curprofile.name);
+ dijit.byId('pname').setValue(curprofile.profilename);
dijit.byId('pnasshare').setValue(curprofile.nasshare);
dijit.byId('pdspath').setValue(curprofile.datastorepath);
dijit.byId('pvmpath').setValue(curprofile.vmpath);
dijit.byId('pvs0').setValue(curprofile.virtualswitch0);
dijit.byId('pvs1').setValue(curprofile.virtualswitch1);
dijit.byId('pusername').setValue(curprofile.username);
+ dijit.byId('pgenmac0').setValue(curprofile.vmware_mac_eth0_generated);
+ dijit.byId('pgenmac1').setValue(curprofile.vmware_mac_eth1_generated);
document.getElementById('ppassword').value = curprofile.password;
document.getElementById('ppwdconfirm').value = curprofile.password;
checkProfilePassword();
@@ -611,7 +616,7 @@ function newProfile(cont) {
dojo.xhrPost({
url: 'index.php',
load: newProfileCB,
- handleAs: "json-comment-filtered",
+ handleAs: "json",
error: errorHandler,
content: {continuation: cont,
newname: newname},
@@ -630,7 +635,7 @@ function newProfileCB(data, ioArgs) {
dijit.byId('messages').hide();
alert('Be sure to finish configuring this profile');
var obj = document.getElementById('profileid');
- obj.options[obj.options.length] = new Option(data.items.profile.name, data.items.profile.id);
+ obj.options[obj.options.length] = new Option(data.items.profile.profilename, data.items.profile.id);
obj.options[obj.options.length - 1].selected = true;
// TODO insert new entry in correct order
getVMprofileDataCB(data, ioArgs);
@@ -643,7 +648,7 @@ function delProfile(cont) {
content += "<table summary=\"\">";
content += "<tr>";
content += "<th align=right>Name:</th>";
- content += "<td>" + curprofile.name + "</td>";
+ content += "<td>" + curprofile.profilename + "</td>";
content += "</tr>";
content += "<tr>";
content += "<th align=right>Type:</th>";
@@ -677,6 +682,20 @@ function delProfile(cont) {
content += "<th align=right>VM Disk:</th>";
content += "<td>" + curprofile.vmdisk + "</td>";
content += "</tr>";
+ content += "<tr>";
+ content += "<th align=right>Generate eth0 MAC:</th>";
+ if(curprofile.vmware_mac_eth0_generated == 0)
+ content += "<td>No</td>";
+ else
+ content += "<td>Yes</td>";
+ content += "</tr>";
+ content += "<tr>";
+ content += "<th align=right>Generate eth1 MAC:</th>";
+ if(curprofile.vmware_mac_eth1_generated == 0)
+ content += "<td>No</td>";
+ else
+ content += "<td>Yes</td>";
+ content += "</tr>";
content += "</table>";
var func = function() {
var profileid = document.getElementById('profileid').value;
@@ -686,7 +705,7 @@ function delProfile(cont) {
dojo.xhrPost({
url: 'index.php',
load: delProfileCB,
- handleAs: "json-comment-filtered",
+ handleAs: "json",
error: errorHandler,
content: {continuation: cont,
profileid: profileid},