From acc8bcb76bb94241191fe13e4e4201df0ead6b4f Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 29 Nov 2016 13:31:22 -0500 Subject: [PATCH 1/9] Have snmpmon set the community string Some BMCs do not default to 'public' for alerts. Change this to do public for now, since other parts of the code are still hard baked. --- xCAT-server/lib/xcat/monitoring/snmpmon.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/monitoring/snmpmon.pm b/xCAT-server/lib/xcat/monitoring/snmpmon.pm index 1a7cf4d4d..c0bbb6c1e 100644 --- a/xCAT-server/lib/xcat/monitoring/snmpmon.pm +++ b/xCAT-server/lib/xcat/monitoring/snmpmon.pm @@ -514,8 +514,8 @@ sub configBMC { $ret_text .= "Changeing SNMP PEF policy for IPMI nodes $noderange:\n $result\n"; } } elsif ($action == 1) { - print "XCATBYPASS=Y rspconfig $noderange alert=en\n"; - my $result = `XCATBYPASS=Y rspconfig $noderange alert=en 2>&1`; + print "XCATBYPASS=Y rspconfig $noderange alert=en community=public\n"; + my $result = `XCATBYPASS=Y rspconfig $noderange alert=en community=public 2>&1`; if ($?) { $ret_val = 1; xCAT::MsgUtils->message('S', "[mon]: Changeing SNMP PEF policy for IPMI nodes $noderange:\n $result\n"); From 9e432dd6a8c75019be745545b694fd662794c79f Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 29 Nov 2016 13:37:32 -0500 Subject: [PATCH 2/9] Revert "Undefine the release number so that the spec files will continue" This reverts commit 505a1c0556f684b204c0d5cbf955648d1df14209. --- makerpm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/makerpm b/makerpm index 912ddf3db..471943f1c 100755 --- a/makerpm +++ b/makerpm @@ -55,7 +55,7 @@ function makenoarch { tar --exclude .svn -czf $RPMROOT/SOURCES/$RPMNAME-$VER.tar.gz $RPMNAME rm -f $RPMROOT/SRPMS/$RPMNAME-$VER*rpm $RPMROOT/RPMS/noarch/$RPMNAME-$VER*rpm - rpmbuild $QUIET -ta $RPMROOT/SOURCES/$RPMNAME-$VER.tar.gz --define "version $VER" + rpmbuild $QUIET -ta $RPMROOT/SOURCES/$RPMNAME-$VER.tar.gz --define "version $VER" $REL "$EASE" RC=$? if [ $RPMNAME = "xCAT-UI" ]; then @@ -137,7 +137,7 @@ function makexcat { rm -f $RPMROOT/SRPMS/$RPMNAME-$VER*rpm $RPMROOT/RPMS/$ARCH/$RPMNAME-$VER*rpm echo "Building $RPMROOT/RPMS/$ARCH/$RPMNAME-$VER-snap*.$ARCH.rpm $EMBEDTXT..." - rpmbuild $QUIET -ba $RPMNAME/$RPMNAME.spec $TARGET --define "version $VER" + rpmbuild $QUIET -ba $RPMNAME/$RPMNAME.spec $TARGET --define "version $VER" $REL "$EASE" RC=$? fi } @@ -170,7 +170,7 @@ function makegenesis { cd - >/dev/null rm -f $RPMROOT/SRPMS/$RPMNAME-$VER*rpm $RPMROOT/RPMS/noarch/$RPMNAME-$VER*rpm echo "Building $RPMROOT/RPMS/noarch/$RPMNAME-$VER-snap*.noarch.rpm $EMBEDTXT..." - rpmbuild $QUIET -ba $DIR/$RPMNAME.spec --define "version $VER" + rpmbuild $QUIET -ba $DIR/$RPMNAME.spec --define "version $VER" $REL "$EASE" } function makegenesisscripts { @@ -190,7 +190,7 @@ function makegenesisscripts { cd - >/dev/null rm -f $RPMROOT/SRPMS/$RPMNAME-$ARCH-$VER*rpm $RPMROOT/RPMS/noarch/$RPMNAME-$ARCH-$VER*rpm echo "Building $RPMROOT/RPMS/noarch/$RPMNAME-$ARCH-$VER-snap*.noarch.rpm $EMBEDTXT..." - rpmbuild $QUIET -ba $DIR/$RPMNAME.spec $TARGET --define "version $VER" + rpmbuild $QUIET -ba $DIR/$RPMNAME.spec $TARGET --define "version $VER" $REL "$EASE" } From 4cae23ccf1372c828a0b41450a34b8057d767608 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 29 Nov 2016 13:39:34 -0500 Subject: [PATCH 3/9] Revert "Revert "Undefine the release number so that the spec files will continue"" This reverts commit 9e432dd6a8c75019be745545b694fd662794c79f. --- makerpm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/makerpm b/makerpm index 471943f1c..912ddf3db 100755 --- a/makerpm +++ b/makerpm @@ -55,7 +55,7 @@ function makenoarch { tar --exclude .svn -czf $RPMROOT/SOURCES/$RPMNAME-$VER.tar.gz $RPMNAME rm -f $RPMROOT/SRPMS/$RPMNAME-$VER*rpm $RPMROOT/RPMS/noarch/$RPMNAME-$VER*rpm - rpmbuild $QUIET -ta $RPMROOT/SOURCES/$RPMNAME-$VER.tar.gz --define "version $VER" $REL "$EASE" + rpmbuild $QUIET -ta $RPMROOT/SOURCES/$RPMNAME-$VER.tar.gz --define "version $VER" RC=$? if [ $RPMNAME = "xCAT-UI" ]; then @@ -137,7 +137,7 @@ function makexcat { rm -f $RPMROOT/SRPMS/$RPMNAME-$VER*rpm $RPMROOT/RPMS/$ARCH/$RPMNAME-$VER*rpm echo "Building $RPMROOT/RPMS/$ARCH/$RPMNAME-$VER-snap*.$ARCH.rpm $EMBEDTXT..." - rpmbuild $QUIET -ba $RPMNAME/$RPMNAME.spec $TARGET --define "version $VER" $REL "$EASE" + rpmbuild $QUIET -ba $RPMNAME/$RPMNAME.spec $TARGET --define "version $VER" RC=$? fi } @@ -170,7 +170,7 @@ function makegenesis { cd - >/dev/null rm -f $RPMROOT/SRPMS/$RPMNAME-$VER*rpm $RPMROOT/RPMS/noarch/$RPMNAME-$VER*rpm echo "Building $RPMROOT/RPMS/noarch/$RPMNAME-$VER-snap*.noarch.rpm $EMBEDTXT..." - rpmbuild $QUIET -ba $DIR/$RPMNAME.spec --define "version $VER" $REL "$EASE" + rpmbuild $QUIET -ba $DIR/$RPMNAME.spec --define "version $VER" } function makegenesisscripts { @@ -190,7 +190,7 @@ function makegenesisscripts { cd - >/dev/null rm -f $RPMROOT/SRPMS/$RPMNAME-$ARCH-$VER*rpm $RPMROOT/RPMS/noarch/$RPMNAME-$ARCH-$VER*rpm echo "Building $RPMROOT/RPMS/noarch/$RPMNAME-$ARCH-$VER-snap*.noarch.rpm $EMBEDTXT..." - rpmbuild $QUIET -ba $DIR/$RPMNAME.spec $TARGET --define "version $VER" $REL "$EASE" + rpmbuild $QUIET -ba $DIR/$RPMNAME.spec $TARGET --define "version $VER" } From 009291262908027d016a12c1125c7195bedaa017 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 29 Nov 2016 13:39:50 -0500 Subject: [PATCH 4/9] Revert "Have snmpmon set the community string" This reverts commit acc8bcb76bb94241191fe13e4e4201df0ead6b4f. --- xCAT-server/lib/xcat/monitoring/snmpmon.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/monitoring/snmpmon.pm b/xCAT-server/lib/xcat/monitoring/snmpmon.pm index c0bbb6c1e..1a7cf4d4d 100644 --- a/xCAT-server/lib/xcat/monitoring/snmpmon.pm +++ b/xCAT-server/lib/xcat/monitoring/snmpmon.pm @@ -514,8 +514,8 @@ sub configBMC { $ret_text .= "Changeing SNMP PEF policy for IPMI nodes $noderange:\n $result\n"; } } elsif ($action == 1) { - print "XCATBYPASS=Y rspconfig $noderange alert=en community=public\n"; - my $result = `XCATBYPASS=Y rspconfig $noderange alert=en community=public 2>&1`; + print "XCATBYPASS=Y rspconfig $noderange alert=en\n"; + my $result = `XCATBYPASS=Y rspconfig $noderange alert=en 2>&1`; if ($?) { $ret_val = 1; xCAT::MsgUtils->message('S', "[mon]: Changeing SNMP PEF policy for IPMI nodes $noderange:\n $result\n"); From 2c36531a44dd59de99c88a75a2b4b825de940a43 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Thu, 8 Dec 2016 14:14:13 -0500 Subject: [PATCH 5/9] change the URL for go-xcat to github --- docs/source/guides/install-guides/common_sections.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/guides/install-guides/common_sections.rst b/docs/source/guides/install-guides/common_sections.rst index d4fdad136..e9f7cc87e 100644 --- a/docs/source/guides/install-guides/common_sections.rst +++ b/docs/source/guides/install-guides/common_sections.rst @@ -64,7 +64,7 @@ The following sections describe the different methods for installing xCAT. #. Download the ``go-xcat`` tool using ``wget``: :: - wget http://xcat.org/files/go-xcat -O - >/tmp/go-xcat + wget https://raw.githubusercontent.com/xcat2/xcat-core/master/xCAT-server/share/xcat/tools/go-xcat -O - >/tmp/go-xcat chmod +x /tmp/go-xcat #. Run the ``go-xcat`` tool: :: From 15926176cc51d22db9c1565b6441d6bde6981451 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Fri, 23 Dec 2016 03:26:48 -0500 Subject: [PATCH 6/9] remove setupntp for sles12.1 ntpd doesn't synchronize to local clock anymore in version 4.2.8p4. see#2248 --- .../testcase/installation/Full_installation_flat_p8_le | 3 ++- .../testcase/installation/reg_linux_diskfull_installation_flat | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/xCAT-test/autotest/testcase/installation/Full_installation_flat_p8_le b/xCAT-test/autotest/testcase/installation/Full_installation_flat_p8_le index a058f5560..447f4a4fa 100644 --- a/xCAT-test/autotest/testcase/installation/Full_installation_flat_p8_le +++ b/xCAT-test/autotest/testcase/installation/Full_installation_flat_p8_le @@ -25,7 +25,8 @@ cmd:makeconservercf $$CN check:rc==0 cmd:cat /etc/conserver.cf | grep $$CN check:output=~$$CN -cmd:chdef -t node -o $$CN postscripts=setupntp +cmd:if [ "__GETNODEATTR($$CN,os)__" != "sles12.1" ];then chdef -t node -o $$CN postscripts=setupntp; fi +cmd:lsdef -l $$CN check:rc==0 cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute check:rc==0 diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat index b9c7d65bf..dfbab0873 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat @@ -33,7 +33,8 @@ check:rc==0 check:output=~$$CN cmd:copycds $$ISO check:rc==0 -cmd:chdef -t node -o $$CN postscripts=setupntp +cmd:if [ "__GETNODEATTR($$CN,os)__" != "sles12.1" ];then chdef -t node -o $$CN postscripts=setupntp; fi +cmd:lsdef -l $$CN check:rc==0 cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute check:rc==0 From 90f6ea83a52f1b15d501c30dd62ea080e6c14b9e Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Tue, 3 Jan 2017 22:27:16 -0500 Subject: [PATCH 7/9] complete --- xCAT-test/autotest/testcase/migration/redhat_migration | 10 ++++------ xCAT-test/autotest/testcase/migration/sles_migration | 10 ++++------ 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/xCAT-test/autotest/testcase/migration/redhat_migration b/xCAT-test/autotest/testcase/migration/redhat_migration index a5fad7718..3840a2014 100644 --- a/xCAT-test/autotest/testcase/migration/redhat_migration +++ b/xCAT-test/autotest/testcase/migration/redhat_migration @@ -1,6 +1,6 @@ start:redhat_migration1 os:Linux -description:update xCAT from $$MIGRATION1_VERSION to $$LATEST_VERSION, these two global parameter defined in config file +description:update xCAT from $$MIGRATION1_VERSION to latest version, these two global parameter defined in config file #cmd:if ping -c 1 $$SN > /dev/null;then rpower $$SN off > /dev/null;fi #cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN @@ -103,14 +103,13 @@ cmd:xdsh $$CN "lsdef" check:output=~node0001 cmd:xdsh $$CN "noderm node0001" check:rc==0 -cmd:xdsh $$CN "lsxcatd -v" +cmd:latest_version_info=`lsxcatd -v`;xdsh $$CN "lsxcatd -v" | grep "$latest_version_info" check:rc==0 -check:output=~$$LATEST_VERSION end start:redhat_migration2 os:Linux -description:update xCAT from $$MIGRATION2_VERSION to $$LATEST_VERSION, these two global parameter defined in config file +description:update xCAT from $$MIGRATION2_VERSION to latest version, these two global parameter defined in config file stop:yes #cmd:if ping -c 1 $$SN > /dev/null;then rpower $$SN off > /dev/null;fi @@ -214,8 +213,7 @@ cmd:xdsh $$CN "lsdef" check:output=~node0001 cmd:xdsh $$CN "noderm node0001" check:rc==0 -cmd:xdsh $$CN "lsxcatd -v" +cmd:latest_version_info=`lsxcatd -v`;xdsh $$CN "lsxcatd -v" | grep "$latest_version_info" check:rc==0 -check:output=~$$LATEST_VERSION end diff --git a/xCAT-test/autotest/testcase/migration/sles_migration b/xCAT-test/autotest/testcase/migration/sles_migration index a41e56828..ab283ec77 100644 --- a/xCAT-test/autotest/testcase/migration/sles_migration +++ b/xCAT-test/autotest/testcase/migration/sles_migration @@ -1,6 +1,6 @@ start:sles_migration1 os:Linux -description:update xCAT from $$MIGRATION1_VERSION to $$LATEST_VERSION, these two global parameter defined in config file +description:update xCAT from $$MIGRATION1_VERSION to latest version, these two global parameter defined in config file #cmd:if ping -c 1 $$SN > /dev/null;then rpower $$SN off > /dev/null;fi #cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN @@ -106,14 +106,13 @@ cmd:xdsh $$CN "lsdef" check:output=~node0001 cmd:xdsh $$CN "noderm node0001" check:rc==0 -cmd:xdsh $$CN "lsxcatd -v" +cmd:latest_version_info=`lsxcatd -v`;xdsh $$CN "lsxcatd -v" | grep "$latest_version_info" check:rc==0 -check:output=~$$LATEST_VERSION end start:sles_migration2 os:Linux -description:update xCAT from $$MIGRATION22VERSION to $$LATEST_VERSION, these two global parameter defined in config file +description:update xCAT from $$MIGRATION22VERSION to latest version, these two global parameter defined in config file #cmd:if ping -c 1 $$SN > /dev/null;then rpower $$SN off > /dev/null;fi #cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN @@ -219,8 +218,7 @@ cmd:xdsh $$CN "lsdef" check:output=~node0001 cmd:xdsh $$CN "noderm node0001" check:rc==0 -cmd:xdsh $$CN "lsxcatd -v" +cmd:latest_version_info=`lsxcatd -v`;xdsh $$CN "lsxcatd -v" | grep "$latest_version_info" check:rc==0 -check:output=~$$LATEST_VERSION end From 6059a5c09e27102527f6583ea5ba20672fc5f28d Mon Sep 17 00:00:00 2001 From: ertaozh Date: Fri, 13 Jan 2017 00:30:32 -0500 Subject: [PATCH 8/9] add 2.13.x release information in documents --- docs/source/overview/xcat2_release.rst | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/docs/source/overview/xcat2_release.rst b/docs/source/overview/xcat2_release.rst index ec71b0834..dffe7f196 100644 --- a/docs/source/overview/xcat2_release.rst +++ b/docs/source/overview/xcat2_release.rst @@ -7,6 +7,30 @@ The following table is a summary of the new operating system (OS), hardware, and * **SLES** - Suse Linux Enterprise Server * **UBT** - Ubuntu +xCAT 2.13.x +----------- + ++---------------------------------+---------------+-------------+----------------------------------+ +|xCAT |New OS |New |New Feature | +|Version | |Hardware | | ++=================================+===============+=============+==================================+ +|| xCAT 2.13.1 | | |- ONIE switch support | +|| 2017/1/13 | | |- refine xcatprobe subcommand: | +|| | | | xcatmn, osdeploy | +| `2.13.1 Release Notes `_ | | | | +| | | | | ++---------------------------------+---------------+-------------+----------------------------------+ +|| xCAT 2.13 |- SLES 12.2 | |- update drivers for genesis-base | +|| 2016/12/09 | | | mlx4-en 3.2-1.0.1.1 | +|| | | | i40e 1.5.16 | +| `2.13 Release Notes `_ | | |- statelite image create by copyds| +| | | | | ++---------------------------------+---------------+-------------+----------------------------------+ + xCAT 2.12.x ----------- From e413f232648707d7de3188a7cc139f3c6783d3a3 Mon Sep 17 00:00:00 2001 From: Chuck Brazie Date: Mon, 23 Jan 2017 10:05:07 -0500 Subject: [PATCH 9/9] Secure cookies merge into global xCAT team UI. A few other changes also. Change-Id: I529160b9e2c31c86aca7c2c1ad32559c43ab4aea --- xCAT-UI/etc/apache2/conf.d/xcat-ui.conf | 7 + xCAT-UI/js/configure/service.js | 2 +- xCAT-UI/js/configure/update.js | 25 +- xCAT-UI/js/custom/blade.js | 188 +++---- xCAT-UI/js/custom/customUtils.js | 176 +++--- xCAT-UI/js/custom/esx.js | 166 +++--- xCAT-UI/js/custom/ipmi.js | 40 +- xCAT-UI/js/custom/kvm.js | 164 +++--- xCAT-UI/js/custom/zvm.js | 12 +- xCAT-UI/js/custom/zvmUtils.js | 319 +++++++---- xCAT-UI/js/help/help.js | 713 +++++++++++++++++++++++- xCAT-UI/js/monitor/gangliamon.js | 206 +++---- xCAT-UI/js/nodes/nodes.js | 26 +- xCAT-UI/js/nodes/nodeset.js | 2 +- xCAT-UI/js/nodes/physical.js | 78 +-- xCAT-UI/js/nodes/updatenode.js | 78 +-- xCAT-UI/js/provision/images.js | 14 +- xCAT-UI/js/provision/provision.js | 4 +- xCAT-UI/js/service/service.js | 30 +- xCAT-UI/js/srv_xcatauth.js | 20 +- xCAT-UI/js/ui.js | 15 +- xCAT-UI/js/xcatauth.js | 31 +- xCAT-UI/lib/functions.php | 41 +- xCAT-UI/lib/srv_functions.php | 18 +- 24 files changed, 1616 insertions(+), 759 deletions(-) diff --git a/xCAT-UI/etc/apache2/conf.d/xcat-ui.conf b/xCAT-UI/etc/apache2/conf.d/xcat-ui.conf index 2d94d8887..11d5b3445 100644 --- a/xCAT-UI/etc/apache2/conf.d/xcat-ui.conf +++ b/xCAT-UI/etc/apache2/conf.d/xcat-ui.conf @@ -1,5 +1,12 @@ Alias /xcat "/opt/xcat/ui" PHPINIDir "/opt/xcat/ui" + +# Redirect all http request to https +RewriteEngine On +RewriteCond %{SERVER_PORT} 80 +RewriteCond %{HTTPS} !=on +RewriteRule ^/?xcat/(.*) https://%{SERVER_NAME}/xcat/$1 [R,L] + Options FollowSymLinks AllowOverride None diff --git a/xCAT-UI/js/configure/service.js b/xCAT-UI/js/configure/service.js index 352c01d14..515b86296 100644 --- a/xCAT-UI/js/configure/service.js +++ b/xCAT-UI/js/configure/service.js @@ -60,7 +60,7 @@ function loadServicePage(tabId) { title = 'z/VM'; // Get zVM host names - if (!$.cookie('zvms')){ + if (!$.cookie('xcat_zvms')){ $.ajax( { url : 'lib/cmd.php', dataType : 'json', diff --git a/xCAT-UI/js/configure/update.js b/xCAT-UI/js/configure/update.js index 1422f1023..65d339292 100644 --- a/xCAT-UI/js/configure/update.js +++ b/xCAT-UI/js/configure/update.js @@ -39,7 +39,7 @@ function loadUpdatePage() { /** * Show the RPM repository (it can use the user's last choice and input) - * + * * @param data Data returned from HTTP request */ function showRepository(data) { @@ -61,7 +61,7 @@ function showRepository(data) { // Display the Devel Repository, remember user's last selection show = show + "
  • "; @@ -70,7 +70,7 @@ function showRepository(data) { // Display the Stable Repository, remember user's last selection show = "
  • "; @@ -78,23 +78,23 @@ function showRepository(data) { repoList.append(show); // Display the Input Repository, remember user's last selection - if (($.cookie('xcatrepository')) && ($.cookie('xcatrepository') != 1) - && ($.cookie('xcatrepository') != 2)) { + if (($.cookie('xcat_repository')) && ($.cookie('xcat_repository') != 1) + && ($.cookie('xcat_repository') != 2)) { show = "
  • Other: "; show += ""; + + $.cookie('xcat_repository') + "'
  • "; } else { show = "
  • Other: "; show += ""; } repoList.append(show); - + $('#repository fieldset').append(repoList); } /** * Show all xCAT RPMs - * + * * @param data Data returned from HTTP request */ function showRpmInfo(data) { @@ -109,7 +109,7 @@ function showRpmInfo(data) { } rpms = data.rsp.split(/\n/); - + // No rpm installed, return if (1 > rpms.length) { $('#rpm fieldset').append("No RPMs installed!"); @@ -201,7 +201,7 @@ function updateRpm() { if (pattern.test(rpms)) { return true; } - + rpms = rpms + temp + ","; }); @@ -227,8 +227,9 @@ function updateRpm() { } // Remember users' choice and input - $.cookie('xcatrepository', rpmPathType, { + $.cookie('xcat_repository', rpmPathType, { path : '/xcat', + secure : true, expires : 10 }); @@ -255,7 +256,7 @@ function updateRpm() { /** * Show the results of the RPM update - * + * * @param data Data returned from HTTP request */ function showUpdateResult(data) { diff --git a/xCAT-UI/js/custom/blade.js b/xCAT-UI/js/custom/blade.js index bf722afc2..adbfefb66 100644 --- a/xCAT-UI/js/custom/blade.js +++ b/xCAT-UI/js/custom/blade.js @@ -14,14 +14,14 @@ var bladePlugin = function() { /** * Load node inventory - * + * * @param data Data from HTTP request */ bladePlugin.prototype.loadInventory = function(data) { var args = data.msg.split(','); var tabId = args[0].replace('out=', ''); var node = args[1].replace('node=', ''); - + // Get node inventory var inv = data.rsp; @@ -30,7 +30,7 @@ bladePlugin.prototype.loadInventory = function(data) { // Create division to hold inventory var invDiv = $('
    '); - + // Create a fieldset var fieldSet = $('
    '); var legend = $('Hardware'); @@ -58,7 +58,7 @@ bladePlugin.prototype.loadInventory = function(data) { /** * Load clone page - * + * * @param node Source node to clone */ bladePlugin.prototype.loadClonePage = function(node) { @@ -78,13 +78,13 @@ bladePlugin.prototype.loadClonePage = function(node) { // Add clone tab tab.add(newTabId, 'Clone', cloneForm, true); } - + tab.select(newTabId); }; /** * Load provision page - * + * * @param tabId The provision tab ID */ bladePlugin.prototype.loadProvisionPage = function(tabId) { @@ -142,14 +142,14 @@ bladePlugin.prototype.loadResources = function() { var tabId = 'bladeResourceTab'; // Remove loader $('#' + tabId).find('img').remove(); - + // Create info bar var infoBar = createInfoBar('Not yet supported'); // Create resource form var resrcForm = $('
    '); resrcForm.append(infoBar); - + $('#' + tabId).append(resrcForm); }; @@ -160,18 +160,18 @@ bladePlugin.prototype.addNode = function() { var addNodeForm = $('
    '); var info = createInfoBar('Add a BladeCenter node'); addNodeForm.append(info); - + var typeFS = $('
    '); var typeLegend = $('Type'); typeFS.append(typeLegend); addNodeForm.append(typeFS); - + var settingsFS = $('
    '); var nodeLegend = $('Settings'); settingsFS.append(nodeLegend); addNodeForm.append(settingsFS); - - typeFS.append('
    ' + + + typeFS.append('
    ' + '' + '' + '
    '); - + // Change dialog width $('#addBladeCenter').dialog('option', 'width', '400'); - + typeFS.find('#typeSelect').bind('change', function(){ // Remove any existing warnings $('#addBladeCenter .ui-state-error').remove(); settingsFS.find('div').remove(); - + // Change dialog width $('#addBladeCenter').dialog('option', 'width', '400'); - + var nodeType = $(this).val(); switch (nodeType) { case 'amm': @@ -208,17 +208,17 @@ bladePlugin.prototype.addNode = function() { break; case 'scan': settingsFS.append('
    '); - + // Change dialog width $('#addBladeCenter').dialog('option', 'width', '650'); break; } - + // Do not continue if node type is AMM if ($(this).val() == 'amm') { return; } - + // Gather AMM nodes settingsFS.find('select:eq(0)').after(createLoader()); $.ajax({ @@ -234,16 +234,16 @@ bladePlugin.prototype.addNode = function() { var position = 0; var tmp = ''; var options = ''; - + // Remove the loading image settingsFS.find('img').remove(); - + // Do not continue if no AMM nodes are found if (data.rsp.length < 1) { $('#addBladeCenter').prepend(createWarnBar('Please define an AMM node before continuing')); return; } - + // Create options for AMM nodes for (var i in data.rsp){ tmp = data.rsp[i]; @@ -257,7 +257,7 @@ bladePlugin.prototype.addNode = function() { if (data.msg != 'scan') { return; } - + // Create Scan button var scan = createButton('Scan'); scan.bind('click', function(){ @@ -273,10 +273,10 @@ bladePlugin.prototype.addNode = function() { args : '', msg : '' }, - + /** * Show scanned results for AMM - * + * * @param data Data returned from HTTP request */ success: function(data){ @@ -284,12 +284,12 @@ bladePlugin.prototype.addNode = function() { } }); }); - + settingsFS.find('select:eq(0)').after(scan); } }); }); - + // Create dialog for BladeCenter addNodeForm.dialog({ modal : true, @@ -306,7 +306,7 @@ bladePlugin.prototype.addNode = function() { // Remove any existing warnings $('#addBladeCenter .ui-state-error').remove(); var addMethod = $('#typeSelect').val(); - + if (addMethod == "amm") { addAmmNode(); } else if(addMethod == "blade") { @@ -320,7 +320,7 @@ bladePlugin.prototype.addNode = function() { } } }); - + addNodeForm.find('#typeSelect').trigger('change'); }; @@ -331,16 +331,16 @@ bladePlugin.prototype.addNode = function() { function addAmmNode(){ var args = ''; var errorMsg = ''; - + // Check for missing inputs $('#addBladeCenter input').each(function(){ if (!$(this).val()) { errorMsg = 'Please provide a value for each missing field!'; } - + args += $(this).val() + ','; }); - + // Do not continue if error was found if (errorMsg) { $('#addBladeCenter').prepend(createWarnBar(errorMsg)); @@ -348,7 +348,7 @@ function addAmmNode(){ } args = args.substring(0, args.length - 1); - + // Add the loader $('#addBladeCenter').append(createLoader()); $('.ui-dialog-buttonpane .ui-button').attr('disabled', true); @@ -385,17 +385,17 @@ function addBladeNode(){ var series = $('#bcSettings input[name="bladeSeries"]:selected').val(); var mpa = $('#bcSettings select[name="bladeMpa"]').val(); - var args = '-t;node;-o;' + name - + ';id=' + id - + ';nodetype=osi;groups=' + group - + ';mgt=blade;mpa=' + mpa + var args = '-t;node;-o;' + name + + ';id=' + id + + ';nodetype=osi;groups=' + group + + ';mgt=blade;mpa=' + mpa + ';serialflow=hard'; - + // Set the serial speed and port for LS series blade if (series != 'js') { args += ';serialspeed=19200;serialport=1'; } - + // Check for missing inputs if (!name || !group || !id || !mpa) { $('#addBladeCenter').prepend(createWarnBar("Please provide a value for each missing field!")); @@ -427,7 +427,7 @@ function addBladeNode(){ // Append response message to dialog $('#addBladeCenter').prepend(createInfoBar(rspMessage)); - + // Change dialog button $('#addBladeCenter').dialog("option", "buttons", { "Close" : function() { @@ -440,29 +440,29 @@ function addBladeNode(){ /** * Show rscan results - * + * * @param results Results from rscan of blade MPA */ function showScanAmmResult(results){ var rSection = $('
    '); - + // Create table to hold results var rTable = $('
    '); - + // Reset scan results area $('#addBladeCenter #scanResults').remove(); $('#bcSettings img').remove(); $('#bcSettings button').attr('disabled', ''); if (!results) return; - + // Do not continue if there are no results var rows = results.split("\n"); if (rows.length < 2){ $('#bcSettings').prepend(createWarnBar(rows[0])); return; } - + // Add the table header var fields = rows[0].match(/\S+/g); var column = fields.length; @@ -472,23 +472,23 @@ function showScanAmmResult(results){ row.append('' + fields[i] + ''); } rTable.append(row); - + // Add table body var line; for (var i = 1; i < rows.length; i++) { line = rows[i]; - + if (!line) continue; - + var fields = line.match(/\S+/g); if (fields[0] == 'mm') continue; - + // Create a row for each result var row = $(''); row.append(''); - + // Add column for each field for (var j = 0; j < column; j++){ if (fields[j]) { @@ -501,11 +501,11 @@ function showScanAmmResult(results){ row.append(''); } } - + // Append row to table rTable.append(row); } - + rSection.append(rTable); $('#bcSettings').prepend(rSection); } @@ -517,25 +517,25 @@ function addMmScanNode(){ // Get the AMM name var ammName = $('#bcSettings select').val(); var nodeName = ''; - + $('#bcSettings :checked').each(function() { if ($(this).attr('name')) { nodeName += $(this).attr('name') + ','; nodeName += $(this).parents('tr').find('input').eq(1).val() + ','; } }); - + if (!nodeName) { $('#addBladeCenter').prepend(createWarnBar('Please select a node!')); return; } - + // Disabled button $('.ui-dialog-buttonpane button').attr('disabled', 'disabled'); - + nodeName = nodeName.substr(0, nodeName.length - 1); $('#nodeAttrs').append(createLoader()); - + // Send add request $.ajax({ url : 'lib/cmd.php', @@ -554,7 +554,7 @@ function addMmScanNode(){ /** * Create provision existing node division - * + * * @param inst Provision tab instance * @return Provision existing node division */ @@ -566,22 +566,22 @@ function createBladeProvisionExisting(inst) { var nodeFS = $('
    '); var nodeLegend = $('Node'); nodeFS.append(nodeLegend); - + var nodeAttr = $('
    '); nodeFS.append($('
    ')); nodeFS.append(nodeAttr); - + // Create image fieldset var imgFS = $('
    '); var imgLegend = $('Image'); imgFS.append(imgLegend); - + var imgAttr = $('
    '); imgFS.append($('
    ')); imgFS.append(imgAttr); - + provExisting.append(nodeFS, imgFS); - + // Create group input var group = $('
    '); var groupLabel = $(''); @@ -589,7 +589,7 @@ function createBladeProvisionExisting(inst) { // Turn on auto complete for group var dTableDivId = 'bladeNodesDatatableDIV' + inst; // Division ID where nodes datatable will be appended - var groupNames = $.cookie('groups'); + var groupNames = $.cookie('xcat_groups'); if (groupNames) { // Split group names into an array var tmp = groupNames.split(','); @@ -642,13 +642,13 @@ function createBladeProvisionExisting(inst) { method.append(methodLabel); method.append(methodSelect); imgAttr.append(method); - + // Create operating system input var os = $('
    '); var osLabel = $(''); var osInput = $(''); osInput.one('focus', function() { - var tmp = $.cookie('osvers'); + var tmp = $.cookie('xcat_osvers'); if (tmp) { // Turn on auto complete $(this).autocomplete({ @@ -665,7 +665,7 @@ function createBladeProvisionExisting(inst) { var archLabel = $(''); var archInput = $(''); archInput.one('focus', function() { - var tmp = $.cookie('osarchs'); + var tmp = $.cookie('xcat_osarchs'); if (tmp) { // Turn on auto complete $(this).autocomplete({ @@ -682,7 +682,7 @@ function createBladeProvisionExisting(inst) { var profileLabel = $(''); var profileInput = $(''); profileInput.one('focus', function() { - var tmp = $.cookie('profiles'); + var tmp = $.cookie('xcat_profiles'); if (tmp) { // Turn on auto complete $(this).autocomplete({ @@ -706,7 +706,7 @@ function createBladeProvisionExisting(inst) { // Get provision tab ID var thisTabId = 'bladeProvisionTab' + inst; - + // Get nodes that were checked var dTableId = 'bladeNodesDatatable' + inst; var tgts = getNodesChecked(dTableId); @@ -714,7 +714,7 @@ function createBladeProvisionExisting(inst) { errorMessage += 'You need to select a node. '; ready = false; } - + // Check booth method var boot = $('#' + thisTabId + ' select[name=bootMethod]'); if (!boot.val()) { @@ -724,7 +724,7 @@ function createBladeProvisionExisting(inst) { } else { boot.css('border', 'solid #BDBDBD 1px'); } - + // Check operating system image var os = $('#' + thisTabId + ' input[name=os]'); if (!os.val()) { @@ -734,7 +734,7 @@ function createBladeProvisionExisting(inst) { } else { os.css('border', 'solid #BDBDBD 1px'); } - + // Check architecture var arch = $('#' + thisTabId + ' input[name=arch]'); if (!arch.val()) { @@ -744,7 +744,7 @@ function createBladeProvisionExisting(inst) { } else { arch.css('border', 'solid #BDBDBD 1px'); } - + // Check profile var profile = $('#' + thisTabId + ' input[name=profile]'); if (!profile.val()) { @@ -754,12 +754,12 @@ function createBladeProvisionExisting(inst) { } else { profile.css('border', 'solid #BDBDBD 1px'); } - + // If all inputs are valid, ready to provision - if (ready) { + if (ready) { // Disable provision button $(this).attr('disabled', 'true'); - + // Prepend status bar var statBar = createStatusBar('bladeProvisionStatBar' + inst); statBar.append(createLoader('')); @@ -768,11 +768,11 @@ function createBladeProvisionExisting(inst) { // Disable all inputs var inputs = $('#' + thisTabId + ' input'); inputs.attr('disabled', 'disabled'); - + // Disable all selects var selects = $('#' + thisTabId + ' select'); selects.attr('disabled', 'disabled'); - + /** * (1) Set operating system */ @@ -801,7 +801,7 @@ function createBladeProvisionExisting(inst) { /** * Update the provision existing node status - * + * * @param data Data returned from HTTP request */ function updateBladeProvisionExistingStatus(data) { @@ -813,11 +813,11 @@ function updateBladeProvisionExistingStatus(data) { var cmd = args[0].replace('cmd=', ''); // Get provision tab instance var inst = args[1].replace('out=', ''); - + // Get provision tab and status bar ID var statBarId = 'bladeProvisionStatBar' + inst; var tabId = 'bladeProvisionTab' + inst; - + /** * (2) Remote install */ @@ -830,11 +830,11 @@ function updateBladeProvisionExistingStatus(data) { var os = $('#' + tabId + ' input[name="os"]').val(); var profile = $('#' + tabId + ' input[name="profile"]').val(); var arch = $('#' + tabId + ' input[name="arch"]').val(); - + // Get nodes that were checked var dTableId = 'bladeNodesDatatable' + inst; var tgts = getNodesChecked(dTableId); - + // Begin installation $.ajax( { url : 'lib/cmd.php', @@ -848,19 +848,19 @@ function updateBladeProvisionExistingStatus(data) { success : updateBladeProvisionExistingStatus }); - } - + } + /** * (3) Prepare node for boot */ if (cmd == 'nodeadd') { // Get provision method var bootMethod = $('#' + tabId + ' select[name=bootMethod]').val(); - + // Get nodes that were checked var dTableId = 'bladeNodesDatatable' + inst; var tgts = getNodesChecked(dTableId); - + // Prepare node for boot $.ajax( { url : 'lib/cmd.php', @@ -875,18 +875,18 @@ function updateBladeProvisionExistingStatus(data) { success : updateBladeProvisionExistingStatus }); } - + /** * (4) Power on node */ if (cmd == 'nodeset') { - var prg = writeRsp(rsp, ''); + var prg = writeRsp(rsp, ''); $('#' + statBarId).find('div').append(prg); - + // Get nodes that were checked var dTableId = 'bladeNodesDatatable' + inst; var tgts = getNodesChecked(dTableId); - + // Prepare node for boot $.ajax( { url : 'lib/cmd.php', @@ -901,16 +901,16 @@ function updateBladeProvisionExistingStatus(data) { success : updateBladeProvisionExistingStatus }); } - + /** * (5) Done */ else if (cmd == 'rpower') { // Write ajax response to status bar - var prg = writeRsp(rsp, ''); + var prg = writeRsp(rsp, ''); $('#' + statBarId).find('div').append(prg); $('#' + statBarId).find('img').remove(); - + // If installation was successful if (prg.html().indexOf('Error') == -1) { $('#' + statBarId).find('div').append('
    It will take several minutes before the nodes are up and ready. Use rcons to monitor the status of the install.
    '); diff --git a/xCAT-UI/js/custom/customUtils.js b/xCAT-UI/js/custom/customUtils.js index 51ab0498b..56b10854c 100644 --- a/xCAT-UI/js/custom/customUtils.js +++ b/xCAT-UI/js/custom/customUtils.js @@ -1,6 +1,6 @@ /** * Create nodes datatable for a given group - * + * * @param group Group name * @param outId Division ID to append datatable * @return Nodes datatable @@ -19,26 +19,26 @@ function createNodesDatatable(group, outId) { /** * Create nodes datatable - * + * * @param data Data returned from HTTP request */ success : function(data) { // Data returned var rsp = data.rsp; - + // Get output ID var outId = data.msg; // Get datatable ID var dTableId = outId.replace('DIV', ''); - + // Node attributes hash var attrs = new Object(); // Node attributes var headers = new Object(); - + // Clear nodes datatable division $('#' + outId).empty(); - + // Create nodes datatable var node = null; var args; @@ -48,22 +48,22 @@ function createNodesDatatable(group, outId) { if (pos > -1) { var temp = rsp[i].split(': '); node = jQuery.trim(temp[1]); - + // Create a hash for the node attributes attrs[node] = new Object(); i++; } - + // Get key and value args = rsp[i].split('='); var key = jQuery.trim(args[0]); var val = jQuery.trim(args[1]); - + // Create hash table attrs[node][key] = val; headers[key] = 1; } - + // Sort headers var sorted = new Array(); for ( var key in headers) { @@ -73,14 +73,14 @@ function createNodesDatatable(group, outId) { } } sorted.sort(); - + // Add column for check box and node sorted.unshift('', 'node'); - + // Create nodes datatable var dTable = new DataTable(dTableId); dTable.init(sorted); - + // Go through each node for ( var node in attrs) { // Create a row @@ -88,7 +88,7 @@ function createNodesDatatable(group, outId) { // Create a check box var checkBx = ''; row.push(checkBx, node); - + // Go through each header for ( var i = 2; i < sorted.length; i++) { // Add node attributes to the row @@ -100,11 +100,11 @@ function createNodesDatatable(group, outId) { row.push(''); } } - + // Add row to table dTable.add(row); } - + $('#' + outId).append(dTable.object()); $('#' + dTableId).dataTable({ 'iDisplayLength': 50, @@ -120,7 +120,7 @@ function createNodesDatatable(group, outId) { } } }); - + // Fix table styling $('#' + dTableId + '_wrapper .dataTables_filter label').css('width', '250px'); } // End of function(data) @@ -129,7 +129,7 @@ function createNodesDatatable(group, outId) { /** * Create provision existing node division - * + * * @param plugin Plugin name to create division for * @param inst Provision tab instance * @return Provision existing node division @@ -145,7 +145,7 @@ function createProvisionExisting(plugin, inst) { // Turn on auto complete for group var dTableDivId = plugin + 'NodesDatatableDIV' + inst; // Division ID where nodes datatable will be appended - var groupNames = $.cookie('groups'); + var groupNames = $.cookie('xcat_groups'); if (groupNames) { // Split group names into an array var tmp = groupNames.split(','); @@ -215,7 +215,7 @@ function createProvisionExisting(plugin, inst) { var osLabel = $(''); var osInput = $(''); osInput.one('focus', function() { - var tmp = $.cookie('osvers'); + var tmp = $.cookie('xcat_osvers'); if (tmp) { // Turn on auto complete $(this).autocomplete({ @@ -232,7 +232,7 @@ function createProvisionExisting(plugin, inst) { var archLabel = $(''); var archInput = $(''); archInput.one('focus', function() { - var tmp = $.cookie('osarchs'); + var tmp = $.cookie('xcat_osarchs'); if (tmp) { // Turn on auto complete $(this).autocomplete({ @@ -249,7 +249,7 @@ function createProvisionExisting(plugin, inst) { var profileLabel = $(''); var profileInput = $(''); profileInput.one('focus', function() { - var tmp = $.cookie('profiles'); + var tmp = $.cookie('xcat_profiles'); if (tmp) { // Turn on auto complete $(this).autocomplete({ @@ -276,7 +276,7 @@ function createProvisionExisting(plugin, inst) { /** * Create provision new node division - * + * * @param inst Provision tab instance * @return Provision new node division */ @@ -293,7 +293,7 @@ function createProvisionNew(plugin, inst) { var groupLabel = $(''); var groupInput = $(''); groupInput.one('focus', function() { - var groupNames = $.cookie('groups'); + var groupNames = $.cookie('xcat_groups'); if (groupNames) { // Turn on auto complete $(this).autocomplete({ @@ -336,7 +336,7 @@ function createProvisionNew(plugin, inst) { var osLabel = $(''); var osInput = $(''); osInput.one('focus', function() { - var tmp = $.cookie('osvers'); + var tmp = $.cookie('xcat_osvers'); if (tmp) { // Turn on auto complete $(this).autocomplete({ @@ -353,7 +353,7 @@ function createProvisionNew(plugin, inst) { var archLabel = $(''); var archInput = $(''); archInput.one('focus', function() { - var tmp = $.cookie('osarchs'); + var tmp = $.cookie('xcat_osarchs'); if (tmp) { // Turn on auto complete $(this).autocomplete({ @@ -370,7 +370,7 @@ function createProvisionNew(plugin, inst) { var profileLabel = $(''); var profileInput = $(''); profileInput.one('focus', function() { - var tmp = $.cookie('profiles'); + var tmp = $.cookie('xcat_profiles'); if (tmp) { // Turn on auto complete $(this).autocomplete({ @@ -397,31 +397,31 @@ function createProvisionNew(plugin, inst) { /** * Create section to provision node - * + * * @param plugin Plugin name * @param container Container to hold provision section */ function appendProvisionSection(plugin, container) { // Get provision tab ID var tabId = container.parents('.tab').attr('id'); - - if (plugin == 'quick') + + if (plugin == 'quick') appendProvision4Url(container); // For provisioning based on argmunents found in URL else appendProvision4NoUrl(plugin, container); - + // Add provision button var provisionBtn = createButton('Provision'); provisionBtn.bind('click', function(){ provisionNode(tabId); }); container.append(provisionBtn); - + // Bind image select to change event container.find('select[name=image]').bind('change', function() { createAdvancedOptions($(this).val(), tabId); }); - + $.ajax({ url : 'lib/cmd.php', dataType : 'json', @@ -441,15 +441,15 @@ function appendProvisionSection(plugin, container) { $('#' + tabId).prepend(createWarnBar('Please run copycds and genimage in provision page before continuing!')); return; } - + for (i in data.rsp) { imageName = data.rsp[i]; position = imageName.indexOf(' '); imageName = imageName.substr(0, position); - + $('#' + tabId + ' select[name=image]').append($('')); } - + // Trigger select change event $('#' + tabId + ' select[name=image]').trigger('change'); // Show provision button @@ -460,102 +460,102 @@ function appendProvisionSection(plugin, container) { /** * Create provision node section using URL - * + * * @param container Container to hold provision section * @returns Nothing */ -function appendProvision4Url(container){ +function appendProvision4Url(container){ // Create node fieldset var nodeFS = $('
    '); var nodeLegend = $('Node'); nodeFS.append(nodeLegend); container.append(nodeFS); - + var nodeAttr = $('
    '); nodeFS.append($('
    ')); nodeFS.append(nodeAttr); - + // Create image fieldset var imgFS = $('
    '); var imgLegend = $('Image'); imgFS.append(imgLegend); container.append(imgFS); - + var imgAttr = $('
    '); imgFS.append($('
    ')); imgFS.append(imgAttr); - + var query = window.location.search; var args = query.substr(1).split('&'); var parms = new Object(); var tmp; - + // Turn URL arguments into hash array for (var i = 0; i < args.length; i++) { tmp = args[i].split('='); parms[tmp[0]] = tmp[1]; } - + var master = ''; if (parms['master']) master = parms['master']; - + var nfsserver = ''; if (parms['nfsserver']) nfsserver = parms['nfsserver']; - + var tftpserver = ''; if (parms['tftpserver']) tftpserver = parms['tftpserver']; - + nodeAttr.append('
    '); - + imgAttr.append('
    '); imgAttr.append('
    '); imgAttr.append( '
    '); - imgAttr.append('
    '); + imgAttr.append('
    '); imgAttr.append('
    '); imgAttr.append('
    '); imgAttr.append('
    '); - + return; } /** * Create section to provision node using no URL - * + * * @param plugin Create provision section for given plugin * @param container Container to hold provision section */ function appendProvision4NoUrl(plugin, container){ // Get provision tab ID var tabId = container.parents('.tab').attr('id'); - + // Create node fieldset var nodeFS = $('
    '); var nodeLegend = $('Node'); nodeFS.append(nodeLegend); container.append(nodeFS); - + var nodeAttr = $('
    '); nodeFS.append($('
    ')); nodeFS.append(nodeAttr); - + // Create image fieldset var imgFS = $('
    '); var imgLegend = $('Image'); imgFS.append(imgLegend); container.append(imgFS); - + var imgAttr = $('
    '); imgFS.append($('
    ')); imgFS.append(imgAttr); - + // Select group name var group = $('
    ').append(''); var groupSelect = $(''); group.append(groupSelect); - var groupNames = $.cookie('groups'); + var groupNames = $.cookie('xcat_groups'); if (groupNames) { var tmp = groupNames.split(','); groupSelect.append(''); // Append empty group name @@ -569,14 +569,14 @@ function appendProvision4NoUrl(plugin, container){ var nodesTable = $('

    Select a group to view its nodes

    '); nodes.append(nodesTable); nodeAttr.append(nodes); - + // Select architecture - var arch = $('
    ').append(''); - var archName = $.cookie('osarchs'); + var arch = $('
    ').append(''); + var archName = $.cookie('xcat_osarchs'); if (archName) { var archSelect = $(''); arch.append(archSelect); - + var tmp = archName.split(','); for (var i in tmp) archSelect.append(''); @@ -591,30 +591,30 @@ function appendProvision4NoUrl(plugin, container){ imgAttr.append('
    '); imgAttr.append('
    '); imgAttr.append('
    '); - + // When a group is selected, show the nodes belonging to that group groupSelect.bind('change', function() { var nodesTableId = '#' + tabId + ' #nodesTable'; $(nodesTableId).append(createLoader()); createNodesTable($(this).val(), nodesTableId); }); - + return; } /** * Provision node - * + * * @param tabId Provision tab ID */ function provisionNode(tabId) { var errorMessage = ""; var args = new Array(); var node = ""; - + // Delete any existing warnings $('#' + tabId + ' .ui-state-error').remove(); - + // Go through each input $('#' + tabId + ' input[type!="checkbox"]').each(function() { if (!$(this).val()) { @@ -624,13 +624,13 @@ function provisionNode(tabId) { args.push($(this).val()); } }); - + // Do not continue if error was found if (errorMessage) { $('#' + tabId).prepend(createWarnBar(errorMessage)); return; } - + // If jumped from nodes page, get node name if (tabId == 'quick') { node = args.shift(); @@ -639,25 +639,25 @@ function provisionNode(tabId) { args.unshift($('#' + tabId + ' input[name=arch]').val()); node = getCheckedByObj($('#' + tabId + ' #nodesTable')); } - + // Do not continue if a node is not given if (!node) { $('#' + tabId).prepend(createWarnBar('Please select a node!')); return; } - + var software = getCheckedByObj($('#' + tabId + ' #advanced')); var imageName = $('#' + tabId + ' select[name=image]').val(); var provision = args.join(','); - - var url = 'lib/cmd.php?cmd=webrun&tgt=&args=provision;' + + + var url = 'lib/cmd.php?cmd=webrun&tgt=&args=provision;' + node + ';' + imageName + ';' + provision + ';' + software + '&msg=&opts=flush'; $('#' + tabId).prepend(createIFrame(url)); } /** * Create advance option - * + * * @param image Image name * @param outId Output area ID */ @@ -678,29 +678,29 @@ function createAdvancedOptions(image, outId) { var provMethod = ''; var tmpStr = ''; var position = 0; - + for (var i = 0; i < data.rsp.length; i++) { tmpStr = data.rsp[i]; if (tmpStr.indexOf('osname') != -1) { position = tmpStr.indexOf('='); osName = tmpStr.substr(position + 1); } - + if (tmpStr.indexOf('provmethod') != -1) { position = tmpStr.indexOf('='); provMethod = tmpStr.substr(position + 1); } } - + $('#' + outId + ' #advanced').remove(); if (osName.toLowerCase() == 'aix') return; - + if (provMethod == 'install') { // Create advanced fieldset var advancedFS = $('
    ').append($('Advanced')); $('#' + outId + ' div.form fieldset:eq(1)').after(advancedFS); - + advancedFS.append('
    Install Ganglia monitoring
    '); } } @@ -709,11 +709,11 @@ function createAdvancedOptions(image, outId) { /** * Create nodes table - * + * * @param group Group name * @param outId Output section ID */ -function createNodesTable(group, outId) { +function createNodesTable(group, outId) { // Get group nodes $.ajax({ url : 'lib/cmd.php', @@ -728,26 +728,26 @@ function createNodesTable(group, outId) { success : function(data) { var outId = $(data.msg); var nodes = data.rsp; - + // Create table to hold nodes var nTable = $('
    '); var tHead = $(' Node '); nTable.append(tHead); var tBody = $(''); nTable.append(tBody); - + for (var i in nodes) { var node = nodes[i][0]; - + // Go to next node if there is nothing here if (!node) continue; // Insert node into table tBody.append('' + node + ''); } - + outId.empty().append(nTable); - + if (nodes.length > 10) outId.css('height', '300px'); else @@ -758,13 +758,13 @@ function createNodesTable(group, outId) { /** * Get select element names - * + * * @param obj Object to get selected element names * @return Nodes name seperate by a comma */ function getCheckedByObj(obj) { var str = ''; - + // Get nodes that were checked obj.find('input:checked').each(function() { if ($(this).attr('name')) { @@ -781,7 +781,7 @@ function getCheckedByObj(obj) { /** * Select all checkboxes in the table - * + * * @param event Event on element * @param obj Object triggering event */ diff --git a/xCAT-UI/js/custom/esx.js b/xCAT-UI/js/custom/esx.js index 901e8f95a..c20b05c3c 100644 --- a/xCAT-UI/js/custom/esx.js +++ b/xCAT-UI/js/custom/esx.js @@ -7,7 +7,7 @@ $(document).ready(function() { /** * Constructor - * + * * @return Nothing */ var esxPlugin = function() { @@ -17,9 +17,9 @@ var esxPlugin = function() { /** * Configure self-service page */ -esxPlugin.prototype.loadConfigPage = function(tabId) { +esxPlugin.prototype.loadConfigPage = function(tabId) { var configAccordion = $('
    '); - + // Create accordion panel for profiles var profileSection = $('
    '); var profileLnk = $('

    Profiles

    ').click(function () { @@ -34,11 +34,11 @@ esxPlugin.prototype.loadConfigPage = function(tabId) { // Add info bar $('#esxConfigProfile').append(createInfoBar('Not yet supported')); - + // Resize accordion configAccordion.accordion('resize'); }); - + // Create accordion panel for images var imgSection = $('
    '); var imgLnk = $('

    Images

    ').click(function () { @@ -50,7 +50,7 @@ esxPlugin.prototype.loadConfigPage = function(tabId) { queryImages('esxConfigImages'); }); - + // Create accordion panel for groups var groupsSection = $('
    '); var groupsLnk = $('

    Groups

    ').click(function () { @@ -62,17 +62,17 @@ esxPlugin.prototype.loadConfigPage = function(tabId) { queryGroups('esxConfigGroups'); }); - + configAccordion.append(profileLnk, profileSection, imgLnk, imgSection, groupsLnk, groupsSection); $('#' + tabId).append(configAccordion); configAccordion.accordion(); - + profileLnk.trigger('click'); }; /** * Migrate node - * + * * @param node Node to migrate */ esxPlugin.prototype.loadMigratePage = function(node) { @@ -81,7 +81,7 @@ esxPlugin.prototype.loadMigratePage = function(node) { /** * Clone node (service page) - * + * * @param node Node to clone */ esxPlugin.prototype.serviceClone = function(node) { @@ -90,7 +90,7 @@ esxPlugin.prototype.serviceClone = function(node) { /** * Load provision page (service page) - * + * * @param tabId * Tab ID where page will reside * @return Nothing @@ -101,23 +101,23 @@ esxPlugin.prototype.loadServiceProvisionPage = function(tabId) { /** * Show node inventory (service page) - * + * * @param data Data from HTTP request */ esxPlugin.prototype.loadServiceInventory = function(data) { - + }; /** * Load node inventory - * + * * @param data Data from HTTP request */ esxPlugin.prototype.loadInventory = function(data) { var args = data.msg.split(','); var tabId = args[0].replace('out=', ''); var node = args[1].replace('node=', ''); - + // Get node inventory var inv = data.rsp; @@ -127,12 +127,12 @@ esxPlugin.prototype.loadInventory = function(data) { // Create division to hold inventory var invDivId = tabId + 'Inventory'; var invDiv = $('
    '); - + // Create a fieldset var fieldSet = $('
    '); var legend = $('Hardware'); fieldSet.append(legend); - + var oList = $('
      '); fieldSet.append(oList); invDiv.append(fieldSet); @@ -156,7 +156,7 @@ esxPlugin.prototype.loadInventory = function(data) { /** * Load clone page - * + * * @param node Source node to clone */ esxPlugin.prototype.loadClonePage = function(node) { @@ -176,13 +176,13 @@ esxPlugin.prototype.loadClonePage = function(node) { // Add clone tab tab.add(newTabId, 'Clone', cloneForm, true); } - + tab.select(newTabId); }; /** * Load provision page - * + * * @param tabId The provision tab ID */ esxPlugin.prototype.loadProvisionPage = function(tabId) { @@ -223,36 +223,36 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) { // Append to provision tab $('#' + tabId).append(provForm); - + // Create VM fieldset var vmFS = $('
      '); var vmLegend = $('Virtual Machine'); vmFS.append(vmLegend); - + var vmAttr = $('
      '); vmFS.append($('
      ')); vmFS.append(vmAttr); - + // Create hardware fieldset var hwFS = $('
      '); var hwLegend = $('Hardware'); hwFS.append(hwLegend); - + var hwAttr = $('
      '); hwFS.append($('
      ')); hwFS.append(hwAttr); - + // Create image fieldset var imgFS = $('
      '); var imgLegend = $('Image'); imgFS.append(imgLegend); - + var imgAttr = $('
      '); imgFS.append($('
      ')); imgFS.append(imgAttr); - + provForm.append(vmFS, hwFS, imgFS); - + // Create hypervisor input var host = $('
      '); var hostLabel = $(''); @@ -260,14 +260,14 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) { var hostInput = $(''); host.append(hostInput); vmAttr.append(host); - + // Create group input var group = $('
      '); var groupLabel = $(''); group.append(groupLabel); // Turn on auto complete for group - var groupNames = $.cookie('groups'); + var groupNames = $.cookie('xcat_groups'); if (groupNames) { // Split group names into an array var tmp = groupNames.split(','); @@ -303,7 +303,7 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) { memory.append(memoryLabel); memory.append(memoryInput); hwAttr.append(memory); - + // Create processor dropdown var cpu = $('
      '); var cpuLabel = $(''); @@ -320,7 +320,7 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) { cpu.append(cpuLabel); cpu.append(cpuSelect); hwAttr.append(cpu); - + // Create NIC dropdown var nic = $('
      '); var nicLabel = $(''); @@ -328,7 +328,7 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) { nic.append(nicLabel); nic.append(nicInput); hwAttr.append(nic); - + // Create disk input var disk = $('
      '); var diskLabel = $(''); @@ -339,7 +339,7 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) { ); disk.append(diskLabel, diskInput, diskSizeSelect); hwAttr.append(disk); - + // Create disk storage input var storage = $('
      '); var storageLabel = $(''); @@ -347,13 +347,13 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) { storage.append(storageLabel); storage.append(storageInput); hwAttr.append(storage); - + // Create operating system input var os = $('
      '); var osLabel = $(''); var osInput = $(''); osInput.one('focus', function() { - var tmp = $.cookie('osvers'); + var tmp = $.cookie('xcat_osvers'); if (tmp) { // Turn on auto complete $(this).autocomplete({ @@ -364,13 +364,13 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) { os.append(osLabel); os.append(osInput); imgAttr.append(os); - + // Create architecture input var arch = $('
      '); var archLabel = $(''); var archInput = $(''); archInput.one('focus', function() { - var tmp = $.cookie('osarchs'); + var tmp = $.cookie('xcat_osarchs'); if (tmp) { // Turn on auto complete $(this).autocomplete({ @@ -381,13 +381,13 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) { arch.append(archLabel); arch.append(archInput); imgAttr.append(arch); - + // Create profile input var profile = $('
      '); var profileLabel = $(''); var profileInput = $(''); profileInput.one('focus', function() { - var tmp = $.cookie('profiles'); + var tmp = $.cookie('xcat_profiles'); if (tmp) { // Turn on auto complete $(this).autocomplete({ @@ -398,7 +398,7 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) { profile.append(profileLabel); profile.append(profileInput); imgAttr.append(profile); - + // Create boot method dropdown var method = $('
      '); var methodLabel = $(''); @@ -422,10 +422,10 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) { // Remove any warning messages $(this).parents('.ui-tabs-panel').find('.ui-state-error').remove(); var ready = true; - + // Get tab ID var tabId = $(this).parents('.ui-tabs-panel').attr('id'); - + // Check if fields are properly filled in var inputs = $('#' + tabId + ' input:visible'); for ( var i = 0; i < inputs.length; i++) { @@ -436,7 +436,7 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) { inputs.eq(i).css('border', 'solid #BDBDBD 1px'); } } - + var selects = $('#' + tabId + ' select:visible'); for ( var i = 0; i < selects.length; i++) { if (!selects.eq(i).val()) { @@ -446,30 +446,30 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) { selects.eq(i).css('border', 'solid #BDBDBD 1px'); } } - + if (ready) { var inst = tabId.replace('kvmProvisionTab', ''); - + // Prepend status bar var statBar = createStatusBar('kvmProvisionStatBar' + inst); statBar.append(createLoader('')); statBar.prependTo($('#' + tabId)); - + var host = $('#' + tabId + ' input[name=host]').val(); var group = $('#' + tabId + ' select[name=group]').val(); var node = $('#' + tabId + ' input[name=node]').val(); - + var memory = $('#' + tabId + ' input[name=memory]').val(); var cpu = $('#' + tabId + ' select[name=cpu]').val(); var nic = $('#' + tabId + ' input[name=nic]').val(); var disk = $('#' + tabId + ' input[name=disk]').val() + $('#' + tabId + ' select[name=diskUnit]').val(); var storage = $('#' + tabId + ' input[name=storage]').val(); - + var os = $('#' + tabId + ' input[name=os]').val(); var arch = $('#' + tabId + ' input[name=arch]').val(); var profile = $('#' + tabId + ' input[name=profile]').val(); var boot = $('#' + tabId + ' select[name=bootMethod]').val(); - + /** * (1) Define node */ @@ -517,14 +517,14 @@ esxPlugin.prototype.loadResources = function() { var tabId = 'esxResourceTab'; // Remove loader $('#' + tabId).find('img').remove(); - + // Create info bar var infoBar = createInfoBar('Not yet supported'); // Create resource form var resrcForm = $('
      '); resrcForm.append(infoBar); - + $('#' + tabId).append(resrcForm); }; @@ -535,13 +535,13 @@ esxPlugin.prototype.addNode = function() { var dialog = $('
      '); var info = createInfoBar('Add a ESX node'); dialog.append(info); - + // Create node inputs dialog.append($('
      ')); dialog.append($('
      ')); dialog.append($('
      ')); dialog.append($('
      ')); - + dialog.dialog({ title: 'Add node', modal: true, @@ -560,13 +560,13 @@ esxPlugin.prototype.addNode = function() { function addEsxNode(){ var attr, args; var errorMessage = ''; - + // Remove existing warnings $('#addEsx .ui-state-error').remove(); - + // Return input border colors to normal $('#addEsx input').css('border', 'solid #BDBDBD 1px'); - + // Check node attributes $('#addEsx input').each(function(){ attr = $(this).val(); @@ -575,28 +575,28 @@ function addEsxNode(){ $(this).css('border', 'solid #FF0000 1px'); } }); - + // Show error message (if any) if (errorMessage) { $('#addEsx').prepend(createWarnBar(errorMessage)); return; } - + // Create loader $('#addEsx').append(createLoader()); - + // Change dialog buttons $('#addEsx').dialog('option', 'buttons', { 'Close':function() { $('#addEsx').dialog('destroy').remove(); } }); - + // Generate chdef arguments args = '-t;node;-o;' + $('#addEsx input[name="node"]').val() + ';ip=' + $('#addEsx input[name="ip"]').val() - + ';groups=' + $('#addEsx input[name="groups"]').val() - + ';vmhost=' + $('#addEsx input[name="vmhost"]').val() + + ';groups=' + $('#addEsx input[name="groups"]').val() + + ';vmhost=' + $('#addEsx input[name="vmhost"]').val() + ';mgt=esx;netboot=xnba;nodetype=osi;profile=compute'; $.ajax({ url : 'lib/cmd.php', @@ -619,16 +619,16 @@ function addEsxNode(){ msg : '' } }); - + // Remove loader $('#addEsx img').remove(); - + // Get return message var message = ''; for (var i in data.rsp) { message += data.rsp[i] + '
      '; } - + // Show return message if (message) $('#addEsx').prepend(createInfoBar(message)); @@ -638,7 +638,7 @@ function addEsxNode(){ /** * Update the provision node status - * + * * @param data Data returned from HTTP request */ function updateESXProvisionStatus(data) { @@ -650,24 +650,24 @@ function updateESXProvisionStatus(data) { var cmd = args[0].replace('cmd=', ''); // Get provision tab instance var inst = args[1].replace('out=', ''); - + // Get provision tab and status bar ID var statBarId = 'kvmProvisionStatBar' + inst; var tabId = 'kvmProvisionTab' + inst; - + var node = $('#' + tabId + ' input[name=node]').val(); - + /** * (2) Create virtual machine */ if (cmd == 'chdef') { // Write ajax response to status bar - var prg = writeRsp(rsp, ''); + var prg = writeRsp(rsp, ''); $('#' + statBarId).find('div').append(prg); // Get parameters var disk = $('#' + tabId + ' input[name=disk]').val() + $('#' + tabId + ' select[name=diskUnit]').val(); - + // Begin installation $.ajax( { url : 'lib/cmd.php', @@ -681,19 +681,19 @@ function updateESXProvisionStatus(data) { success : updateESXProvisionStatus }); - } - + } + /** * (3) Prepare node for boot */ if (cmd == 'mkvm') { // Write ajax response to status bar - var prg = writeRsp(rsp, ''); + var prg = writeRsp(rsp, ''); $('#' + statBarId).find('div').append(prg); - + // Get provision method var boot = $('#' + tabId + ' select[name=bootMethod]').val(); - + // Prepare node for boot $.ajax( { url : 'lib/cmd.php', @@ -708,14 +708,14 @@ function updateESXProvisionStatus(data) { success : updateESXProvisionStatus }); } - + /** * (4) Power on node */ if (cmd == 'nodeset') { - var prg = writeRsp(rsp, ''); + var prg = writeRsp(rsp, ''); $('#' + statBarId).find('div').append(prg); - + // Prepare node for boot $.ajax( { url : 'lib/cmd.php', @@ -730,16 +730,16 @@ function updateESXProvisionStatus(data) { success : updateESXProvisionStatus }); } - + /** * (5) Done */ else if (cmd == 'rpower') { // Write ajax response to status bar - var prg = writeRsp(rsp, ''); + var prg = writeRsp(rsp, ''); $('#' + statBarId).find('div').append(prg); $('#' + statBarId).find('img').remove(); - + // If installation was successful if (prg.html().indexOf('Error') == -1) { $('#' + statBarId).find('div').append('
      It will take several minutes before the nodes are up and ready. Use rcons to monitor the status of the install.
      '); diff --git a/xCAT-UI/js/custom/ipmi.js b/xCAT-UI/js/custom/ipmi.js index 839d94d60..8adf1c915 100644 --- a/xCAT-UI/js/custom/ipmi.js +++ b/xCAT-UI/js/custom/ipmi.js @@ -14,7 +14,7 @@ var ipmiPlugin = function() { /** * Steps for hardware discovery wizard - * + * * @return Discovery steps */ ipmiPlugin.prototype.getStep = function() { @@ -37,7 +37,7 @@ ipmiPlugin.prototype.getNextFunction = function() { /** * Load node inventory - * + * * @param data Data from HTTP request */ ipmiPlugin.prototype.loadInventory = function(data) { @@ -82,7 +82,7 @@ ipmiPlugin.prototype.loadInventory = function(data) { /** * Load clone page - * + * * @param node Source node to clone */ ipmiPlugin.prototype.loadClonePage = function(node) { @@ -108,7 +108,7 @@ ipmiPlugin.prototype.loadClonePage = function(node) { /** * Load provision page - * + * * @param tabId The provision tab ID */ ipmiPlugin.prototype.loadProvisionPage = function(tabId) { @@ -297,7 +297,7 @@ function addIdataplex() { /** * Create provision existing node division - * + * * @param inst Provision tab instance * @return Provision existing node division */ @@ -336,7 +336,7 @@ function createIpmiProvisionExisting(inst) { var dTableDivId = 'ipmiNodesDatatableDIV' + inst; // Division ID where // nodes datatable will // be appended - var groupNames = $.cookie('groups'); + var groupNames = $.cookie('xcat_groups'); if (groupNames) { // Split group names into an array var tmp = groupNames.split(','); @@ -397,7 +397,7 @@ function createIpmiProvisionExisting(inst) { var osLabel = $(''); var osInput = $(''); osInput.one('focus', function() { - var tmp = $.cookie('osvers'); + var tmp = $.cookie('xcat_osvers'); if (tmp) { // Turn on auto complete $(this).autocomplete({ @@ -414,7 +414,7 @@ function createIpmiProvisionExisting(inst) { var archLabel = $(''); var archInput = $(''); archInput.one('focus', function() { - var tmp = $.cookie('osarchs'); + var tmp = $.cookie('xcat_osarchs'); if (tmp) { // Turn on auto complete $(this).autocomplete({ @@ -431,7 +431,7 @@ function createIpmiProvisionExisting(inst) { var profileLabel = $(''); var profileInput = $(''); profileInput.one('focus', function() { - var tmp = $.cookie('profiles'); + var tmp = $.cookie('xcat_profiles'); if (tmp) { // Turn on auto complete $(this).autocomplete({ @@ -553,7 +553,7 @@ function createIpmiProvisionExisting(inst) { /** * Update the provision existing node status - * + * * @param data Data returned from HTTP request */ function updateIpmiProvisionExistingStatus(data) { @@ -645,17 +645,17 @@ function idataplexInitBasic() { } showString += 'Start IP:'; - + showString += 'Nodes number
      per Frame:'; - + showString += '

      BMCs:

      '; showString += 'Name Range:'; - + if (getDiscoverEnv('idataplexbmcip')) { tempip = getDiscoverEnv('idataplexbmcip'); } else { @@ -663,12 +663,12 @@ function idataplexInitBasic() { } showString += 'Start IP:'; - + showString += '

      Switches:

      '; showString += 'Name Range:'; - + if (getDiscoverEnv('idataplexswitchip')) { tempip = getDiscoverEnv('idataplexswitchip'); } else { @@ -676,7 +676,7 @@ function idataplexInitBasic() { } showString += 'Start IP:'; - + showString += 'Nodes number
      per Switch:
      '); - + // Create accordion panel for profiles var profileSection = $('
      '); var profileLnk = $('

      Profiles

      ').click(function () { @@ -32,11 +32,11 @@ kvmPlugin.prototype.loadConfigPage = function(tabId) { // Add info bar $('#kvmConfigProfile').append(createInfoBar('Not yet supported')); - + // Resize accordion configAccordion.accordion('resize'); }); - + // Create accordion panel for images var imgSection = $('
      '); var imgLnk = $('

      Images

      ').click(function () { @@ -48,7 +48,7 @@ kvmPlugin.prototype.loadConfigPage = function(tabId) { queryImages('kvmConfigImages'); }); - + // Create accordion panel for groups var groupsSection = $('
      '); var groupsLnk = $('

      Groups

      ').click(function () { @@ -60,17 +60,17 @@ kvmPlugin.prototype.loadConfigPage = function(tabId) { queryGroups('kvmConfigGroups'); }); - + configAccordion.append(profileLnk, profileSection, imgLnk, imgSection, groupsLnk, groupsSection); $('#' + tabId).append(configAccordion); configAccordion.accordion(); - + profileLnk.trigger('click'); }; /** * Migrate node - * + * * @param node Node to migrate */ kvmPlugin.prototype.loadMigratePage = function(node) { @@ -79,7 +79,7 @@ kvmPlugin.prototype.loadMigratePage = function(node) { /** * Clone node (service page) - * + * * @param node Node to clone */ kvmPlugin.prototype.serviceClone = function(node) { @@ -88,7 +88,7 @@ kvmPlugin.prototype.serviceClone = function(node) { /** * Load provision page (service page) - * + * * @param tabId Tab ID where page will reside */ kvmPlugin.prototype.loadServiceProvisionPage = function(tabId) { @@ -97,23 +97,23 @@ kvmPlugin.prototype.loadServiceProvisionPage = function(tabId) { /** * Show node inventory (service page) - * + * * @param data Data from HTTP request */ kvmPlugin.prototype.loadServiceInventory = function(data) { - + }; /** * Load node inventory - * + * * @param data Data from HTTP request */ kvmPlugin.prototype.loadInventory = function(data) { var args = data.msg.split(','); var tabId = args[0].replace('out=', ''); var node = args[1].replace('node=', ''); - + // Get node inventory var inv = data.rsp; @@ -122,12 +122,12 @@ kvmPlugin.prototype.loadInventory = function(data) { // Create division to hold inventory var invDiv = $('
      '); - + // Create a fieldset var fieldSet = $('
      '); var legend = $('Hardware'); fieldSet.append(legend); - + var oList = $('
        '); fieldSet.append(oList); invDiv.append(fieldSet); @@ -151,7 +151,7 @@ kvmPlugin.prototype.loadInventory = function(data) { /** * Load clone page - * + * * @param node Source node to clone */ kvmPlugin.prototype.loadClonePage = function(node) { @@ -171,13 +171,13 @@ kvmPlugin.prototype.loadClonePage = function(node) { // Add clone tab tab.add(newTabId, 'Clone', cloneForm, true); } - + tab.select(newTabId); }; /** * Load provision page - * + * * @param tabId The provision tab ID */ kvmPlugin.prototype.loadProvisionPage = function(tabId) { @@ -218,36 +218,36 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) { // Append to provision tab $('#' + tabId).append(provForm); - + // Create VM fieldset var vmFS = $('
        '); var vmLegend = $('Virtual Machine'); vmFS.append(vmLegend); - + var vmAttr = $('
        '); vmFS.append($('
        ')); vmFS.append(vmAttr); - + // Create hardware fieldset var hwFS = $('
        '); var hwLegend = $('Hardware'); hwFS.append(hwLegend); - + var hwAttr = $('
        '); hwFS.append($('
        ')); hwFS.append(hwAttr); - + // Create image fieldset var imgFS = $('
        '); var imgLegend = $('Image'); imgFS.append(imgLegend); - + var imgAttr = $('
        '); imgFS.append($('
        ')); imgFS.append(imgAttr); - + provForm.append(vmFS, hwFS, imgFS); - + // Create hypervisor input var host = $('
        '); var hostLabel = $(''); @@ -255,14 +255,14 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) { var hostInput = $(''); host.append(hostInput); vmAttr.append(host); - + // Create group input var group = $('
        '); var groupLabel = $(''); group.append(groupLabel); // Turn on auto complete for group - var groupNames = $.cookie('groups'); + var groupNames = $.cookie('xcat_groups'); if (groupNames) { // Split group names into an array var tmp = groupNames.split(','); @@ -298,7 +298,7 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) { memory.append(memoryLabel); memory.append(memoryInput); hwAttr.append(memory); - + // Create processor dropdown var cpu = $('
        '); var cpuLabel = $(''); @@ -315,7 +315,7 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) { cpu.append(cpuLabel); cpu.append(cpuSelect); hwAttr.append(cpu); - + // Create NIC dropdown var nic = $('
        '); var nicLabel = $(''); @@ -323,7 +323,7 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) { nic.append(nicLabel); nic.append(nicInput); hwAttr.append(nic); - + // Create disk input var disk = $('
        '); var diskLabel = $(''); @@ -334,7 +334,7 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) { ); disk.append(diskLabel, diskInput, diskSizeSelect); hwAttr.append(disk); - + // Create disk storage input var storage = $('
        '); var storageLabel = $(''); @@ -342,13 +342,13 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) { storage.append(storageLabel); storage.append(storageInput); hwAttr.append(storage); - + // Create operating system input var os = $('
        '); var osLabel = $(''); var osInput = $(''); osInput.one('focus', function() { - var tmp = $.cookie('osvers'); + var tmp = $.cookie('xcat_osvers'); if (tmp) { // Turn on auto complete $(this).autocomplete({ @@ -359,13 +359,13 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) { os.append(osLabel); os.append(osInput); imgAttr.append(os); - + // Create architecture input var arch = $('
        '); var archLabel = $(''); var archInput = $(''); archInput.one('focus', function() { - var tmp = $.cookie('osarchs'); + var tmp = $.cookie('xcat_osarchs'); if (tmp) { // Turn on auto complete $(this).autocomplete({ @@ -376,13 +376,13 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) { arch.append(archLabel); arch.append(archInput); imgAttr.append(arch); - + // Create profile input var profile = $('
        '); var profileLabel = $(''); var profileInput = $(''); profileInput.one('focus', function() { - var tmp = $.cookie('profiles'); + var tmp = $.cookie('xcat_profiles'); if (tmp) { // Turn on auto complete $(this).autocomplete({ @@ -393,7 +393,7 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) { profile.append(profileLabel); profile.append(profileInput); imgAttr.append(profile); - + // Create boot method dropdown var method = $('
        '); var methodLabel = $(''); @@ -417,10 +417,10 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) { // Remove any warning messages $(this).parents('.ui-tabs-panel').find('.ui-state-error').remove(); var ready = true; - + // Get tab ID var tabId = $(this).parents('.ui-tabs-panel').attr('id'); - + // Check if fields are properly filled in var inputs = $('#' + tabId + ' input:visible'); for ( var i = 0; i < inputs.length; i++) { @@ -431,7 +431,7 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) { inputs.eq(i).css('border', 'solid #BDBDBD 1px'); } } - + var selects = $('#' + tabId + ' select:visible'); for ( var i = 0; i < selects.length; i++) { if (!selects.eq(i).val()) { @@ -441,30 +441,30 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) { selects.eq(i).css('border', 'solid #BDBDBD 1px'); } } - + if (ready) { var inst = tabId.replace('kvmProvisionTab', ''); - + // Prepend status bar var statBar = createStatusBar('kvmProvisionStatBar' + inst); statBar.append(createLoader('')); statBar.prependTo($('#' + tabId)); - + var host = $('#' + tabId + ' input[name=host]').val(); var group = $('#' + tabId + ' select[name=group]').val(); var node = $('#' + tabId + ' input[name=node]').val(); - + var memory = $('#' + tabId + ' input[name=memory]').val(); var cpu = $('#' + tabId + ' select[name=cpu]').val(); var nic = $('#' + tabId + ' input[name=nic]').val(); var disk = $('#' + tabId + ' input[name=disk]').val() + $('#' + tabId + ' select[name=diskUnit]').val(); var storage = $('#' + tabId + ' input[name=storage]').val(); - + var os = $('#' + tabId + ' input[name=os]').val(); var arch = $('#' + tabId + ' input[name=arch]').val(); var profile = $('#' + tabId + ' input[name=profile]').val(); var boot = $('#' + tabId + ' select[name=bootMethod]').val(); - + /** * (1) Define node */ @@ -512,14 +512,14 @@ kvmPlugin.prototype.loadResources = function() { var tabId = 'kvmResourceTab'; // Remove loader $('#' + tabId).find('img').remove(); - + // Create info bar var infoBar = createInfoBar('Not yet supported'); // Create resource form var resrcForm = $('
        '); resrcForm.append(infoBar); - + $('#' + tabId).append(resrcForm); }; @@ -530,13 +530,13 @@ kvmPlugin.prototype.addNode = function() { var dialog = $('
        '); var info = createInfoBar('Add a KVM node'); dialog.append(info); - + // Create node inputs dialog.append($('
        ')); dialog.append($('
        ')); dialog.append($('
        ')); dialog.append($('
        ')); - + dialog.dialog({ title: 'Add node', modal: true, @@ -555,13 +555,13 @@ kvmPlugin.prototype.addNode = function() { function addKvmNode(){ var attr, args; var errorMessage = ''; - + // Remove existing warnings $('#addKvm .ui-state-error').remove(); - + // Return input border colors to normal $('#addKvm input').css('border', 'solid #BDBDBD 1px'); - + // Check node attributes $('#addKvm input').each(function(){ attr = $(this).val(); @@ -570,28 +570,28 @@ function addKvmNode(){ $(this).css('border', 'solid #FF0000 1px'); } }); - + // Show error message (if any) if (errorMessage) { $('#addKvm').prepend(createWarnBar(errorMessage)); return; } - + // Create loader $('#addKvm').append(createLoader()); - + // Change dialog buttons $('#addKvm').dialog('option', 'buttons', { 'Close':function(){ $('#addKvm').dialog('destroy').remove(); } }); - + // Generate chdef arguments args = '-t;node;-o;' + $('#addKvm input[name="node"]').val() + ';ip=' + $('#addKvm input[name="ip"]').val() - + ';groups=' + $('#addKvm input[name="groups"]').val() - + ';vmhost=' + $('#addKvm input[name="vmhost"]').val() + + ';groups=' + $('#addKvm input[name="groups"]').val() + + ';vmhost=' + $('#addKvm input[name="vmhost"]').val() + ';mgt=kvm;netboot=xnba;nodetype=osi;profile=compute'; $.ajax({ url : 'lib/cmd.php', @@ -614,16 +614,16 @@ function addKvmNode(){ msg : '' } }); - + // Remove loader $('#addKvm img').remove(); - + // Get return message var message = ''; for (var i in data.rsp) { message += data.rsp[i] + '
        '; } - + // Show return message if (message) $('#addKvm').prepend(createInfoBar(message)); @@ -633,7 +633,7 @@ function addKvmNode(){ /** * Update the provision node status - * + * * @param data Data returned from HTTP request */ function updateKVMProvisionStatus(data) { @@ -645,24 +645,24 @@ function updateKVMProvisionStatus(data) { var cmd = args[0].replace('cmd=', ''); // Get provision tab instance var inst = args[1].replace('out=', ''); - + // Get provision tab and status bar ID var statBarId = 'kvmProvisionStatBar' + inst; var tabId = 'kvmProvisionTab' + inst; - + var node = $('#' + tabId + ' input[name=node]').val(); - + /** * (2) Create virtual machine */ if (cmd == 'chdef') { // Write ajax response to status bar - var prg = writeRsp(rsp, ''); + var prg = writeRsp(rsp, ''); $('#' + statBarId).find('div').append(prg); // Get parameters var disk = $('#' + tabId + ' input[name=disk]').val() + $('#' + tabId + ' select[name=diskUnit]').val(); - + // Begin installation $.ajax( { url : 'lib/cmd.php', @@ -676,19 +676,19 @@ function updateKVMProvisionStatus(data) { success : updateKVMProvisionStatus }); - } - + } + /** * (3) Prepare node for boot */ if (cmd == 'mkvm') { // Write ajax response to status bar - var prg = writeRsp(rsp, ''); + var prg = writeRsp(rsp, ''); $('#' + statBarId).find('div').append(prg); - + // Get provision method var boot = $('#' + tabId + ' select[name=bootMethod]').val(); - + // Prepare node for boot $.ajax( { url : 'lib/cmd.php', @@ -703,14 +703,14 @@ function updateKVMProvisionStatus(data) { success : updateKVMProvisionStatus }); } - + /** * (4) Power on node */ if (cmd == 'nodeset') { - var prg = writeRsp(rsp, ''); + var prg = writeRsp(rsp, ''); $('#' + statBarId).find('div').append(prg); - + // Prepare node for boot $.ajax( { url : 'lib/cmd.php', @@ -725,16 +725,16 @@ function updateKVMProvisionStatus(data) { success : updateKVMProvisionStatus }); } - + /** * (5) Done */ else if (cmd == 'rpower') { // Write ajax response to status bar - var prg = writeRsp(rsp, ''); + var prg = writeRsp(rsp, ''); $('#' + statBarId).find('div').append(prg); $('#' + statBarId).find('img').remove(); - + // If installation was successful if (prg.html().indexOf('Error') == -1) { $('#' + statBarId).find('div').append('
        It will take several minutes before the nodes are up and ready. Use rcons to monitor the status of the install.
        '); diff --git a/xCAT-UI/js/custom/zvm.js b/xCAT-UI/js/custom/zvm.js index 98e1311d6..9d6525481 100644 --- a/xCAT-UI/js/custom/zvm.js +++ b/xCAT-UI/js/custom/zvm.js @@ -166,7 +166,7 @@ zvmPlugin.prototype.loadServiceProvisionPage = function(tabId) { loadGoldenImages(imgCol); // Get zVM host names - if (!$.cookie('zvms')){ + if (!$.cookie('xcat_zvms')){ $.ajax( { url : 'lib/srv_cmd.php', dataType : 'json', @@ -669,7 +669,7 @@ zvmPlugin.prototype.loadClonePage = function(node, nodeOS, nodeArch) { var groupLabel = $(''); var groupInput = $(''); groupInput.one('focus', function(){ - var groupNames = $.cookie('groups'); + var groupNames = $.cookie('xcat_groups'); if (groupNames) { // Turn on auto complete $(this).autocomplete({ @@ -704,7 +704,7 @@ zvmPlugin.prototype.loadClonePage = function(node, nodeOS, nodeArch) { } // Get list of disk pools var temp = hcp.split('.'); - var diskPools = $.cookie(temp[0] + 'diskpools'); + var diskPools = $.cookie('xcat_' + temp[0] + 'diskpools'); // Create disk pool input var poolDiv = $('
        '); @@ -992,7 +992,7 @@ zvmPlugin.prototype.loadInventory = function(data) { // Get node var node = args[1].replace('node=', ''); // Clear any existing cookie - $.cookie(node + 'processes', null); + $.cookie('xcat_' + node + 'processes', null, {path: '/xcat', secure:true }); // Remove loader $('#' + tabId).find('img').remove(); @@ -1127,7 +1127,7 @@ zvmPlugin.prototype.loadInventory = function(data) { // Start off an ajax request to save the zhcp node name // in a cookie for possible later use by addNic dialog var hcpHostname = attrs['hcp']; - if (!$.cookie(node+'_hcpnodename')){ + if (!$.cookie('xcat_' + node+'_hcpnodename')){ $.ajax( { url : 'lib/cmd.php', dataType : 'json', @@ -2310,7 +2310,7 @@ zvmPlugin.prototype.addNode = function() { * @param tgtNode Targets to migrate */ zvmPlugin.prototype.loadMigratePage = function(tgtNode, fromhcp) { - var hosts = $.cookie('zvms').split(','); + var hosts = $.cookie('xcat_zvms').split(','); var radio, zvmBlock, args; var zvms = new Array(); var hcp = new Object(); diff --git a/xCAT-UI/js/custom/zvmUtils.js b/xCAT-UI/js/custom/zvmUtils.js index 33926ad27..3ff044834 100644 --- a/xCAT-UI/js/custom/zvmUtils.js +++ b/xCAT-UI/js/custom/zvmUtils.js @@ -124,7 +124,7 @@ function loadHcpInfo(data) { if (userEntry[0].indexOf('Failed') < 0) { if (hcp) { // If there is no cookie for the disk pool names - if (!$.cookie(hcp + 'diskpools') || $.cookie(hcp + 'diskpools') === null) { + if (!$.cookie('xcat_' + hcp + 'diskpools') || $.cookie('xcat_' + hcp + 'diskpools') === null) { if (nodeInfoBar !== null) { nodeInfoBar.append("
        Finding pools and networks..."); findingPools = 1; @@ -152,7 +152,7 @@ function loadHcpInfo(data) { } // If there is no cookie for the zFCP pool names - if (!$.cookie(hcp + 'zfcppools') || $.cookie(hcp + 'zfcppools') === null) { + if (!$.cookie('xcat_' + hcp + 'zfcppools') || $.cookie('xcat_' + hcp + 'zfcppools') === null) { if (nodeInfoBar !== null) { if (findingPools = 0) { @@ -183,7 +183,7 @@ function loadHcpInfo(data) { } // If there is no cookie for the network names - if (!$.cookie(hcp + 'networks') || $.cookie(hcp + 'networks') === null) { + if (!$.cookie('xcat_' + hcp + 'networks') || $.cookie('xcat_' + hcp + 'networks') === null) { if (nodeInfoBar !== null) { if (findingPools = 0) { @@ -374,13 +374,13 @@ function loadUserEntry(data) { */ function incrementNodeProcess(node) { // Get current processes - var procs = $.cookie(node + 'processes'); + var procs = $.cookie('xcat_' + node + 'processes'); if (procs) { // One more process procs = parseInt(procs) + 1; - $.cookie(node + 'processes', procs); + $.cookie('xcat_' + node + 'processes', procs); } else { - $.cookie(node + 'processes', 1); + $.cookie('xcat_' + node + 'processes', 1); } } @@ -517,7 +517,7 @@ function updateZProvisionNewStatus(data) { // Set cookie for number of disks var diskRows = $('#' + tabId + ' table:eq(0):visible tbody tr'); - $.cookie('disks2add' + out2Id, diskRows.length); + $.cookie('xcat_disks2add' + out2Id, diskRows.length, {path: '/xcat', secure:true }); if (diskRows.length > 0) { for (var i = 0; i < diskRows.length; i++) { var diskArgs = diskRows.eq(i).find('td'); @@ -558,7 +558,7 @@ function updateZProvisionNewStatus(data) { // Set cookie for number of zFCP devices var zfcpRows = $('#' + tabId + ' table:eq(1):visible tbody tr'); - $.cookie('zfcp2add' + out2Id, zfcpRows.length); + $.cookie('xcat_zfcp2add' + out2Id, zfcpRows.length, {path: '/xcat', secure:true }); if (zfcpRows.length > 0) { for ( var i = 0; i < zfcpRows.length; i++) { var diskArgs = zfcpRows.eq(i).find('td'); @@ -581,10 +581,16 @@ function updateZProvisionNewStatus(data) { var args = '--addzfcp;' + pool + ';' + address + ';' + loaddev + ';' + size; if (tag && tag != "null") { args += ';' + tag; + } else { + args += ';'; } if (portName && tag != "null") { args += ';' + portName; + } else { + args += ';'; } if (unitNo && tag != "null") { args += ';' + unitNo; + } else { + args += ';'; } // Attach zFCP device to node @@ -625,19 +631,19 @@ function updateZProvisionNewStatus(data) { } else { // Set cookie for number of disks // One less disk to add - var disks2add = $.cookie('disks2add' + out2Id); + var disks2add = $.cookie('xcat_disks2add' + out2Id); if (lastCmd == 'chvm-disk') { if (disks2add > 0) { disks2add--; - $.cookie('disks2add' + out2Id, disks2add); + $.cookie('xcat_disks2add' + out2Id, disks2add, {path: '/xcat', secure:true }); } } - var zfcp2add = $.cookie('zfcp2add' + out2Id); + var zfcp2add = $.cookie('xcat_zfcp2add' + out2Id); if (lastCmd == 'chvm-zfcp') { if (zfcp2add > 0) { zfcp2add--; - $.cookie('zfcp2add' + out2Id, zfcp2add); + $.cookie('xcat_zfcp2add' + out2Id, zfcp2add, {path: '/xcat', secure:true }); } } @@ -887,10 +893,10 @@ function updateZNodeStatus(data) { var rsp = data.rsp; // Get cookie for number processes performed against this node - var actions = $.cookie(node + 'processes'); + var actions = $.cookie('xcat_' + node + 'processes'); // One less process actions = actions - 1; - $.cookie(node + 'processes', actions); + $.cookie('xcat_' + node + 'processes', actions, {path: '/xcat', secure:true }); if (actions < 1) { // Hide loader when there are no more processes @@ -1116,7 +1122,7 @@ function getZResources(data) { } // Set hardware control point cookie - $.cookie('hcp', hcps); + $.cookie('xcat_hcp', hcps, {path: '/xcat', secure:true }); // Delete loader $('#' + tabId).find('img[src="images/loader.gif"]').remove(); @@ -1137,10 +1143,10 @@ function getZResources(data) { // Create a array for hardware control points var hcps = new Array(); - if ($.cookie('hcp').indexOf(',') > -1) { - hcps = $.cookie('hcp').split(','); + if ($.cookie('xcat_hcp').indexOf(',') > -1) { + hcps = $.cookie('xcat_hcp').split(','); } else { - hcps.push($.cookie('hcp')); + hcps.push($.cookie('xcat_hcp')); } // Query the disk pools for each hcp @@ -1185,10 +1191,10 @@ function getZResources(data) { // Create a array for hardware control points var hcps = new Array(); - if ($.cookie('hcp').indexOf(',') > -1) { - hcps = $.cookie('hcp').split(','); + if ($.cookie('xcat_hcp').indexOf(',') > -1) { + hcps = $.cookie('xcat_hcp').split(','); } else { - hcps.push($.cookie('hcp')); + hcps.push($.cookie('xcat_hcp')); } @@ -1235,10 +1241,10 @@ function getZResources(data) { // Create a array for hardware control points var hcps = new Array(); - if ($.cookie('hcp').indexOf(',') > -1) { - hcps = $.cookie('hcp').split(','); + if ($.cookie('xcat_hcp').indexOf(',') > -1) { + hcps = $.cookie('xcat_hcp').split(','); } else { - hcps.push($.cookie('hcp')); + hcps.push($.cookie('xcat_hcp')); } // Query the networks for each @@ -1442,7 +1448,7 @@ function openAddProcDialog(node) { */ function openAddDiskDialog(node, hcp) { // Get list of disk pools - var cookie = $.cookie(hcp + 'diskpools'); + var cookie = $.cookie('xcat_' + hcp + 'diskpools'); var pools = new Array(); if (cookie) { pools = cookie.split(','); @@ -1605,7 +1611,7 @@ function openAddDiskDialog(node, hcp) { */ function openAddZfcpDialog(node, hcp, zvm) { // Get list of disk pools - var cookie = $.cookie(hcp + 'zfcppools'); + var cookie = $.cookie('xcat_' + hcp + 'zfcppools'); var pools = new Array(); if (cookie) { pools = cookie.split(','); @@ -2492,8 +2498,8 @@ function openAddScsi2SystemDialog(hcp) { var fcpWwpn = $(''); devPathRow.append(fcpWwpn); - if ($.cookie('zvms')) { - zvms = $.cookie('zvms').split(','); + if ($.cookie('xcat_zvms')) { + zvms = $.cookie('xcat_zvms').split(','); var zvm; for (var i in zvms) { if( !zvms[i] || 0 === zvms[i].length) continue; @@ -2807,7 +2813,7 @@ function openAddNicDialog(node, hcp) { // Get the hcp node name for the node // Should be in a cookie, else just take first part of hostname - var hcpNode = $.cookie(node+'_hcpnodename'); + var hcpNode = $.cookie('xcat_' + node+'_hcpnodename'); if (!hcpNode) { if (typeof console == "object"){ console.log("openAddNicDialog did not find cookie for <"+node+"_hcpnodename> Using first token in hostname"); @@ -2819,7 +2825,7 @@ function openAddNicDialog(node, hcp) { } // Get network names - var cookie = $.cookie(hcpNode + 'networks'); + var cookie = $.cookie('xcat_' + hcpNode + 'networks'); var networks = new Array(); if (cookie) { networks = cookie.split(','); @@ -3772,14 +3778,14 @@ function removeNic(node, nic) { * @param data Data from HTTP request */ function setNetworkCookies(data) { - if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1) { + if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1 && data.rsp[0].indexOf("Error") == -1) { var node = data.msg; var networks = data.rsp[0].split(node + ': '); // Set cookie to expire in 60 minutes var exDate = new Date(); exDate.setTime(exDate.getTime() + (60 * 60 * 1000)); - $.cookie(node + 'networks', networks, { expires: exDate }); + $.cookie('xcat_' + node + 'networks', networks, { expires: exDate, path: '/xcat', secure:true }); } } @@ -3789,7 +3795,7 @@ function setNetworkCookies(data) { * @param data HTTP request data */ function getDiskPool(data) { - if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1 && data.rsp[0].indexOf("Invalid") == -1) { + if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1 && data.rsp[0].indexOf("Invalid") == -1 && data.rsp[0].indexOf("Error") == -1) { var hcp = data.msg; var pools = data.rsp[0].split(hcp + ': '); @@ -3854,9 +3860,10 @@ function getZfcpPool(data) { if (typeof console == "object"){ console.log("Entering getZfcpPool."); } - if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1 && data.rsp[0].indexOf("Invalid") == -1) { + if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1 && data.rsp[0].indexOf("Invalid") == -1 && data.rsp[0].indexOf("Error") == -1) { var hcp = data.msg; var pools = data.rsp[0].split(hcp + ': '); + zhcpQueryCountForZfcps = 0; // Get contents of each disk pool for (var i in pools) { pools[i] = jQuery.trim(pools[i]); @@ -3900,7 +3907,7 @@ function getZfcpPool(data) { * @param data HTTP request data */ function getNetwork(data) { - if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1 && data.rsp[0].indexOf("Invalid") == -1) { + if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1 && data.rsp[0].indexOf("Invalid") == -1 && data.rsp[0].indexOf("Error") == -1) { var hcp = data.msg; var networks = data.rsp[0].split(hcp + ': '); if (typeof console == "object"){ @@ -3962,7 +3969,7 @@ function loadDiskPoolTable(data) { var args, hcp, pool, stat, tmp; if (data && typeof data.rsp != "undefined") { // Do not continue if the call failed - if (!data.rsp.length && data.rsp[0].indexOf("Failed") > 0) { + if (!data.rsp.length && data.rsp[0].indexOf("Failed") > 0 && data.rsp[0].indexOf("Error") > 0) { return; } @@ -4065,10 +4072,10 @@ function loadDiskPoolTable(data) { // Create a array for hardware control points var hcps = new Array(); - if ($.cookie('hcp').indexOf(',') > -1) - hcps = $.cookie('hcp').split(','); + if ($.cookie('xcat_hcp').indexOf(',') > -1) + hcps = $.cookie('xcat_hcp').split(','); else - hcps.push($.cookie('hcp')); + hcps.push($.cookie('xcat_hcp')); zhcpQueryCountForDisks = hcps.length; // Query the disk pools for each @@ -4179,15 +4186,45 @@ function loadZfcpPoolTable(data) { } // Delete loader if last one var panelId = 'zfcpResource'; - if (!zhcpQueryCountForZfcps) { + if (zhcpQueryCountForZfcps <= 0) { $('#' + panelId).find('img[src="images/loader.gif"]').remove(); } var hcp2zvm = new Object(); var args, hcp, pool, tmp; + + // Resource tab ID + var info = $('#' + panelId).find('.ui-state-highlight'); + + // Is there any data passed? Process if some if (typeof data.rsp != "undefined") { - // Do not continue if the call failed - if (!data.rsp.length && data.rsp[0].indexOf("Failed") > 0) { + // Do not continue if no data to add + if (!data.rsp.length) { + if (typeof console == "object"){ + console.log("data.rsp.length is 0."); + } + // If there is no info bar, create info bar + var msgError = '
        Unexpected, no data returned on the lsvm --zfcppool call.'; + if (!info.length) { + info = createInfoBar(msgError); + $('#' + panelId).append(info); + } else { + info.append(msgError); + } + return; + } + if (data.rsp[0].indexOf("Failed") > 0 || data.rsp[0].indexOf("Error") > 0) { + if (typeof console == "object"){ + console.log("Failed on lsvm call for --zfcppool"); + } + var msgError = '
        Error: Error on call to check zfcp pools: '+ data.rsp[0]; + // If there is no info bar, create info bar + if (!info.length) { + info = createInfoBar(msgError); + $('#' + panelId).append(info); + } else { + info.append(msgError); + } return; } @@ -4200,13 +4237,14 @@ function loadZfcpPoolTable(data) { tmp = data.rsp[0].split(hcp + ': '); } else { // Provide empty values so the table will be generated + if (typeof console == "object"){ + console.log("Creating empty zfcp pool table."); + } hcp = ''; pool = '' tmp = new Array(); } - // Resource tab ID - var info = $('#' + panelId).find('.ui-state-highlight'); // If there is no info bar, create info bar if (!info.length) { info = createInfoBar('Below are devices that are defined internally in the zFCP pools.'); @@ -4248,7 +4286,8 @@ function loadZfcpPoolTable(data) { tmp[i] = jQuery.trim(tmp[i]); var diskAttrs = tmp[i].split(','); diskAttrs[0] = diskAttrs[0].toLowerCase(); - var key = hcp2zvm[hcp] + '-' + pool + '-' + diskAttrs[2]; + // Key contains row data to be returned when the checkbox is selected + var key = hcp2zvm[hcp] + '-' + pool + '-' + diskAttrs[2] + '-' + diskAttrs[1]; dTable.fnAddData( [ '', hcp2zvm[hcp], pool, diskAttrs[0], diskAttrs[1], diskAttrs[2], diskAttrs[3], diskAttrs[4], diskAttrs[5], diskAttrs[6], diskAttrs[7] ]); } } @@ -4266,6 +4305,9 @@ function loadZfcpPoolTable(data) { // Delete disk from pool var removeLnk = $('Remove'); removeLnk.bind('click', function(event){ + if (typeof console == "object"){ + console.log("Remove button clicked for tableId:"+tableId); + } var disks = getNodesChecked(tableId); openRemoveZfcpFromPoolDialog(disks); }); @@ -4278,10 +4320,10 @@ function loadZfcpPoolTable(data) { // Create a array for hardware control points var hcps = new Array(); - if ($.cookie('hcp').indexOf(',') > -1) - hcps = $.cookie('hcp').split(','); + if ($.cookie('xcat_hcp').indexOf(',') > -1) + hcps = $.cookie('xcat_hcp').split(','); else - hcps.push($.cookie('hcp')); + hcps.push($.cookie('xcat_hcp')); // Query the disk pools for each zhcpQueryCountForZfcps = hcps.length; @@ -4643,7 +4685,11 @@ function openRemoveZfcpFromPoolDialog(devices2remove) { // Verify disks are in the same zFCP pool var devices = devices2remove.split(','); + if (typeof console == "object"){ + console.log("Entering openRemoveZfcpFromPoolDialog. Device to remove:<"+devices2remove+">"); + } var tmp, tgtPool, tgtHcp; + var tgtPort = ""; var tgtUnitNo = ""; for (var i in devices) { if( !devices[i] || 0 === devices[i].length) continue; @@ -4658,6 +4704,7 @@ function openRemoveZfcpFromPoolDialog(devices2remove) { tgtHcp = tmp[0]; // Assume it is just one zHCP. Otherwise, this cannot be done on multiple zHCPs. tgtUnitNo += tmp[2] + ","; + tgtPort = tmp[3]; } // Strip out last comma @@ -4673,7 +4720,7 @@ function openRemoveZfcpFromPoolDialog(devices2remove) { var pool = $('
        '); var unitNo = $('
        '); - var portName = $('
        '); + var portName = $('
        '); deleteDiskForm.append(system, pool, unitNo, portName); // Append options for hardware control points @@ -4760,7 +4807,9 @@ function openRemoveZfcpFromPoolDialog(devices2remove) { msg : dialogId }, - success : updateResourceDialog + success : function(data) { + updateResourceDialog(data); + } }); }, "Cancel": function() { @@ -4984,7 +5033,7 @@ function loadNetworkTable(data) { } // Get zVM host names - if (!$.cookie('zvms')) { + if (!$.cookie('xcat_zvms')) { $.ajax({ url : 'lib/cmd.php', dataType : 'json', @@ -5002,7 +5051,7 @@ function loadNetworkTable(data) { }); } - var zvms = $.cookie('zvms').split(','); + var zvms = $.cookie('xcat_zvms').split(','); var hcp2zvm = new Object(); var args, zvm, iHcp, tmp; for (var i in zvms) { @@ -5132,10 +5181,10 @@ function loadNetworkTable(data) { // Create a array for hardware control points var hcps = new Array(); - if ($.cookie('hcp').indexOf(',') > -1) - hcps = $.cookie('hcp').split(','); + if ($.cookie('xcat_hcp').indexOf(',') > -1) + hcps = $.cookie('xcat_hcp').split(','); else - hcps.push($.cookie('hcp')); + hcps.push($.cookie('xcat_hcp')); // Query networks zhcpQueryCountForNetworks = hcps.length; @@ -5206,7 +5255,7 @@ function connect2GuestLan(data) { $('#' + node + 'StatusBar').find('div').append(prg); // Continue if no errors found - if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1) { + if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1 && data.rsp[0].indexOf("Error") == -1) { // Connect NIC to Guest LAN $.ajax( { url : 'lib/cmd.php', @@ -5261,7 +5310,7 @@ function connect2VSwitch(data) { $('#' + node + 'StatusBar').find('div').append(prg); // Continue if no errors found - if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1) { + if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1 && data.rsp[0].indexOf("Error") == -1) { // Connect NIC to VSwitch $.ajax( { url : 'lib/cmd.php', @@ -5317,7 +5366,7 @@ function createZProvisionExisting(inst) { group.append(groupLabel); // Turn on auto complete for group - var groupNames = $.cookie('groups'); + var groupNames = $.cookie('xcat_groups'); if (groupNames) { // Split group names into an array var tmp = groupNames.split(','); @@ -5363,7 +5412,7 @@ function createZProvisionExisting(inst) { var osSelect = $(''); osSelect.append($('')); - var imageNames = $.cookie('imagenames').split(','); + var imageNames = $.cookie('xcat_imagenames').split(','); if (imageNames) { imageNames.sort(); for (var i in imageNames) { @@ -5542,7 +5591,7 @@ function createZProvisionNew(inst) { var groupInput = $(''); // Get groups on-focus groupInput.one('focus', function(){ - var groupNames = $.cookie('groups'); + var groupNames = $.cookie('xcat_groups'); if (groupNames) { // Turn on auto complete $(this).autocomplete({ @@ -5603,7 +5652,7 @@ function createZProvisionNew(inst) { }, success: function(data) { - if (data.rsp.length && (data.rsp[0].indexOf("Failed") > -1 || data.rsp[0].indexOf("Invalid") > -1) ) { + if (data.rsp.length && (data.rsp[0].indexOf("Failed") > -1 || data.rsp[0].indexOf("Invalid") > -1 || data.rsp[0].indexOf("Error") > -1) ) { // Remove the progress gif, since bailing out removeProvisionLoadingGif(provisionStatusBar); @@ -5711,7 +5760,7 @@ function createZProvisionNew(inst) { console.log("Looking for cookies from <" + zhcpToCheck + ">"); } - if (!$.cookie(zhcpToCheck + 'diskpools')) { + if (!$.cookie('xcat_' + zhcpToCheck + 'diskpools')) { // Get disk pools $.ajax({ url : 'lib/cmd.php', @@ -5732,7 +5781,7 @@ function createZProvisionNew(inst) { checkProvisionCallsDone(provisionStatusBar, ajaxCalls, "diskpoolnames"); } - if (!$.cookie(zhcpToCheck + 'zfcppools')) { + if (!$.cookie('xcat_' + zhcpToCheck + 'zfcppools')) { // Get zFCP pools $.ajax({ url : 'lib/cmd.php', @@ -5753,7 +5802,7 @@ function createZProvisionNew(inst) { checkProvisionCallsDone(provisionStatusBar, ajaxCalls, "zfcppoolnames"); } - if (!$.cookie(zhcpToCheck + 'userprofiles')) { + if (!$.cookie('xcat_' + zhcpToCheck + 'userprofiles')) { // Get zFCP pools $.ajax( { url : 'lib/cmd.php', @@ -5780,7 +5829,7 @@ function createZProvisionNew(inst) { var thisUserProfile = $('#' + thisTabId + ' select[name=userProfile]'); thisUserProfile.children().remove(); - var definedUserProfiles = $.cookie(zhcpToCheck + 'userprofiles').split(','); + var definedUserProfiles = $.cookie('xcat_' + zhcpToCheck + 'userprofiles').split(','); for (var i in definedUserProfiles) { if( !definedUserProfiles[i] || 0 === definedUserProfiles[i].length) continue; thisUserProfile.append(''); @@ -5789,7 +5838,7 @@ function createZProvisionNew(inst) { var thisNetwork = $('#' + thisTabId + ' select[name=network]'); thisNetwork.children().remove(); thisNetwork.append(''); // No profile option - var definedNetworks = $.cookie(zhcpToCheck + 'networks').split(','); + var definedNetworks = $.cookie('xcat_' + zhcpToCheck + 'networks').split(','); for (var i in definedNetworks) { if( !definedNetworks[i] || 0 === definedNetworks[i].length) continue; if (!jQuery.trim(definedNetworks[i])) @@ -5854,7 +5903,7 @@ function createZProvisionNew(inst) { var osSelect = $(''); osSelect.append($('')); - var imageNames = $.cookie('imagenames').split(','); + var imageNames = $.cookie('xcat_imagenames').split(','); if (imageNames) { imageNames.sort(); for (var i in imageNames) { @@ -5939,7 +5988,6 @@ function createZProvisionNew(inst) { '' + ''); var cpuSelect = $(''); + var zfcpTag = $(''); zfcpRow.append(zfcpTag); // Create device port name @@ -6399,6 +6447,35 @@ function createZProvisionNew(inst) { ready = false; } + // If this is basic mode, check for a disk with IPL radio button and zFCP with LOADDEV button + // Cannot have both. (In advanced mode they create the directory entries.) + if (hwTabIndex == 0) { + // Find a device to be IPLed? + var ECKD_FBA_diskRows = $('#' + thisTabId + ' table:eq(0):visible tbody tr'); + var iplSet = 0; + for (var i = 0; i < ECKD_FBA_diskRows.length; i++) { + var diskArgs = ECKD_FBA_diskRows.eq(i).find('td'); + if (diskArgs.eq(7).find('input').attr("checked") === true) { + iplSet = 1; + break; + } + } + + // Check if zFCP loaddev checked + var zfcpRows = $('#' + thisTabId + ' table:eq(1):visible tbody tr'); + if (zfcpRows.length > 0) { + for ( var i = 0; i < zfcpRows.length; i++) { + var diskArgs = zfcpRows.eq(i).find('td'); + // This is either true or false + var loaddev = diskArgs.eq(7).find('input').attr('checked'); + if (loaddev && iplSet) { + errMsg = errMsg + 'You cannot have both disk IPL and zFCP LOADDEV, can only IPL one device.
        '; + ready = false; + } + } + } + } + // If inputs are valid, ready to provision if (ready) { // Generate user directory entry if basic tab is selected @@ -6641,13 +6718,13 @@ function checkProvisionCallsDone(provisionStatBar, table, finishedKey) { */ function loadzVMs(col) { // Get group names and description and append to group column - if (!$.cookie('zvms')) { + if (!$.cookie('xcat_zvms')) { var infoBar = createInfoBar('No selectable z/VM available'); col.append(infoBar); return; } - var zNames = $.cookie('zvms').split(','); + var zNames = $.cookie('xcat_zvms').split(','); var radio, zBlock, args, zvm, hcp; for (var i in zNames) { @@ -6689,13 +6766,13 @@ function loadzVMs(col) { */ function loadSrvGroups(col) { // Get group names and description and append to group column - if (!$.cookie('srv_groups')) { + if (!$.cookie('xcat_srv_groups')) { var infoBar = createInfoBar('No selectable group available'); col.append(infoBar); return; } - var groupNames = $.cookie('srv_groups').split(','); + var groupNames = $.cookie('xcat_srv_groups').split(','); var groupBlock, radio, args, name, ip, hostname, desc; for (var i in groupNames) { @@ -6739,13 +6816,13 @@ function loadSrvGroups(col) { */ function loadOSImages(col) { // Get group names and description and append to group column - if (!$.cookie('srv_imagenames')) { + if (!$.cookie('xcat_srv_imagenames')) { var infoBar = createInfoBar('No selectable image available'); col.append(infoBar); return; } - var imgNames = $.cookie('srv_imagenames').split(','); + var imgNames = $.cookie('xcat_srv_imagenames').split(','); var imgBlock, radio, args, name, desc; for (var i in imgNames) { @@ -6790,13 +6867,13 @@ function loadOSImages(col) { */ function loadGoldenImages(col) { // Get group names and description and append to group column - if (!$.cookie('srv_goldenimages')) { + if (!$.cookie('xcat_srv_goldenimages')) { var infoBar = createInfoBar('No selectable master copies available'); col.append(infoBar); return; } - var imgNames = $.cookie('srv_goldenimages').split(','); + var imgNames = $.cookie('xcat_srv_goldenimages').split(','); var imgBlock, radio, args, name, desc; for (var i in imgNames) { @@ -6844,7 +6921,7 @@ function loadGoldenImages(col) { * @param data Data from HTTP request */ function setzVMCookies(data) { - if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1) { + if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1 && data.rsp[0].indexOf("Error") == -1) { var zvms = new Array(); var hosts = data.rsp[0].split("\n"); for ( var i = 0; i < hosts.length; i++) { @@ -6859,7 +6936,7 @@ function setzVMCookies(data) { // Set cookie to expire in 60 minutes var exDate = new Date(); exDate.setTime(exDate.getTime() + (60 * 60 * 1000)); - $.cookie('zvms', zvms, { expires: exDate }); + $.cookie('xcat_zvms', zvms, { expires: exDate, path: '/xcat', secure:true }); } } @@ -6869,7 +6946,7 @@ function setzVMCookies(data) { * @param data Data from HTTP request */ function setGoldenImagesCookies(data) { - if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1) { + if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1 && data.rsp[0].indexOf("Error") == -1) { var copies = new Array(); var tmp = data.rsp[0].split(","); for ( var i = 0; i < tmp.length; i++) { @@ -6881,7 +6958,7 @@ function setGoldenImagesCookies(data) { // Set cookie to expire in 60 minutes var exDate = new Date(); exDate.setTime(exDate.getTime() + (60 * 60 * 1000)); - $.cookie('srv_goldenimages', copies, { expires: exDate }); + $.cookie('xcat_srv_goldenimages', copies, { expires: exDate, path: '/xcat', secure:true }); } } @@ -6891,7 +6968,7 @@ function setGoldenImagesCookies(data) { * @param data Data from HTTP request */ function setDiskPoolCookies(data) { - if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1) { + if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1 && data.rsp[0].indexOf("Error") == -1) { var node = data.msg; var pools = data.rsp[0].split(node + ": "); var pools2 = []; @@ -6904,7 +6981,7 @@ function setDiskPoolCookies(data) { // Set cookie to expire in 60 minutes var exDate = new Date(); exDate.setTime(exDate.getTime() + (60 * 60 * 1000)); - $.cookie(node + 'diskpools', pools2, { expires: exDate }); + $.cookie('xcat_' + node + 'diskpools', pools2, { expires: exDate, path: '/xcat', secure:true }); } } @@ -6914,7 +6991,7 @@ function setDiskPoolCookies(data) { * @param data Data from HTTP request */ function setZfcpPoolCookies(data) { - if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1) { + if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1 && data.rsp[0].indexOf("Error") == -1) { var node = data.msg; var pools = data.rsp[0].split(node + ': '); var pools2 = []; @@ -6927,7 +7004,7 @@ function setZfcpPoolCookies(data) { // Set cookie to expire in 60 minutes var exDate = new Date(); exDate.setTime(exDate.getTime() + (60 * 60 * 1000)); - $.cookie(node + 'zfcppools', pools2, { expires: exDate }); + $.cookie('xcat_' + node + 'zfcppools', pools2, { expires: exDate, path: '/xcat', secure:true }); } } @@ -6941,7 +7018,7 @@ function setzHcpCookies(zhcps) { // Set cookie to expire in 60 minutes var exDate = new Date(); exDate.setTime(exDate.getTime() + (60 * 60 * 1000)); - $.cookie('zhcps', zhcps, { expires: exDate }); + $.cookie('xcat_zhcps', zhcps, { expires: exDate, path: '/xcat', secure:true }); } } @@ -6951,7 +7028,7 @@ function setzHcpCookies(zhcps) { * @param data Data from HTTP request */ function setUserProfilesCookies(data) { - if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1) { + if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1 && data.rsp[0].indexOf("Error") == -1) { var node = data.msg; var profiles = data.rsp[0].split(node + ': '); var profiles2 = []; @@ -6964,7 +7041,7 @@ function setUserProfilesCookies(data) { // Set cookie to expire in 60 minutes var exDate = new Date(); exDate.setTime(exDate.getTime() + (60 * 60 * 1000)); - $.cookie(node + 'userprofiles', profiles2, { expires: exDate }); + $.cookie('xcat_' + node + 'userprofiles', profiles2, { expires: exDate, path: '/xcat', secure:true }); } } @@ -7025,7 +7102,7 @@ function configProfilePanel(panelId) { table.init(['', 'Profile', 'Disk pool', 'Disk size', 'Directory entry']); // Insert profiles into table - var profiles = $.cookie('profiles').split(','); + var profiles = $.cookie('xcat_profiles').split(','); profiles.push('default'); // Add default profile for (var i in profiles) { if (profiles[i]) { @@ -7245,7 +7322,7 @@ function profileDialog() { // Insert profiles into select var profileSelect = $(''); - var profiles = $.cookie('profiles').split(','); + var profiles = $.cookie('xcat_profiles').split(','); profiles.push('default'); // Add default profile for (var i in profiles) { if (profiles[i]) { @@ -7420,7 +7497,7 @@ function editProfileDialog(profile, pool, size, entry) { // Insert profiles into select var profileSelect = $(''); - var profiles = $.cookie('profiles').split(','); + var profiles = $.cookie('xcat_profiles').split(','); profiles.push('default'); // Add default profile for (var i in profiles) { if (profiles[i]) { @@ -7541,7 +7618,7 @@ function editProfileDialog(profile, pool, size, entry) { */ function getHcpZvmHash() { // Get zVM host names - if (!$.cookie('zvms')) { + if (!$.cookie('xcat_zvms')) { $.ajax({ url : 'lib/cmd.php', dataType : 'json', @@ -7559,7 +7636,7 @@ function getHcpZvmHash() { }); } - var zvms = $.cookie('zvms').split(','); + var zvms = $.cookie('xcat_zvms').split(','); var hcp2zvm = new Object(); var args, zvm, iHcp, tmp; for (var i in zvms) { @@ -7656,6 +7733,20 @@ function updateUserEntry(tabId) { } } + // Check if zFCP loaddev checked, if so ipl the fcp card + var zfcpRows = $('#' + tabId + ' table:eq(1):visible tbody tr'); + if (zfcpRows.length > 0) { + for ( var i = 0; i < zfcpRows.length; i++) { + var diskArgs = zfcpRows.eq(i).find('td'); + var address = diskArgs.eq(1).find('input').val(); + // This is either true or false + var loaddev = diskArgs.eq(7).find('input').attr('checked'); + if (loaddev) { + ipl = address; + } + } + } + // Only update directory entry if the basic tab is selected var inst = tabId.replace('zvmProvisionTab', ''); var hwTabIndex = $("#hwConfig" + inst).tabs('option', 'selected'); @@ -7699,6 +7790,20 @@ function updateUserEntry(tabId) { } } + // Check if zFCP loaddev checked, if so ipl the fcp card + var zfcpRows = $('#' + tabId + ' table:eq(1):visible tbody tr'); + if (zfcpRows.length > 0) { + for ( var i = 0; i < zfcpRows.length; i++) { + var diskArgs = zfcpRows.eq(i).find('td'); + var address = diskArgs.eq(1).find('input').val(); + // This is either true or false + var loaddev = diskArgs.eq(7).find('input').attr('checked'); + if (loaddev) { + ipl = address; + } + } + } + // Only update directory entry if the basic tab is selected var inst = tabId.replace('zvmProvisionTab', ''); var hwTabIndex = $("#hwConfig" + inst).tabs('option', 'selected'); @@ -7742,6 +7847,20 @@ function updateUserEntry(tabId) { } } + // Check if zFCP loaddev checked, if so ipl the fcp card + var zfcpRows = $('#' + tabId + ' table:eq(1):visible tbody tr'); + if (zfcpRows.length > 0) { + for ( var i = 0; i < zfcpRows.length; i++) { + var diskArgs = zfcpRows.eq(i).find('td'); + var address = diskArgs.eq(1).find('input').val(); + // This is either true or false + var loaddev = diskArgs.eq(7).find('input').attr('checked'); + if (loaddev) { + ipl = address; + } + } + } + // Only update directory entry if the basic tab is selected var inst = tabId.replace('zvmProvisionTab', ''); var hwTabIndex = $("#hwConfig" + inst).tabs('option', 'selected'); @@ -7836,6 +7955,10 @@ function generateUserEntry(userId, password, memory, privilege, profile, cpuCoun userDirectoryEntry += "SPOOL 000D 2540 PUNCH A\n"; userDirectoryEntry += "SPOOL 000E 1403 A\n"; + if (typeof console == "object"){ + console.log("Exiting generateUserEntry. Directory created:"+userDirectoryEntry); + } + return userDirectoryEntry; } @@ -7936,7 +8059,7 @@ function getNetworkDetails(hcpNode, vswitchname, hashId, tabId) { console.log("getNetworkDetails. creating new hash[[]] table!!" + "hashindex<" + hashindex + ">" ); } } - if (data.rsp.length && (data.rsp[0].indexOf("Failed") > -1 || (foundInvalid == 1) ) ) { + if (data.rsp.length && (data.rsp[0].indexOf("Failed") > -1 || (foundInvalid == 1) || data.rsp[0].indexOf("Error") > -1 ) ) { if (typeof console == "object") { console.log("getNetworkDetails. failure getting the network data for " + hcpNode + " network "+ vswitchname); } @@ -7993,7 +8116,7 @@ function getNetworkDetails(hcpNode, vswitchname, hashId, tabId) { * @param data Data from HTTP request */ function setNodeZhcpNodename(data) { - if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1) { + if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1 && data.rsp[0].indexOf("Error") == -1) { var savedTokens = data.msg.split(';'); var node = savedTokens[0]; var hcphostname = savedTokens[1]; @@ -8010,7 +8133,7 @@ function setNodeZhcpNodename(data) { // Set cookie to expire in 60 minutes var exDate = new Date(); exDate.setTime(exDate.getTime() + (60 * 60 * 1000)); - $.cookie(node+'_hcpnodename', nodename, { expires: exDate }); + $.cookie('xcat_' + node+'_hcpnodename', nodename, { expires: exDate, path: '/xcat', secure:true }); } } } diff --git a/xCAT-UI/js/help/help.js b/xCAT-UI/js/help/help.js index a9b8ce454..694198e51 100644 --- a/xCAT-UI/js/help/help.js +++ b/xCAT-UI/js/help/help.js @@ -1,9 +1,29 @@ /** - * Load the help page + * Global variables + */ +var helpTab; // Help tabs +var ivpChoices = new Array; +var ivpChoiceValues = new Array; +var selectInfo = new Object(); + + +/** + * Load the help page and create the tabs. */ function loadHelpPage(){ + createHelpTab(); + createVerifyXCATTab(); +} + +/** + * Create the Help Tab + * + * @return Tab object + */ +function createHelpTab(){ // Create help tab var tab = new Tab(); + setHelpTab(tab); tab.init(); $('#content').append(tab.object()); @@ -28,4 +48,693 @@ function loadHelpPage(){ '' + ''); tab.add('helpTab', 'Help', helpForm, false); -} \ No newline at end of file +} + + +/** + * Create the Verify xCAT Tab + * + * @return Tab object + */ +function createVerifyXCATTab() { + var comments = 'Description of the IVP run'; + var ivpEnabled = 'checked'; + var ivpDisabled = ''; + + // Get the tab + var tab = getHelpTab(); + var fs, legend; + + // Generate new tab ID + var instance = 0; + var newTabId = 'verifyXCATTab' + instance; + while ($('#' + newTabId).length) { + // If one already exists, generate another one + instance = instance + 1; + newTabId = 'verifyXCATTab' + instance; + } + + // Build the list of IVPs in the table + readIvpTable(); + + // Create info bar and status bar + var infoBar = createInfoBar( 'Run or schedule Installation Verification Procedures to verify:
        ' + + '-xCAT MN/ZHCP Environment, or
        ' + + '-xCAT MN/ZHCP and OpenStack Environment.' ); + + var statBarId = 'verifyXCATStatusBar' + instance; + var statBar = createStatusBar(statBarId).hide(); + var loader = createLoader( '' ); + statBar.find('div').append( loader ); + + // Create the verify form and put info and status bars on the form. + var verifyXCATForm = $( '
        ' ); + verifyXCATForm.append( infoBar, statBar ); + + // Create 'Create a Verify xCAT' fieldset + fs = $( '
        ' ); + fs.append( $( 'Verify:' )); + fs.append( $( '
        ' + + '' + + '
        ' )); + fs.append( $('
        Type of IVP Run:
        ')); + fs.append( $('
        Basic IVP: xCAT MN/ZHCP Verification
        ' )); + fs.append( $('
        Full IVP: xCAT MN/ZHCP and OpenStack Verification
        ' )); + fs.append( $('
        Basic and Full IVP Parameters:
        ')); + fs.append( $('
        ' )); + fs.append( $('
        ' )); + fs.append( $('
        Full IVP Parameters:
        ')); + fs.append( $('
        ' )); + fs.append( $('
        ' )); + fs.append( $('
        ' )); + fs.append( $('
        Automated IVP Parameters:
        ')); + fs.append( $('
        ' )); + fs.append( '
        '+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + '
        ScheduleEvery hour
        Midnight1 am2 am3 am4 am5 am
        6 am7 am8 am9 am10 am11 am
        Noon1 pm2 pm3 pm4 pm5 pm
        6 pm7 pm8 pm9 pm10 pm11 pm
        '+ + '
        '); + fs.append( $('
        Disable or Enable the IVP Run:
        ')); + fs.append( $('
        Enabled to be run periodically
        ' )); + fs.append( $('
        Disabled from running periodically
        ' )); + verifyXCATForm.append( fs ); + + var verifyBtn = createButton( 'Run an IVP Now' ); + verifyBtn.click(function() { + var driveFunction = 1; + var argList = ''; + + // Remove any warning messages + $(this).parents('.ui-tabs-panel').find('.ui-state-error').remove(); + + var runType = $(this).parent().find('input[name="runType"]:checked').val(); + if ( runType == 'verifyBasic' ) { + argList += '||--basicivp'; + } else if ( runType == 'verifyOpenStack' ) { + argList += '||--fullivp'; + var openstackIP = $(this).parent().find('input[name=openstackIP]').val(); + if ( openstackIP != '' ) { + argList += '||--openstackip ' + openstackIP; + } else { + // Show an information message. + $('#' + statBarId).find('div').append( + 'You did not specify the IP address of the OpenStack system. The IVP ' + + 'will use the IP address of the system running the xCAT management node as ' + + 'the OpenStack IP address.
        '); + } + var openstackUser = $(this).parent().find('input[name=openstackUser]').val(); + if ( openstackUser != '' ) { + argList += '||--openstackuser ' + hexEncode( openstackUser ); + } + var prepParms = $(this).parent().find('input[name=prepParms]').val(); + if ( prepParms != '' ) { + argList += '||--prepparms ' + hexEncode( prepParms ); + } + } else { + // Show warning message + var warn = createWarnBar('You did not select a basic or full IVP.'); + warn.prependTo($(this).parents('.ui-tabs-panel')); + driveFunction = 0; + } + var orchParms = $(this).parent().find('input[name=orchParms]').val(); + if ( orchParms != '' ) { + argList += '||--orchparms ' + hexEncode( orchParms ); + } + var mainParms = $(this).parent().find('input[name=mainParms]').val(); + if ( mainParms != '' ) { + argList += '||--zxcatparms ' + hexEncode( mainParms ); + } + argList += '||end'; + + if ( driveFunction == 1 ) { + $('#' + statBarId).find('div').append( 'Invoking verifynode to run the IVP.
        ' ); + $('#' + statBarId).find('img').show(); + $.ajax( { + url : 'lib/cmd.php', + dataType : 'json', + data : { + cmd : 'webrun', + tgt : '', + args : 'verifynode '+ argList, + msg : 'out=' + statBarId + ';cmd=verifynode' + }, + success : updateStatusBar + }); + + // Show status bar + statBar.show(); + } + }); + verifyXCATForm.append( verifyBtn ); + + var scheduleBtn = createButton( 'Schedule an IVP Run' ); + scheduleBtn.click(function() { + var driveFunction = 1; + var argList = ''; + + // Remove any warning messages + $(this).parents('.ui-tabs-panel').find('.ui-state-error').remove(); + + var ivpId = $(this).parent().find('select[name=ivpId]').val(); + if ( ivpId != 'NEW' ) { + argList += '||--id ' + ivpId; + } + var runType = $(this).parent().find('input[name="runType"]:checked').val(); + if ( runType == 'verifyBasic' ) { + argList += '||--type basicivp'; + } else if ( runType == 'verifyOpenStack' ) { + argList += '||--type fullivp'; + var openstackIP = $(this).parent().find('input[name=openstackIP]').val(); + if ( openstackIP != '' ) { + argList = argList + '||--openstackip ' + openstackIP; + } else { + // Show an information message. + $('#' + statBarId).find('div').append( + 'You did not specify the IP address of the OpenStack system. The IVP ' + + 'will use the IP address of the system running the xCAT management node as ' + + 'the OpenStack IP address.
        '); + } + var openstackUser = $(this).parent().find('input[name=openstackUser]').val(); + if ( openstackUser != '' ) { + argList += '||--openstackuser ' + hexEncode( openstackUser ); + } else { + argList += '||--openstackuser \'\''; + } + var prepParms = $(this).parent().find('input[name=prepParms]').val(); + if ( prepParms != '' ) { + argList += '||--prepparms ' + hexEncode( prepParms ); + } else { + argList += '||--prepparms \'\''; + } + } else { + // Show warning message + var warn = createWarnBar('You did not select a basic or full IVP.'); + warn.prependTo($(this).parents('.ui-tabs-panel')); + driveFunction = 0; + } + var checkboxes = $(this).parent().find('input[name="ivpSchedule"]:checked'); + var ivpSchedule = ""; + for ( var i=0, n=checkboxes.length; i' ); + $('#' + statBarId).find('img').show(); + $.ajax( { + url : 'lib/cmd.php', + dataType : 'json', + data : { + cmd : 'webrun', + tgt : '', + args : 'verifynode '+ argList, + msg : 'out=' + statBarId + ';cmd=verifynode' + }, + success : function(data) { + updateStatusBar(data); + readIvpTable(); + } + }); + + // Show status bar + statBar.show(); + } + }); + verifyXCATForm.append( scheduleBtn ); + + var removeBtn = createButton( 'Remove an IVP Run' ); + removeBtn.click(function() { + var driveFunction = 1; + var argList = ''; + + // Remove any warning messages + $(this).parents('.ui-tabs-panel').find('.ui-state-error').remove(); + + var ivpId = $(this).parent().find('select[name=ivpId]').val(); + if ( ivpId != 'NEW' ) { + argList = '||--remove' + '||--id ' + ivpId + '||end'; + } else { + // Show warning message + var warn = createWarnBar('You did not select the ID of an existing run.'); + warn.prependTo($(this).parents('.ui-tabs-panel')); + driveFunction = 0; + } + + if ( driveFunction == 1 ) { + $('#' + statBarId).find('div').append( 'Invoking verifynode to remove the IVP.
        ' ); + $('#' + statBarId).find('img').show(); + $.ajax( { + url : 'lib/cmd.php', + dataType : 'json', + data : { + cmd : 'webrun', + tgt : '', + args : 'verifynode '+ argList, + msg : 'out=' + statBarId + ';cmd=verifynode' + }, + success : function(data) { + updateStatusBar(data); + readIvpTable(); + } + }); + + // Show status bar + statBar.show(); + } + }); + verifyXCATForm.append( removeBtn ); + + tab.add( newTabId, 'Verify xCAT', verifyXCATForm, false ); + +} + + +/** + * Get node tab + * + * @return Tab object + */ +function getHelpTab() { + return helpTab; +} + + +/** + * Drive the tabdump API to obtain the scheduled IVP information. + * + * @param None. + */ +function readIvpTable() { + // Get IVP information + if (!$.cookie('xcat_ivpinfo')){ + $.ajax( { + url : 'lib/cmd.php', + dataType : 'json', + data : { + cmd : 'tabdump', + tgt : '', + args : 'zvmivp', + msg : '' + }, + + success : setArrays + }); + } +} + + +/** + * Decodes a printable hex string back into the javascript + * unicode string that it represents. + * + * @param hexVal Printable hex string to convert + * back into its original javascript string form. + */ +hexDecode = function( hexVal ){ + var result = ""; + + if ( hexVal.match("^HexEncoded:") ) { + hexVal = hexVal.replace( 'HexEncoded:', '' ); + var hexes = hexVal.match(/.{1,4}/g) || []; + for( var i = 0; i < hexes.length; i++ ) { + result += String.fromCharCode( parseInt( hexes[i], 16 ) ); + } + } else { + result = hexVal; + } + + return result; +} + + +/** + * Encode a string into printable hex. This avoids + * an issues with escaping quotes or handling unicode. + * + * @param str String to encode into printable hex. + */ +function hexEncode( str ){ + var hex; + + var result = 'HexEncoded:'; + for (var i=0; i < str.length; i++) { + hex = str.charCodeAt(i).toString(16); + result += ("000"+hex).slice(-4); + } + + return result; +} + + +/** + * Setup the arrays/hashes with the data from the zvmivp table + * + * @param data Data from HTTP request + */ +function setArrays(data) { + // Get response + var rsp = data.rsp; + + // Clear the list of IVP information. + ivpChoices = new Array(); + ivpChoiceValues = new Array(); + selectInfo = new Object(); + + // Get column value + var idPos = 0; + var ipPos = 0; + var schedulePos = 0; + var lrPos = 0; + var torPos = 0; + var aUserPos = 0; + var oParmsPos = 0; + var pParmsPos = 0; + var mainParmsPos = 0; + var cmntPos = 0; + + var colNameArray = rsp[0].substr(1).split(','); + for ( var i in colNameArray ) { + switch ( colNameArray[i] ) { + case 'id': + idPos = i; + break; + case 'ip': + ipPos = i; + break; + case 'schedule': + schedulePos = i; + break; + case 'last_run': + lrPos = i; + break; + case 'type_of_run': + typeOfRunPos = i; + break; + case 'access_user': + aUserPos = i; + break; + case 'orch_parms': + oParmsPos = i; + break; + case 'prep_parms': + pParmsPos = i; + break; + case 'main_ivp_parms': + mainParmsPos = i; + break; + case 'comments': + cmntPos = i; + break; + case 'disable': + disablePos = i; + break; + default : + break; + } + } + + // Get IVP information from the table data. + for (var i = 1; i < rsp.length; i++) { + var cols = rsp[i].split(','); + var id = cols[idPos].replace(new RegExp('"', 'g'), ''); + var ip = cols[ipPos].replace(new RegExp('"', 'g'), ''); + var schedule = cols[schedulePos].replace(new RegExp('"', 'g'), ''); + var typeOfRun = cols[typeOfRunPos].replace(new RegExp('"', 'g'), ''); + var openstackUser = cols[aUserPos].replace(new RegExp('"', 'g'), ''); + var orchParms = cols[oParmsPos].replace(new RegExp('"', 'g'), ''); + var prepParms = cols[pParmsPos].replace(new RegExp('"', 'g'), ''); + var mainParms = cols[mainParmsPos].replace(new RegExp('"', 'g'), ''); + var comments = cols[cmntPos].replace(new RegExp('"', 'g'), ''); + var disable = cols[disablePos].replace(new RegExp('"', 'g'), ''); + + ivpChoiceValues.push( id ); + selectInfo[id] = new Object(); + selectInfo[id]['id'] = id; + selectInfo[id]['ip'] = ip; + selectInfo[id]['schedule'] = schedule; + selectInfo[id]['typeOfRun'] = typeOfRun.toLowerCase(); + selectInfo[id]['openstackUser'] = hexDecode( openstackUser ); + selectInfo[id]['orchParms'] = hexDecode( orchParms ); + selectInfo[id]['prepParms'] = hexDecode( prepParms ); + selectInfo[id]['mainParms'] = hexDecode( mainParms ); + selectInfo[id]['comments'] = hexDecode(comments); + selectInfo[id]['disable'] = disable.toLowerCase(); + } + + // Sort the choices so we get a pretty list and build the choice strings. + ivpChoiceValues.sort( function(a, b) { + if ( ! isNaN(a) && ! isNaN(b) ) { + // Both are numbers, do a numeric compare + return a-b; + } else if ( isNaN(a) && isNaN(b) ) { + // Both are strings, do a string compare + return a.localeCompare( b ); + } else if ( isNaN(a) ) { + // Strings go after numbers + return 1; + } else { + // Numbers go before strings + return -1; + } + } ); + ivpChoiceValues.forEach( function( id ) { + var idComments; + if ( selectInfo[id]['comments'] != '' ) { + idComments = id + ': ' + selectInfo[id]['comments']; + } else { + idComments = id + ': A comment was not specified.'; + } + ivpChoices.push( idComments ); + }, this); + + // Clear out a hash element for the 'NEW' choice. + selectInfo['NEW'] = new Object(); + selectInfo['NEW']['id'] = ''; + selectInfo['NEW']['ip'] = ''; + selectInfo['NEW']['schedule'] = ''; + selectInfo['NEW']['typeOfRun'] = ''; + selectInfo['NEW']['openstackUser'] = ''; + selectInfo['NEW']['orchParms'] = ''; + selectInfo['NEW']['prepParms'] = ''; + selectInfo['NEW']['mainParms'] = ''; + selectInfo['NEW']['comments'] = ''; + selectInfo['NEW']['disable'] = ''; + + // Add in the NEW option at the top of the array. + ivpChoices.unshift( "NEW: New IVP" ); + ivpChoiceValues.unshift( "NEW" ); + + // Construct the new Select option choices + var ivpChoicesLen = ivpChoices.length; + var selectIdOptions = ''; + for ( var i = 0; i < ivpChoicesLen; i++ ) { + selectIdOptions += ''; + } + + // Find the division containing the select and replace its contents + var thisTabId = $(this).parents('.tab').attr('id'); + var thisIvpSelect = $( '#' + thisTabId + ' select[name=ivpId]' ); + thisIvpSelect.children().remove(); + thisIvpSelect.append( selectIdOptions ); +} + + +/** + * Set node tab + * + * @param tab + * Tab object + * @return Nothing + */ +function setHelpTab(tab) { + helpTab = tab; +} + + +/** + * Set IVP variables based on the chosen Id + * + * @param data Data from HTTP request + */ +function setVarsForId( selected ) { + var id = selected.value; + + // Change the form fields based on the selected ID. + var thisTabId = $(this).parents('.tab').attr('id'); + + var thisField = $( '#' + thisTabId + ' input[name="runType"]' ); + if ( selectInfo[id]['typeOfRun'] == 'basicivp' ) { + thisField.val(['verifyBasic']); + } else if ( selectInfo[id]['typeOfRun'] == 'fullivp' ) { + thisField.val(['verifyOpenStack']); + } else { + var warn = createWarnBar('IVP with the id of '+id+' has an unrecognized type of run value: '+selectInfo[id]['typeOfRun']); + warn.prependTo($(this).parents('.ui-tabs-panel')); + } + + thisField = $( '#' + thisTabId + ' input[name=orchParms]' ); + thisField.val( selectInfo[id]['orchParms'] ); + + thisField = $( '#' + thisTabId + ' input[name=prepParms]' ); + thisField.val( selectInfo[id]['prepParms'] ); + + var thisfield = $( '#' + thisTabId + ' input[name=mainParms]' ); + thisfield.val( selectInfo[id]['mainParms'] ); + + thisField = $( '#' + thisTabId + ' input[name=openstackIP]' ); + thisField.val( selectInfo[id]['ip'] ); + + thisField = $( '#' + thisTabId + ' input[name=openstackUser]' ); + thisField.val( selectInfo[id]['openstackUser'] ); + + var hours = new Object(); + var fullDay = 1; + var hour = selectInfo[id]['schedule'].split(' '); + for ( var j = 0; j < hour.length; j++ ) { + hours[hour[j]] = 1; + } + + for (var i = 0; i <= 23; i++) { + thisField = $( '#' + thisTabId + ' input[name=ivpSchedule][value='+i+']' ); + if ( hours[i] == 1 ) { + thisField.attr( 'checked', true ); + } else { + fullDay = 0; + thisField.attr( 'checked', false ); + } + } + if ( fullDay == 1 ) { + thisField = $( '#' + thisTabId + ' input[name=ivpSchedule][value=Every hour]' ); + thisField.attr( 'checked', true ); + for (var i = 0; i <= 23; i++) { + thisField = $( '#' + thisTabId + ' input[name=ivpSchedule][value='+i+']' ); + thisField.attr( 'checked', false ); + } + } + + thisField = $( '#' + thisTabId + ' input[name=comments]' ); + thisField.val( selectInfo[id]['comments'] ); + + thisField = $( '#' + thisTabId + ' input[name=disable]' ); + if ( selectInfo[id]['disable'] == 1 || selectInfo[id]['disable'] == 'yes' ) { + thisField.val(['disabled']); + } else if ( selectInfo[id]['disable'] == '' || selectInfo[id]['disable'] == 0 ) { + thisField.val(['enabled']); + } else { + var warn = createWarnBar('IVP with the id of '+id+' has an unrecognized disable value: '+selectInfo[id]['disable']); + warn.prependTo($(this).parents('.ui-tabs-panel')); + } +} + + +/** + * Update status bar of a given tab + * + * @param data Data returned from HTTP request + */ +function updateStatusBar(data) { + // Get ajax response + var rsp = data.rsp; + var args = data.msg.split(';'); + var statBarId = ''; + var cmd = ''; + for ( var i=0; i < args.length; i++ ) { + if ( args[i].match('^cmd=') ) { + cmd = args[i].replace('cmd=', ''); + } else if ( args[i].match('^out=') ) { + statBarId = args[i].replace('out=', ''); + } + } + + if (cmd == 'verifynode') { + // Hide loader + $('#' + statBarId).find('img').hide(); + + // Write ajax response to status bar + var prg = writeRsp(rsp, ''); + $('#' + statBarId).find('div').append(prg); + + // Put a check box after the response. + var icon = $('').css({ + 'vertical-align': 'top' + }); + $('#' + statBarId).find( 'div' ).append(icon); + $('#' + statBarId).find( 'div' ).append( '

        ' ); + } else { + // Hide loader + $('#' + statBarId).find('img').hide(); + + // Write ajax response to status bar + var prg = writeRsp(rsp, ''); + $('#' + statBarId).find('div').append(prg); + } +} diff --git a/xCAT-UI/js/monitor/gangliamon.js b/xCAT-UI/js/monitor/gangliamon.js index a5e93b656..411d6a382 100644 --- a/xCAT-UI/js/monitor/gangliamon.js +++ b/xCAT-UI/js/monitor/gangliamon.js @@ -8,8 +8,8 @@ var gridData; // Save nodes path, used for getting detail from rrd file var nodePath = new Object(); -// Save nodes current status, -// unknown = -2, error = -1, warning = 0, normal = 1 are used for sorting +// Save nodes current status, +// unknown = -2, error = -1, warning = 0, normal = 1 are used for sorting var nodeStatus = new Object(); // Update timer @@ -28,14 +28,14 @@ var otherhash; /** * Load Ganglia monitoring tool - * + * * @return Nothing */ function loadGangliaMon() { $('#gangliamon').append(createInfoBar('Checking RPMs')); - + // Get groups and set cookie - if (!$.cookie('groups')) { + if (!$.cookie('xcat_groups')) { $.ajax( { url : 'lib/cmd.php', dataType : 'json', @@ -49,7 +49,7 @@ function loadGangliaMon() { success : setGroupsCookies }); } - + // Check whether Ganglia RPMs are installed on the xCAT MN $.ajax({ url : 'lib/systemcmd.php', @@ -65,13 +65,13 @@ function loadGangliaMon() { /** * Check whether Ganglia RPMs are installed - * + * * @param data Data returned from HTTP request */ function checkGangliaRPMs(data) { var gangliaTab = $('#gangliamon'); gangliaTab.empty(); - + // Get the list of Ganglia RPMs installed var status = data.rsp.split(/\n/); var gangliaRPMs = ["rrdtool", "ganglia-gmetad", "ganglia-gmond"]; @@ -91,7 +91,7 @@ function checkGangliaRPMs(data) { warningBar.prependTo(gangliaTab); } else { gangliaTab.append(createInfoBar('Checking running status')); - + // Check if ganglia is running on the xCAT MN $.ajax( { url : 'lib/cmd.php', @@ -106,19 +106,19 @@ function checkGangliaRPMs(data) { success : checkGangliaRunning }); } - + return; } /** * Check whether Ganglia is running - * + * * @param data Data returned from HTTP request */ function checkGangliaRunning(data) { var gangliaTab = $('#gangliamon'); gangliaTab.empty(); - + // If Ganglia is not started if (data.rsp[0].indexOf("not-monitored") > -1) { // Create link to start Ganglia @@ -151,13 +151,13 @@ function checkGangliaRunning(data) { // If there are any warning messages, append this warning after it var curWarnings = $('#gangliamon').find('.ui-state-error'); - + if (curWarnings.length) { curWarnings.after(warningBar); } else { warningBar.prependTo(gangliaTab); } - + return; } @@ -168,7 +168,7 @@ function checkGangliaRunning(data) { ' Error' + ' Unknown' + ''; - + // Gganglia grid overview var showStr = '

        Grid Overview

        ' + '[Hide]

        ' + @@ -181,11 +181,11 @@ function checkGangliaRunning(data) { // Get summary data and draw on page $('#gangliaGridSummary').append('Getting grid summary data '); sendGridSummaryAjax(); - + // Get all nodes location data which can support the zoom monitor $('#gangliaNodes').append('Getting all nodes status '); sendLocationAjax(); - + // Bind the hide/show button event $('#gangliamon #hidesup').bind('click', function(){ if ('[Hide]' == $(this).text()) { @@ -193,7 +193,7 @@ function checkGangliaRunning(data) { } else { $(this).html('[Hide]'); } - + $('#gangliaGridSummary').toggle(); }); } @@ -211,16 +211,16 @@ function sendLocationAjax() { args : 'graph', msg : '' }, - + success: function(data){ if (!data.rsp[0]) { return; } - + extractLocationlData(data.rsp[0]); // Get nodes current status and draw on the page sendNodeCurrentAjax(); - + // Start the timer to update page per minute gangliaTimer = window.setTimeout('updateGangliaPage()', 60000); } @@ -235,14 +235,14 @@ function extractLocationlData(locationData) { cechash = new Object(); bladehash = new Object(); rackhash = new Object(); - + // Linux nodes which has no parent linuxArray = new Array(); - + // Other unknown nodes only have one parent, use number 1 as there parent otherhash = new Object(); otherhash[1] = new Array(); - + var allnodearray = locationData.split(';'); var temparray; var parent = ''; @@ -250,7 +250,7 @@ function extractLocationlData(locationData) { for (var i in allnodearray) { temparray = allnodearray[i].split(':'); name = temparray[0]; - + // If there is not parent (or mpa, or rack) information parent = temparray[2]; if (!parent) { @@ -258,26 +258,26 @@ function extractLocationlData(locationData) { otherhash[1].push(name); continue; } - + switch (temparray[1].toLowerCase()) { case 'blade': { if (!bladehash[parent]) { bladehash[parent] = new Array(); } - + bladehash[parent].push(name); } break; - + case 'systemx': { if (!rackhash[parent]) { rackhash[parent] = new Array(); } - + rackhash[parent].push(name); } break; - + case 'frame': { if (!framehash[name]) { framehash[name] = new Array(); @@ -289,21 +289,21 @@ function extractLocationlData(locationData) { if (!framehash[parent]) { framehash[parent] = new Array(); } - + framehash[parent].push(name); } break; - + case 'lpar': case 'lpar,osi': case 'osi,lpar': { if (!cechash[parent]) { cechash[parent] = new Array(); } - + cechash[parent].push(name); } - + break; default: { otherhash[1].push(name); @@ -327,7 +327,7 @@ function sendGridSummaryAjax() { args : 'gangliashow;_grid_;hour;_summary_', msg : '' }, - + success: function(data) { createGridSummaryData(data.rsp[0]); drawGridSummary(); @@ -339,7 +339,7 @@ function sendGridSummaryAjax() { * Send AJAX request to get nodes current load information */ function sendNodeCurrentAjax() { - + // Get all nodes current status $.ajax({ url : 'lib/cmd.php', @@ -350,7 +350,7 @@ function sendNodeCurrentAjax() { args : 'gangliacurrent;node;', msg : '' }, - + success: function(data){ createNodeStatusData(data.rsp[0]); drawGangliaNodesArea($('#gangliaorder').val()); @@ -372,7 +372,7 @@ function sendGridCurrentAjax(){ args : 'gangliacurrent;grid', msg : '' }, - + success: function(data){ updateGridSummaryData(data.rsp[0]); drawGridSummary(); @@ -381,13 +381,13 @@ function sendGridCurrentAjax(){ } /** - * Save the grid summary data to local global variable + * Save the grid summary data to local global variable */ function createGridSummaryData(summaryString){ // Empty the global data // The data structure looks like: metric1:time11,val11,time12,val12,...;metric2:time21,val21,time22,val22,...;.... gridData = new Object(); - + var metricArray = summaryString.split(';'); var metricname = ''; var valueArray = ''; @@ -395,13 +395,13 @@ function createGridSummaryData(summaryString){ var tempLength = 0; for (var index = 0; index < metricArray.length; index++) { position = metricArray[index].indexOf(':'); - + // Get the metric name and init its global array to save timestamp and value pair metricname = metricArray[index].substr(0, position); gridData[metricname] = new Array(); valueArray = metricArray[index].substr(position + 1).split(','); tempLength = valueArray.length; - + // Save timestamp and value into global array for (var i = 0; i < tempLength; i++) { gridData[metricname].push(Number(valueArray[i])); @@ -420,7 +420,7 @@ function updateGridSummaryData(currentString){ var tempLength = 0; var index = 0; var tempArray; - + tempLength = metricArray.length; for (index = 0; index < tempLength; index++) { position = metricArray[index].indexOf(':'); @@ -442,19 +442,19 @@ function drawGridSummary() { var gridDrawArea = $('#gangliaGridSummary'); var showStr = ''; var tempStr = $('#gangliamon').attr('class'); - + // jqflot only draws on the visible area // If the tab is hide, return directly if (tempStr.indexOf('hide') != -1) { return; } - + if ($('#gangliamon #hidesup').text() == '[Show]') { return; } - + gridDrawArea.empty(); - showStr = '' + + showStr = '
        ' + '' + '' + '' + @@ -470,7 +470,7 @@ function drawGridSummary() { /** * Draw the load flot by data (summary data or one node data) - * + * * @param areaid Which DIV draw this flot * @param loadpair The load timestamp and value pair * @param cpupair The CPU number and value pair @@ -481,7 +481,7 @@ function drawLoadFlot(areaid, titleprefix, loadpair, cpupair) { var index = 0; var yaxismax = 0; var interval = 1; - + $('#' + areaid).empty(); // Parse load pair, the timestamp must mutiply 1000, javascript time stamp is millisecond for (index = 0; index < loadpair.length; index += 2) { @@ -490,7 +490,7 @@ function drawLoadFlot(areaid, titleprefix, loadpair, cpupair) { yaxismax = loadpair[index + 1]; } } - + // Parse cpu pair for (index = 0; index < cpupair.length; index += 2) { cpunum.push([cpupair[index] * 1000, cpupair[index + 1]]); @@ -498,12 +498,12 @@ function drawLoadFlot(areaid, titleprefix, loadpair, cpupair) { yaxismax = cpupair[index + 1]; } } - + interval = parseInt(yaxismax / 3); if (interval < 1) { interval = 1; } - + $.jqplot(areaid, [load, cpunum], { title: titleprefix + ' Loads/Procs Last Hour', axes:{ @@ -531,7 +531,7 @@ function drawLoadFlot(areaid, titleprefix, loadpair, cpupair) { /** * Draw the CPU usage flot by data (maybe summary data or one node data) - * + * * @param areaid Which DIV draw this flot * @param titleprefix Title used name * @param cpupair The CPU timestamp and value pair @@ -539,15 +539,15 @@ function drawLoadFlot(areaid, titleprefix, loadpair, cpupair) { function drawCpuFlot(areaid, titleprefix, cpupair) { var cpu = new Array(); var index = 0; - + $('#' + areaid).empty(); - + // Time stamp should be mutiplied by 1000 // We get the CPU idle from server for (index = 0; index < cpupair.length; index +=2) { cpu.push([(cpupair[index] * 1000), (100 - cpupair[index + 1])]); } - + $.jqplot(areaid, [cpu],{ title: titleprefix + ' Cpu Use Last Hour', axes:{ @@ -571,7 +571,7 @@ function drawCpuFlot(areaid, titleprefix, cpupair) { /** * Draw the memory usage flot by data (summary data or one node data) - * + * * @param areaid Which DIV draw this flot * @param titleprefix Title used name * @param cpupair The CPU timestamp and value pair @@ -581,14 +581,14 @@ function drawMemFlot(areaid, titleprefix, freepair, totalpair){ var total = new Array(); var tempsize = 0; var index = 0; - + $('#' + areaid).empty(); if (freepair.length < totalpair.length) { tempsize = freepair.length; } else { tempsize = freepair.length; } - + for (index = 0; index < tempsize; index += 2) { var temptotal = totalpair[index + 1]; var tempuse = temptotal - freepair[index + 1]; @@ -597,7 +597,7 @@ function drawMemFlot(areaid, titleprefix, freepair, totalpair){ total.push([totalpair[index] * 1000, temptotal]); use.push([freepair[index] * 1000, tempuse]); } - + $.jqplot(areaid, [use, total], { title: titleprefix + ' Memory Use Last Hour', axes:{ @@ -625,7 +625,7 @@ function drawMemFlot(areaid, titleprefix, freepair, totalpair){ /** * Draw the disk usage flot by data (summary data or one node's data) - * + * * @param areaid Which div draw this flot * @param titleprefix Title used name * @param freepair The free disk number, Ganglia only logs the free data @@ -636,21 +636,21 @@ function drawDiskFlot(areaid, titleprefix, freepair, totalpair) { var total = new Array(); var tempsize = 0; var index = 0; - + $('#' + areaid).empty(); if (freepair.length < totalpair.length) { tempsize = freepair.length; } else{ tempsize = freepair.length; } - + for (index = 0; index < tempsize; index += 2) { var temptotal = totalpair[index + 1]; var tempuse = temptotal - freepair[index + 1]; total.push([totalpair[index] * 1000, temptotal]); use.push([freepair[index] * 1000, tempuse]); } - + $.jqplot(areaid, [use, total], { title: titleprefix + ' Disk Use Last Hour', axes:{ @@ -678,7 +678,7 @@ function drawDiskFlot(areaid, titleprefix, freepair, totalpair) { /** * Draw the network load flot by data (summary data or one node data) - * + * * @param areaid Which div draw this flot * @param titleprefix Title used name * @param inpair The timestamp and value pair for download @@ -691,19 +691,19 @@ function drawNetworkFlot(areaid, titleprefix, inpair, outpair) { var maxvalue = 0; var unitname = 'B'; var divisor = 1; - + for (index = 0; index < inpair.length; index += 2) { if (inpair[index + 1] > maxvalue) { maxvalue = inpair[index + 1]; } } - + for (index = 0; index < outpair.length; index += 2) { if (outpair[index + 1] > maxvalue) { maxvalue = outpair[index + 1]; } } - + if (maxvalue > 3000000) { divisor = 1000000; unitname = 'GB'; @@ -713,15 +713,15 @@ function drawNetworkFlot(areaid, titleprefix, inpair, outpair) { } else { // Do nothing } - + for (index = 0; index < inpair.length; index += 2) { inArray.push([(inpair[index] * 1000), (inpair[index + 1] / divisor)]); } - + for (index = 0; index < outpair.length; index += 2) { outArray.push([(outpair[index] * 1000), (outpair[index + 1] / divisor)]); } - + $.jqplot(areaid, [inArray, outArray], { title: titleprefix + ' Network Last Hour', axes:{ @@ -749,7 +749,7 @@ function drawNetworkFlot(areaid, titleprefix, inpair, outpair) { /** * Create node status data - * + * * @param nodesStatus Node status */ function createNodeStatusData(nodesStatus) { @@ -759,15 +759,15 @@ function createNodeStatusData(nodesStatus) { var index = 0; var tempArray; var tempStr = ''; - + for (index in nodePath) { delete(nodePath[index]); } - + for (index in nodeStatus) { delete(nodeStatus[index]); } - + for (index = 0; index < nodesArray.length; index++) { tempStr = nodesArray[index]; position = tempStr.indexOf(':'); @@ -785,18 +785,18 @@ function createNodeStatusData(nodesStatus) { */ function drawGangliaNodesArea() { var position = 0; - + // Find out the last child's type and name var currentobj = $('#zoomDiv span:last'); var type = currentobj.attr('name').toLowerCase(); var name = currentobj.text(); position = name.indexOf('('); - + if (position > -1) { name = name.substr(3, position - 3); } $('#gangliaNodes').empty(); - + switch (type) { // Draw the node current status case 'blade': @@ -806,7 +806,7 @@ function drawGangliaNodesArea() { drawGangliaNodesAreaPic(type, name); } break; - + // Draw a summary table case 'all': case 'frame': { @@ -825,7 +825,7 @@ function drawGangliaNodesAreaPic(type, name) { var showStr = ''; var nodename = ''; var temparray; - + switch(type) { case 'blade': { arraypoint = bladehash[name]; @@ -846,10 +846,10 @@ function drawGangliaNodesAreaPic(type, name) { break; } $('#gangliaNodes').html('
          '); - + temparray = arraypoint.sort(); templength = arraypoint.length; - + for (index = 0; index < templength; index++) { nodename = temparray[index]; switch (nodeStatus[nodename]) { @@ -868,7 +868,7 @@ function drawGangliaNodesAreaPic(type, name) { } $('#gangliaNodes ul').append(showStr); } - + // Bind all normal and warning nodes click event $('.monitor-normal,.monitorwarning').bind('click', function() { var nodename = $(this).attr('title'); @@ -881,45 +881,45 @@ function drawGangliaNodesAreaTable(type, name) { var table = $('
          '); var row = ''; var usedCec = new Object(); - + var header = $(' NameTypeNormalHeavy LoadErrorUnknown '); table.append(header); - + if (type == 'all') { for (var i in framehash) { var framename = i; - row = '' + framename + 'Frame' + + row = '' + framename + 'Frame' + monitorStatAgg('frame', framehash[i]) + ''; table.append(row); for(var j in framehash[i]){ usedCec[framehash[i][j]] = 1; } } - + for (var i in cechash) { if (usedCec[i]) { continue; } var cecname = i; - row = '' + cecname + 'CEC' + + row = '' + cecname + 'CEC' + monitorStatAgg('cec', cechash[i]) + ''; table.append(row); } - + for (var i in bladehash) { var bladename = i; - row = '' + bladename + 'Blade' + + row = '' + bladename + 'Blade' + monitorStatAgg('blade', bladehash[i]) + ''; table.append(row); } - + for (var i in rackhash) { var rackname = i; row = '' + rackname + 'Rack' + monitorStatAgg('rack', rackhash[i]) + ''; table.append(row); } - + if (otherhash[1].length > 0) { row = 'OtherOther' + monitorStatAgg('other', otherhash[1]) + ''; @@ -933,7 +933,7 @@ function drawGangliaNodesAreaTable(type, name) { table.append(row); } } - + $('#gangliaNodes').append(table); } @@ -947,7 +947,7 @@ function monitorStatAgg(type, inputarray) { var nuknownnum = 0; var tempArray; var tempname; - + switch (type) { case 'blade': case 'cec': @@ -970,7 +970,7 @@ function monitorStatAgg(type, inputarray) { return; break; } - + for (var i in tempArray) { tempname = tempArray[i]; switch(nodeStatus[tempname]) { @@ -988,12 +988,12 @@ function monitorStatAgg(type, inputarray) { break; } } - + normalnum = normalnum?normalnum:'-'; warningnum = warningnum?warningnum:'-'; errornum = errornum?errornum:'-'; nuknownnum = nuknownnum?nuknownnum:'-'; - + return ('' + normalnum + '' + warningnum + '' + errornum + '' + nuknownnum + ''); } @@ -1004,10 +1004,10 @@ function updateGangliaPage() { if ($('#gangliaNodes').size() < 1) { return; } - + sendGridCurrentAjax(); sendNodeCurrentAjax(); - + gangliaTimer = window.setTimeout('updateGangliaPage()', 60000); } @@ -1021,7 +1021,7 @@ function updateZoom(obj) { } $(obj).removeClass('monitor-zoom-link'); $(obj).unbind('click'); - + drawGangliaNodesArea(); } @@ -1031,16 +1031,16 @@ function updateZoom(obj) { function addZoomDiv(obj) { var name = $(obj).text(); var type = $(obj).attr('name'); - + var lastzoomobj = $('#zoomDiv span:last'); lastzoomobj.addClass('monitor-zoom-link'); lastzoomobj.bind('click', function() { updateZoom(this); }); - + var newcontent = ' > ' + name + '(' + type.toUpperCase() + ')'; var newli = '' + newcontent + ''; $('#zoomDiv').append(newli); - + drawGangliaNodesArea(); } \ No newline at end of file diff --git a/xCAT-UI/js/nodes/nodes.js b/xCAT-UI/js/nodes/nodes.js index 0ded38d52..769aa5e87 100644 --- a/xCAT-UI/js/nodes/nodes.js +++ b/xCAT-UI/js/nodes/nodes.js @@ -97,7 +97,7 @@ function loadNodesPage() { success : function(data){ loadGroups(data); - var cookieGroup = $.cookie('selectgrouponnodes'); + var cookieGroup = $.cookie('xcat_selectgrouponnodes'); if (cookieGroup) { $('#groups .groupdiv div').each(function(){ if ($(this).text() == cookieGroup){ @@ -231,7 +231,7 @@ function loadGroups(data) { $(this).addClass('selectgroup'); // Save selected group into cookie - $.cookie('selectgrouponnodes', thisGroup, { expires: 7 }); + $.cookie('xcat_selectgrouponnodes', thisGroup, { expires: 7, path: '/xcat', secure:true }); drawNodesArea(thisGroup,'',thisGroup); }); @@ -347,8 +347,8 @@ function drawNodesArea(targetgroup, cmdargs, message){ // Get last view (if any) // This can be summary, nodes, or graphic - if ($.cookie('tabindex_history')) { - var order = $.cookie('tabindex_history').split(','); + if ($.cookie('xcat_tabindex_history')) { + var order = $.cookie('xcat_tabindex_history').split(','); order[0] = parseInt(order[0]); order[1] = parseInt(order[1]); if (order[0] == 0 || order[1] == 0) { @@ -1095,7 +1095,7 @@ function loadNodes(data) { // Remove any warning messages $(this).parents('.ui-tabs-panel').find('.ui-state-error').remove(); - var zhcpsCheck = $.cookie('zhcps').split(','); + var zhcpsCheck = $.cookie('xcat_zhcps').split(','); var zhcpHash = new Object(); for (var h in zhcpsCheck) { if (!zhcpHash[zhcpsCheck[h]]) { @@ -1917,7 +1917,7 @@ function loadNode(e) { newTabId = 'nodeTab' + inst; } // Reset node process - $.cookie(node + 'Processes', 0); + $.cookie('xcat_' + node + 'Processes', 0, { path: '/xcat', secure:true }); // Add new tab, only if one does not exist var loader = createLoader(newTabId + 'TabLoader'); @@ -2909,28 +2909,28 @@ function setOSImageCookies(data) { } // Save image names in a cookie - $.cookie('imagenames', imageNames); + $.cookie('xcat_imagenames', imageNames, { path: '/xcat', secure:true }); // Save profiles in a cookie var tmp = new Array; for (var key in profilesHash) { tmp.push(key); } - $.cookie('profiles', tmp); + $.cookie('xcat_profiles', tmp, { path: '/xcat', secure:true }); // Save OS versions in a cookie tmp = new Array; for (var key in osVersHash) { tmp.push(key); } - $.cookie('osvers', tmp); + $.cookie('xcat_osvers', tmp, { path: '/xcat', secure:true }); // Save OS architectures in a cookie tmp = new Array; for (var key in osArchsHash) { tmp.push(key); } - $.cookie('osarchs', tmp); + $.cookie('xcat_osarchs', tmp, { path: '/xcat', secure:true }); } /** @@ -2940,7 +2940,7 @@ function setOSImageCookies(data) { */ function setGroupsCookies(data) { var rsp = data.rsp; - $.cookie('groups', rsp); + $.cookie('xcat_groups', rsp, { path: '/xcat', secure:true }); } /** @@ -4202,7 +4202,7 @@ function advancedLoad(group){ zhcpHash[args[0]] = 1; // If there are no disk pools or network names cookie for this hcp - if (!$.cookie(args[0] + 'diskpools') || !$.cookie(args[0] + 'networks')) { + if (!$.cookie('xcat_' + args[0] + 'diskpools') || !$.cookie('xcat_' + args[0] + 'networks')) { // Check if SMAPI is online $.ajax({ url : 'lib/cmd.php', @@ -4226,7 +4226,7 @@ function advancedLoad(group){ setzHcpCookies(shortzHcps); // Retrieve z/VM hypervisors and their zHCPs - if (!$.cookie('zvms')) { + if (!$.cookie('xcat_zvms')) { $.ajax( { url : 'lib/cmd.php', dataType : 'json', diff --git a/xCAT-UI/js/nodes/nodeset.js b/xCAT-UI/js/nodes/nodeset.js index aea3ea310..c1b2acfe8 100644 --- a/xCAT-UI/js/nodes/nodeset.js +++ b/xCAT-UI/js/nodes/nodeset.js @@ -87,7 +87,7 @@ function loadNodesetPage(tgtNodes) { var osSelect = $(''); osSelect.append($('')); - var imageNames = $.cookie('imagenames').split(','); + var imageNames = $.cookie('xcat_imagenames').split(','); if (imageNames) { imageNames.sort(); for (var i in imageNames) { diff --git a/xCAT-UI/js/nodes/physical.js b/xCAT-UI/js/nodes/physical.js index 227a002cf..e8df2d4c8 100644 --- a/xCAT-UI/js/nodes/physical.js +++ b/xCAT-UI/js/nodes/physical.js @@ -9,7 +9,7 @@ var selectNode; /** * Get all nodes useful attributes from remote server - * + * * @param dataTypeIndex The index in the array which contains attributes we need. * @param attrNullNode The target node list for this attribute */ @@ -36,7 +36,7 @@ function initGraphicalData() { /** * Extract all nodes userful data into a hash, which will be used for creating graphical - * + * * @param data The response from xCAT command 'nodels all nodetype.nodetype ppc.parent ...' * @return nodes list for next time query */ @@ -115,7 +115,7 @@ function createPhysicalLayout(nodeList) { } function getNodesAndDraw() { - var groupName = $.cookie('selectgrouponnodes'); + var groupName = $.cookie('xcat_selectgrouponnodes'); $.ajax({ url : 'lib/cmd.php', dataType : 'json', @@ -183,64 +183,64 @@ function fillList(nodeName, defaultnodetype) { } switch (nodeType) { - case 'frame': + case 'frame': if (undefined == bpaList[nodeName]) { bpaList[nodeName] = new Array(); } - + break; case 'lpar,osi': case 'lpar': - case 'osi': + case 'osi': if ('' == parentName) { break; } - + if (undefined == fspList[parentName]) { fillList(parentName, 'cec'); } - + fspList[parentName]['children'].push(nodeName); lparList[nodeName] = status; - + break; - case 'cec': + case 'cec': if (undefined != fspList[nodeName]) { break; } - + fspList[nodeName] = new Object(); fspList[nodeName]['children'] = new Array(); fspList[nodeName]['mtm'] = mtm; - + if ('' == parentName) { break; } - + if (undefined == bpaList[parentName]) { fillList(parentName, 'frame'); } - + bpaList[parentName].push(nodeName); break; - case 'blade': + case 'blade': if (undefined == bladeList[mpa]) { bladeList[mpa] = new Array(); } bladeList[mpa].push(nodeName + ',' + unit); - + break; - case 'systemx': + case 'systemx': if (!rack) { rack = '_notsupply_'; } - + if (undefined == rackList[rack]) { rackList[rack] = new Array(); } - + rackList[rack].push(nodeName + ',' + unit); - + break; default: unknownList.push(nodeName); @@ -276,8 +276,8 @@ function createGraphical() { /** * Create the physical/graphical layout for System p machines - * - * @param bpa All BPA and their related FSPs + * + * @param bpa All BPA and their related FSPs * @param fsp All FSP and their related LPARs * @param area The element to append graphical layout */ @@ -310,7 +310,7 @@ function createSystempGraphical(bpa, fsp, area) { + '">'); - // For P7-IH, all the CECs are insert into the frame from bottom to up, + // For P7-IH, all the CECs are insert into the frame from bottom to up, // so we have to show the CECs same as the physical layout var tempBlankDiv = $('
          '); var tempHeight = 0; @@ -322,7 +322,7 @@ function createSystempGraphical(bpa, fsp, area) { if ((0 == fspIndex) && ('9125-F2C' == fsp[fspName]['mtm'])) { frameDiv.append(tempBlankDiv); } - + frameDiv.append(createFspDiv(fspName, fsp[fspName]['mtm'], fsp)); frameDiv.append(createFspTip(fspName, fsp[fspName]['mtm'], fsp)); @@ -430,7 +430,7 @@ function createSystempGraphical(bpa, fsp, area) { changeNode(lparName, 'unselect'); } } - + // No selected LPARs on the cec, so add all LPARs into selectNode hash else { for (var lparIndex in fspList[fspName]['children']) { @@ -458,8 +458,8 @@ function createSystempGraphical(bpa, fsp, area) { /** * Create the physical/graphical layout for blades - * - * @param blades The blade list in global + * + * @param blades The blade list in global * @param area The element to append the graphical layout */ function createBladeGraphical(blades, area) { @@ -529,8 +529,8 @@ function createBladeGraphical(blades, area) { /** * Create the physical/graphical layout for System x machines - * - * @param xnodes The system x node list in global + * + * @param xnodes The system x node list in global * @param area The element to append graphical layout */ function createSystemxGraphical(xnodes, area) { @@ -765,7 +765,7 @@ function createFspDiv(fspName, mtm, fsp) { if (lparIndex >= 8) { break; } - + var lparName = fsp[fspName]['children'][lparIndex]; var color = statusMap(lparList[lparName]); lparStatusRow += ''; @@ -778,11 +778,11 @@ function createFspDiv(fspName, mtm, fsp) { } else { temp = mtm; } - + if (!hardwareInfo[temp]){ hardwareInfo[temp] = ['unkown', 2]; } - + if (hardwareInfo[temp][1]) { divClass += 'fspDiv' + hardwareInfo[temp][1]; } else { @@ -830,7 +830,7 @@ function createFspTip(fspName, mtm, fsp) { } /** * Map the LPAR status into a color - * + * * @param status LPAR status in nodelist table * @return Corresponding color name */ @@ -844,7 +844,7 @@ function statusMap(status) { case 'sshd': case 'booting': case 'booted': - case 'ping': + case 'ping': color = 'green'; break; case 'noping': @@ -869,7 +869,7 @@ function selectAllLpars(checkbox) { /** * Export all LPAR names from selectNode - * + * * @return lpars' string */ function getSelectNodes() { @@ -904,7 +904,7 @@ function changeNode(lparName, status) { /** * The P7-IH's CECs are insert from bottom to up, so we had to calculate the blank height - * + * * @return Height for the CEC */ function calculateBlank(mtm) { @@ -917,13 +917,13 @@ function calculateBlank(mtm) { } switch (hardwareInfo[mtm][1]) { - case 1: + case 1: return 13; break; - case 2: + case 2: return 24; break; - case 4: + case 4: return 47; break; default: diff --git a/xCAT-UI/js/nodes/updatenode.js b/xCAT-UI/js/nodes/updatenode.js index a38b7db28..943972e8e 100644 --- a/xCAT-UI/js/nodes/updatenode.js +++ b/xCAT-UI/js/nodes/updatenode.js @@ -1,6 +1,6 @@ /** * Load updatenode page - * + * * @param tgtNodes Targets to run updatenode against */ function loadUpdatenodePage(tgtNodes) { @@ -17,7 +17,7 @@ function loadUpdatenodePage(tgtNodes) { success : setOSImageCookies }); - + // Get node OS var osHash = new Object(); var nodes = tgtNodes.split(','); @@ -28,7 +28,7 @@ function loadUpdatenodePage(tgtNodes) { nodes[osBase] = 1; } } - + // Get nodes tab var tab = getNodesTab(); @@ -40,10 +40,10 @@ function loadUpdatenodePage(tgtNodes) { inst = inst + 1; newTabId = 'updatenodeTab' + inst; } - + // Create rscan form var updatenodeForm = $('
          '); - + // Create status bar var statBarId = 'updatenodeStatusBar' + inst; var statusBar = createStatusBar(statBarId).hide(); @@ -55,35 +55,35 @@ function loadUpdatenodePage(tgtNodes) { // Create info bar var infoBar = createInfoBar('Update nodes in an xCAT environment'); updatenodeForm.append(statusBar, infoBar); - + // Create VM fieldset var vmFS = $('
          '); var vmLegend = $('Virtual Machine'); vmFS.append(vmLegend); updatenodeForm.append(vmFS); - + var vmAttr = $('
          '); vmFS.append($('
          ')); vmFS.append(vmAttr); - + // Create options fieldset var optionsFS = $('
          '); var optionsLegend = $('Options'); optionsFS.append(optionsLegend); updatenodeForm.append(optionsFS); - + var optionsAttr = $('
          '); optionsFS.append($('
          ')); optionsFS.append(optionsAttr); - + // Create target node or group input var tgt = $('
          '); vmAttr.append(tgt); - // Create options + // Create options var optionsList = $('
            '); optionsAttr.append(optionsList); - + // Create update all software checkbox (only AIX) if (osHash['AIX']) { var updateAllOption = $('
          • '); @@ -91,7 +91,7 @@ function loadUpdatenodePage(tgtNodes) { updateAllOption.append(updateAllChkBox); optionsList.append(updateAllOption); updateAllOption.append('Install or update all software contained in the source directory'); - + // Create source directory input var allSwScrDirectory = $('
          • '); // Browse server directory and files @@ -131,14 +131,14 @@ function loadUpdatenodePage(tgtNodes) { } }); } - + // Create update software checkbox var updateOption = $('
          • '); var updateChkBox = $(''); optionsList.append(updateOption); updateOption.append(updateChkBox); updateOption.append('Update existing software'); - + // Create source directory input var scrDirectory = $('
          • '); // Browse server directory and files @@ -168,27 +168,27 @@ function loadUpdatenodePage(tgtNodes) { scrDirectory.append(srcDirBrowse); scrDirectory.hide(); optionsList.append(scrDirectory); - + // Create other packages input var otherPkgs = $('
          • '); otherPkgs.hide(); optionsList.append(otherPkgs); - + // Create RPM flags input (only AIX) var aixRpmFlags = $('
          • '); aixRpmFlags.hide(); optionsList.append(aixRpmFlags); - + // Create installp flags input (only AIX) var aixInstallPFlags = $('
          • '); aixInstallPFlags.hide(); optionsList.append(aixInstallPFlags); - + // Create emgr flags input (only AIX) var aixEmgrFlags = $('
          • '); aixEmgrFlags.hide(); optionsList.append(aixEmgrFlags); - + // Show flags when checked updateChkBox.bind('click', function(event) { if ($(this).is(':checked')) { @@ -209,7 +209,7 @@ function loadUpdatenodePage(tgtNodes) { } } }); - + // Create postscripts input var postOption = $('
          • '); var postChkBox = $(''); @@ -219,7 +219,7 @@ function loadUpdatenodePage(tgtNodes) { var postscripts = $('
          • '); postscripts.hide(); optionsList.append(postscripts); - + // Show alternate source directory when checked postChkBox.bind('click', function(event) { if ($(this).is(':checked')) { @@ -230,7 +230,7 @@ function loadUpdatenodePage(tgtNodes) { }); optionsList.append('
          • Distribute and synchronize files
          • '); optionsList.append('
          • Update the ssh keys and host keys for the service nodes and compute nodes
          • '); - + // Create update OS checkbox if (!osHash['AIX']) { var osOption = $('
          • '); @@ -238,12 +238,12 @@ function loadUpdatenodePage(tgtNodes) { optionsList.append(osOption); osOption.append(osChkBox); osOption.append('Update the operating system'); - + var os = $('
          • ').hide(); var osLabel = $(''); var osInput = $(''); osInput.one('focus', function(){ - var tmp = $.cookie('osvers'); + var tmp = $.cookie('xcat_osvers'); if (tmp) { // Turn on auto complete $(this).autocomplete({ @@ -254,7 +254,7 @@ function loadUpdatenodePage(tgtNodes) { os.append(osLabel); os.append(osInput); optionsList.append(os); - + // Show alternate source directory when checked osChkBox.bind('click', function(event) { if ($(this).is(':checked')) { @@ -264,7 +264,7 @@ function loadUpdatenodePage(tgtNodes) { } }); } - + // Generate tooltips updatenodeForm.find('div input[title]').tooltip({ position: "center right", @@ -279,7 +279,7 @@ function loadUpdatenodePage(tgtNodes) { tooltip : "mouseover,mouseout" } }); - + /** * Ok */ @@ -292,7 +292,7 @@ function loadUpdatenodePage(tgtNodes) { // Remove any warning messages $(this).parents('.ui-tabs-panel').find('.ui-state-error').remove(); var ready = true; - + // Generate arguments var chkBoxes = $("#" + newTabId + " input[type='checkbox']:checked"); var optionsStr = ''; @@ -300,7 +300,7 @@ function loadUpdatenodePage(tgtNodes) { for ( var i = 0; i < chkBoxes.length; i++) { option = chkBoxes.eq(i).attr('name'); optionsStr += '-' + option; - + // If update all software is checked if (option == 'S') { var srcDir = $('#' + newTabId + ' input[name=allSwSrcDirectory]').val(); @@ -316,50 +316,50 @@ function loadUpdatenodePage(tgtNodes) { if (srcDirectory) { optionsStr += ';-d;' + srcDirectory; } - + // Get otherpkgs var otherpkgs = $('#' + newTabId + ' input[name=otherpkgs]').val(); if (otherpkgs) { optionsStr += ';otherpkgs=' + otherpkgs; } - + // Get rpm_flags var rpm_flags = $('#' + newTabId + ' input[name=rpm_flags]').val(); if (rpm_flags) { optionsStr += ';rpm_flags=' + rpm_flags; } - + // Get installp_flags var installp_flags = $('#' + newTabId + ' input[name=installp_flags]').val(); if (installp_flags) { optionsStr += ';installp_flags=' + installp_flags; } - + // Get emgr_flags var emgr_flags = $('#' + newTabId + ' input[name=emgr_flags]').val(); if (emgr_flags) { optionsStr += ';emgr_flags=' + emgr_flags; } } - + // If postscripts is checked if (option == 'P') { // Get postscripts optionsStr += ';' + $('#' + newTabId + ' input[name=postscripts]').val(); } - + // If operating system is checked if (option == 'o') { // Get the OS optionsStr += ';' + $('#' + newTabId + ' input[name=os]').val(); } - + // Append ; to end of string if (i < (chkBoxes.length - 1)) { optionsStr += ';'; } } - + // If no inputs are empty if (ready) { // Get nodes @@ -368,7 +368,7 @@ function loadUpdatenodePage(tgtNodes) { // Disable all inputs and Ok button $('#' + newTabId + ' input').attr('disabled', 'disabled'); $(this).attr('disabled', 'true'); - + /** * (1) Boot to network */ diff --git a/xCAT-UI/js/provision/images.js b/xCAT-UI/js/provision/images.js index 59ad4c467..d1a6f174d 100644 --- a/xCAT-UI/js/provision/images.js +++ b/xCAT-UI/js/provision/images.js @@ -48,7 +48,7 @@ function loadImages(data) { // Data returned var rsp = data.rsp; if (rsp[0].indexOf('Could not find any object definitions') > -1) { - rsp = new Array(); + rsp = new Array(); } // Image attributes hash @@ -198,7 +198,7 @@ function loadImages(data) { // Turn table into a datatable var myDataTable = $('#' + imgTableId).dataTable({ - 'iDisplayLength': 50, + 'iDisplayLength': 50, 'bLengthChange': false, "bScrollCollapse": true, "sScrollY": "400px", @@ -502,7 +502,7 @@ function openAddImageDialog() { imageAttr.append(imageName, imageType, architecture, osName, osVersion, profile, provisionMethod); optionAttr.append(otherpkgDirectory, packageDirectory, packageList, template); - // Generate tooltips + // Generate tooltips addImageForm.find('div input[title],select[title]').tooltip({ position: "center right", offset: [-2, 10], @@ -720,9 +720,9 @@ function loadCreateImage() { return; } - var imageOsVers = $.cookie("osvers").split(","); - var imageArch = $.cookie("osarchs").split(","); - var profiles = $.cookie("profiles").split(","); + var imageOsVers = $.cookie("xcat_osvers").split(","); + var imageArch = $.cookie("xcat_osarchs").split(","); + var profiles = $.cookie("xcat_profiles").split(","); var createImgForm = $('
            '); var createImgFS = $('
            ').append('Create Image'); @@ -1329,7 +1329,7 @@ function openCopyCdDialog() { basePath : '/install' // Limit user to only install directory }); - // Generate tooltips + // Generate tooltips copyLinuxForm.find('div input[title],select[title]').tooltip({ position: "center right", offset: [-2, 10], diff --git a/xCAT-UI/js/provision/provision.js b/xCAT-UI/js/provision/provision.js index a732f5653..00a059080 100644 --- a/xCAT-UI/js/provision/provision.js +++ b/xCAT-UI/js/provision/provision.js @@ -33,7 +33,7 @@ function loadProvisionPage() { } // Get OS image names - if (!$.cookie('imagenames')){ + if (!$.cookie('xcat_imagenames')){ $.ajax( { url : 'lib/cmd.php', dataType : 'json', @@ -49,7 +49,7 @@ function loadProvisionPage() { } // Get groups - if (!$.cookie('groups')){ + if (!$.cookie('xcat_groups')){ $.ajax( { url : 'lib/cmd.php', dataType : 'json', diff --git a/xCAT-UI/js/service/service.js b/xCAT-UI/js/service/service.js index 96be4c75a..3d49b98d9 100644 --- a/xCAT-UI/js/service/service.js +++ b/xCAT-UI/js/service/service.js @@ -73,7 +73,7 @@ function initServicePage() { loadServicePage(); // Initialize tab index history - $.cookie('tabindex_history', '0,0'); + $.cookie('xcat_tabindex_history', '0,0', { path: '/xcat', secure:true }); } /** @@ -185,14 +185,14 @@ function loadServiceProvisionPage(tabId) { var okBtn = createButton('Ok'); okBtn.bind('click', function(event) { var userName = $.cookie('xcat_username'); - var tmp = $.cookie(userName + '_usrnodes'); + var tmp = $.cookie('xcat_' + userName + '_usrnodes'); // Get maximun number for nodes from cookie var nodes = ''; var maxVM = 0; if (tmp.length) { nodes = tmp.split(','); - maxVM = parseInt($.cookie(userName + '_maxvm')); + maxVM = parseInt($.cookie('xcat_' + userName + '_maxvm')); // Do not allow user to clone if the maximum number of VMs is reached if (nodes.length >= maxVM) { @@ -302,7 +302,7 @@ function loadManagePage(tabId) { */ function getUserNodesDef() { var userName = $.cookie('xcat_username'); - var userNodes = $.cookie(userName + '_usrnodes'); + var userNodes = $.cookie('xcat_' + userName + '_usrnodes'); if (userNodes) { // Get nodes definitions $.ajax( { @@ -597,7 +597,7 @@ function loadNodesTable(data) { // Refresh nodes table var userName = $.cookie('xcat_username'); - var userNodes = $.cookie(userName + '_usrnodes'); + var userNodes = $.cookie('xcat_' + userName + '_usrnodes'); if (userNodes) { // Get nodes definitions $.ajax( { @@ -932,7 +932,7 @@ function setGroupCookies(data) { // Set cookie to expire in 60 minutes var exDate = new Date(); exDate.setTime(exDate.getTime() + (240 * 60 * 1000)); - $.cookie('srv_groups', groups, { expires: exDate }); + $.cookie('xcat_srv_groups', groups, { expires: exDate, path: '/xcat', secure:true }); } } @@ -1041,28 +1041,28 @@ function setOSImageCookies(data) { } // Save image names in a cookie - $.cookie('srv_imagenames', imageNames); + $.cookie('xcat_srv_imagenames', imageNames); // Save profiles in a cookie var tmp = new Array; for (var key in profilesHash) { tmp.push(key); } - $.cookie('srv_profiles', tmp); + $.cookie('xcat_srv_profiles', tmp); // Save OS versions in a cookie tmp = new Array; for (var key in osVersHash) { tmp.push(key); } - $.cookie('srv_osvers', tmp); + $.cookie('xcat_srv_osvers', tmp); // Save OS architectures in a cookie tmp = new Array; for (var key in osArchsHash) { tmp.push(key); } - $.cookie('srv_osarchs', tmp); + $.cookie('xcat_srv_osarchs', tmp); } @@ -1111,7 +1111,7 @@ function setUserNodes(data) { // Set cookie to expire in 240 minutes var exDate = new Date(); exDate.setTime(exDate.getTime() + (240 * 60 * 1000)); - $.cookie(userName + '_usrnodes', usrNodes, { expires: exDate }); + $.cookie('xcat_' + userName + '_usrnodes', usrNodes, { expires: exDate, path: '/xcat', secure:true }); } // End of if } @@ -1316,10 +1316,10 @@ function monitorNode(node, monitor) { function cloneNode(tgtNodes) { var userName = $.cookie('xcat_username'); var nodes = tgtNodes.split(','); - var tmp = $.cookie(userName + '_usrnodes'); + var tmp = $.cookie('xcat_' + userName + '_usrnodes'); var usrNodes = tmp.split(','); - var maxVM = parseInt($.cookie(userName + '_maxvm')); + var maxVM = parseInt($.cookie('xcat_' + userName + '_maxvm')); // Do not allow user to clone if the maximum number of VMs is reached if (usrNodes.length >= maxVM) { @@ -1596,7 +1596,7 @@ function unlockNode(tgtNodes) { */ function getNodesCurrentLoad(){ var userName = $.cookie('xcat_username'); - var nodes = $.cookie(userName + '_usrnodes'); + var nodes = $.cookie('xcat_' + userName + '_usrnodes'); // Get nodes current status $.ajax({ @@ -2147,7 +2147,7 @@ function setMaxVM() { // Set cookie to expire in 60 minutes var exDate = new Date(); exDate.setTime(exDate.getTime() + (240 * 60 * 1000)); - $.cookie(userName + '_maxvm', rsp, { expires: exDate }); + $.cookie('xcat_' + userName + '_maxvm', rsp, { expires: exDate }); } }); } \ No newline at end of file diff --git a/xCAT-UI/js/srv_xcatauth.js b/xCAT-UI/js/srv_xcatauth.js index c86d56af4..be3314432 100644 --- a/xCAT-UI/js/srv_xcatauth.js +++ b/xCAT-UI/js/srv_xcatauth.js @@ -4,30 +4,30 @@ $(document).ready(function() { $('#header').remove(); $('#content').remove(); - + var winHeight = document.body.clientHeight; var diagHeight = $('#login').css('height'); diagHeight = diagHeight.substr(0, diagHeight.length - 2); diagHeight = Number(diagHeight); - + // The window's height is to small to show the dialog var tmpHeight = 0; if ((winHeight - 50) < diagHeight){ tmpHeight = 0; } else { - tmpHeight = parseInt((winHeight - diagHeight - 50) / 2); + tmpHeight = parseInt((winHeight - diagHeight - 50) / 2); } - + $('#login').css('margin', tmpHeight + 'px auto'); $('button').bind('click', function(){ authenticate(); }).button(); - + if (document.location.protocol == 'http:') { $('#login-status').html('You are using an unencrypted session!'); $('#login-status').css('color', 'red'); } - + if (!$("#login input[name='username']").val()) { $("#login input[name='username']").focus(); } else { @@ -51,7 +51,7 @@ $(document).ready(function() { /** * Update login dialog - * + * * @param data Data returned from AJAX call * @param txtStatus Status of login */ @@ -62,11 +62,11 @@ function onlogin(data, txtStatus) { if (data.authenticated == 'yes') { $('#login-status').text('Login successful'); window.location = 'service.php'; - + // Set user name cookie var exDate = new Date(); exDate.setTime(exDate.getTime() + (240 * 60 * 1000)); - $.cookie('xcat_username', usrName, { expires: exDate }); + $.cookie('xcat_username', usrName, { expires: exDate, path: '/xcat', secure:true }); } else { $('#login-status').text('Authentication failure'); $('#login-status').css('color', '#FF0000'); @@ -79,7 +79,7 @@ function onlogin(data, txtStatus) { function authenticate() { $('#login-status').css('color', '#000000'); $('#login-status').html('Authenticating...'); - + var passwd = $("#login input[name='password']").val(); $.post('lib/srv_log.php', { username : $("#login input[name='username']").val(), diff --git a/xCAT-UI/js/ui.js b/xCAT-UI/js/ui.js index c0600d7a5..771fa5d65 100644 --- a/xCAT-UI/js/ui.js +++ b/xCAT-UI/js/ui.js @@ -1,8 +1,11 @@ /** * Tab constructor * - * @param tabId Tab ID - * @param tabName Tab name + * @param tabId + * Tab ID + * @param tabName + * Tab name + * @return Nothing */ var Tab = function(tabId) { this.tabId = tabId; @@ -29,8 +32,8 @@ Tab.prototype.init = function() { tabs.bind('tabsselect', function(event, ui){ // Save the order tabs were selected var order; - if ($.cookie('tabindex_history')) { - order = $.cookie('tabindex_history').split(','); + if ($.cookie('xcat_tabindex_history')) { + order = $.cookie('xcat_tabindex_history').split(','); order[1] = order[0]; // Set index 1 to last selected tab order[0] = ui.index; // Set index 0 to currently selected tab } else { @@ -40,7 +43,7 @@ Tab.prototype.init = function() { order[1] = ui.index; } - $.cookie('tabindex_history', order); + $.cookie('xcat_tabindex_history', order, { path: '/xcat', secure:true }); }); // Remove dummy tab @@ -97,7 +100,7 @@ Tab.prototype.add = function(tabId, tabName, tabCont, closeable) { // Go back to last tab if user is trying to close currently selected tab if (tabs.tabs('option', 'selected') == tabIndex) { // Get last selected tab from history - var order = $.cookie('tabindex_history').split(','); + var order = $.cookie('xcat_tabindex_history').split(','); if (order[1]) { tabs.tabs('select', parseInt(order[1])); } else { diff --git a/xCAT-UI/js/xcatauth.js b/xCAT-UI/js/xcatauth.js index ef363759d..3aad393d1 100644 --- a/xCAT-UI/js/xcatauth.js +++ b/xCAT-UI/js/xcatauth.js @@ -4,32 +4,32 @@ $(document).ready(function() { $('#header').remove(); $('#content').remove(); - + var winheight = document.body.clientHeight; var diaheight = $('#login').css('height'); diaheight = diaheight.substr(0, diaheight.length - 2); diaheight = Number(diaheight); - + // The window's height is to small to show the dialog var tempheight = 0; if ((winheight - 50) < diaheight){ tempheight = 0; } else { - tempheight = parseInt((winheight - diaheight - 50) / 2); + tempheight = parseInt((winheight - diaheight - 50) / 2); } - + $('#login').css('margin', tempheight + 'px auto'); $('button').bind('click', function(){ authenticate(); }); - + $('#login button').button(); - + if (document.location.protocol == "http:") { $("#login-status").html("You are using an unencrypted session!"); $("#login-status").css("color", "#ff0000"); } - + if ($("#login input[name='username']").val() == "") { $("#login input[name='username']").focus(); } else { @@ -53,7 +53,7 @@ $(document).ready(function() { /** * Update login dialog - * + * * @param data Data returned from AJAX call * @param txtStatus Status of login */ @@ -64,25 +64,26 @@ function onlogin(data, txtStatus) { $("#login-status").text("Login successful"); // Not the first time to log - if ($.cookie('logonflag')){ + if ($.cookie('xcat_logonflag')){ // Remembered what page they were trying to go to window.location = window.location.pathname; } else { window.location = 'help.php'; } - + // Set user name cookie var usrName = $("#login input[name='username']").val(); var exDate = new Date(); exDate.setTime(exDate.getTime() + (240 * 60 * 1000)); - $.cookie('xcat_username', usrName, { expires: exDate }); - + $.cookie('xcat_username', usrName, { expires: exDate, path: '/xcat', secure:true }); + // Set the logonflag - $.cookie('logonflag', 'yes', { + $.cookie('xcat_logonflag', 'yes', { path : '/xcat', - expires : 100 + expires : 100, + secure:true }); - + } else { $("#login-status").text("Authentication failure").css("color", "#FF0000"); } diff --git a/xCAT-UI/lib/functions.php b/xCAT-UI/lib/functions.php index 51827fc4e..20c27efa6 100644 --- a/xCAT-UI/lib/functions.php +++ b/xCAT-UI/lib/functions.php @@ -101,7 +101,7 @@ function submit_request($req, $skipVerify, $opts_array){ if ($flush){ echo str_pad('',1024)."\n"; } - + while (!feof($fp)) { // Read until there is no more // Remove newlines and add it to the response @@ -118,7 +118,7 @@ function submit_request($req, $skipVerify, $opts_array){ } else { $flushtail = ''; } - + $str = preg_replace('/.*<\/errorcode>/', '', $str); // Strip HTML tags from output if ($tmp = trim(strip_tags($str))) { @@ -127,7 +127,7 @@ function submit_request($req, $skipVerify, $opts_array){ format_TBD($tmp); } else { $tmp = preg_replace('/\n\s*/', "\n", $tmp); - + // Print out output by default echo '
            ' . $tmp . '
            '; ob_flush(); @@ -180,7 +180,7 @@ function submit_request($req, $skipVerify, $opts_array){ $rsp = FALSE; } } - + return $rsp; } @@ -201,10 +201,10 @@ function xorcrypt($data, $key) { * Get password */ function getpassword() { - if (isset($GLOBALS['xcatauthsecret'])) { - $cryptext = $GLOBALS['xcatauthsecret']; - } else if (isset($_COOKIE["xcatauthsecret"])) { - $cryptext = $_COOKIE["xcatauthsecret"]; + if (isset($GLOBALS['xcat_authsecret'])) { + $cryptext = $GLOBALS['xcat_authsecret']; + } else if (isset($_COOKIE["xcat_authsecret"])) { + $cryptext = $_COOKIE["xcat_authsecret"]; } else { return false; } @@ -214,7 +214,7 @@ function getpassword() { /** * Get the password splitting knowledge between server and client side persistant storage. - * Caller should regenerate session ID when contemplating a new user/password, + * Caller should regenerate session ID when contemplating a new user/password, * to preclude session fixation, though fixation is limited without the secret. * * @param $password Password @@ -226,8 +226,8 @@ function setpassword($password) { // Non-ascii characters, encode it in base64 $cryptext = base64_encode($cryptext); - setcookie("xcatauthsecret",$cryptext,0,'/'); - $GLOBALS["xcatauthsecret"] = $cryptext; + setcookie("xcat_authsecret",$cryptext,0,'/xcat','',true); + $GLOBALS["xcat_authsecret"] = $cryptext; $_SESSION["secretkey"] = $key; } @@ -342,18 +342,31 @@ function isRootAcess() { * Log out of current user session */ function logout() { + session_start(); // Clear the secret cookie from browser - if (isset($_COOKIE["xcatauthsecret"])) { - setcookie("xcatauthsecret",'',time()-86400*7,'/'); + if (isset($_COOKIE["xcat_authsecret"])) { + setcookie("xcat_authsecret",'',time()-86400*7,'/xcat','',true); + } + + // Clear any cookies where the key starts with "xcat_" + foreach ($_COOKIE as $key => $value) { + if (substr($key,0,5) === "xcat_") { + unset($_COOKIE[$key]); + setcookie($key, null, time() - 3600, '/xcat','',true); + } } // Expire session cookie if (isset($_COOKIE[session_name()])) { - setcookie(session_name(),"",time()-86400*7,"/"); + setcookie(session_name(),"",time()-86400*7,"/xcat",'',true); } + // Clear session id + setcookie(session_id(),"",time()-86400*7,"/"); + // Clear server store of data $_SESSION=array(); + session_destroy(); } /** diff --git a/xCAT-UI/lib/srv_functions.php b/xCAT-UI/lib/srv_functions.php index 6dafe540e..4481eba3c 100644 --- a/xCAT-UI/lib/srv_functions.php +++ b/xCAT-UI/lib/srv_functions.php @@ -208,10 +208,10 @@ function format_TBD($str) { * Get password */ function getpassword() { - if (isset($GLOBALS['xcatauthsecret'])) { - $cryptext = $GLOBALS['xcatauthsecret']; - } else if (isset($_COOKIE["xcatauthsecret"])) { - $cryptext = $_COOKIE["xcatauthsecret"]; + if (isset($GLOBALS['xcat_authsecret'])) { + $cryptext = $GLOBALS['xcat_authsecret']; + } else if (isset($_COOKIE["xcat_authsecret"])) { + $cryptext = $_COOKIE["xcat_authsecret"]; } else { return false; } @@ -233,8 +233,8 @@ function setpassword($password) { // Non-ascii characters, encode it in base64 $cryptext = base64_encode($cryptext); - setcookie("xcatauthsecret",$cryptext,0,'/'); - $GLOBALS["xcatauthsecret"] = $cryptext; + setcookie("xcat_authsecret",$cryptext,0,'/xcat','',true); + $GLOBALS["xcat_authsecret"] = $cryptext; $_SESSION["secretkey"] = $key; } @@ -285,13 +285,13 @@ function isAuthenticated() { */ function logout() { // Clear the secret cookie from browser - if (isset($_COOKIE["xcatauthsecret"])) { - setcookie("xcatauthsecret",'',time()-86400*7,'/'); + if (isset($_COOKIE["xcat_authsecret"])) { + setcookie("xcat_authsecret",'',time()-86400*7,'/xcat','',true); } // Expire session cookie if (isset($_COOKIE[session_name()])) { - setcookie(session_name(),"",time()-86400*7,"/"); + setcookie(session_name(),"",time()-86400*7,"/xcat",'',true); } // Clear server store of data