From b802a02442d47ce77c68de7fa7aa064bb683be39 Mon Sep 17 00:00:00 2001 From: phamt Date: Thu, 4 Jul 2013 13:49:23 +0000 Subject: [PATCH] Added option to select IPL device. Added more error handling. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.8@16881 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-UI/js/custom/zvmUtils.js | 62 +++++++++++++++++++++++++++-------- 1 file changed, 49 insertions(+), 13 deletions(-) diff --git a/xCAT-UI/js/custom/zvmUtils.js b/xCAT-UI/js/custom/zvmUtils.js index 930cf6afd..bb4b62c33 100644 --- a/xCAT-UI/js/custom/zvmUtils.js +++ b/xCAT-UI/js/custom/zvmUtils.js @@ -420,7 +420,7 @@ function updateZProvisionNewStatus(data) { var diskRows = $('#' + tabId + ' table:eq(0):visible tbody tr'); $.cookie('disks2add' + out2Id, diskRows.length); if (diskRows.length > 0) { - for ( var i = 0; i < diskRows.length; i++) { + for (var i = 0; i < diskRows.length; i++) { var diskArgs = diskRows.eq(i).find('td'); var type = diskArgs.eq(1).find('select').val(); var address = diskArgs.eq(2).find('input').val(); @@ -4934,8 +4934,12 @@ function createZProvisionNew(inst) { var thisNetwork = $('#' + thisTabId + ' select[name=network]'); thisNetwork.children().remove(); + thisNetwork.append(''); // No profile option var definedNetworks = $.cookie(args[0] + 'networks').split(','); for (var i in definedNetworks) { + if (!jQuery.trim(definedNetworks[i])) + continue; + var directoryEntry, interfaceName; // Generate directory entry statement for vSwitch, hipersocket, and guest LAN @@ -5075,6 +5079,7 @@ function createZProvisionNew(inst) { '' + ''); var cpuSelect = $(''); diskRow.append(diskPw); + + // Create IPL checkbox + var diskIpl = $(''); + diskRow.append(diskIpl); + diskIpl.find('input').change(function() { + updateUserEntry(thisTabId); + }); diskBody.append(diskRow); @@ -5247,8 +5259,8 @@ function createZProvisionNew(inst) { // Create zFCP table var zfcpDiv = $('
'); - var zfcpLabel = $(''); - var zfcpTable = $('
'); + var zfcpLabel = $(''); + var zfcpTable = $('
'); var zfcpHeader = $(' Address Size Pool Tag Port Name Unit # LOADDEV'); // Adjust header width zfcpHeader.find('th').css({ @@ -5404,7 +5416,7 @@ function createZProvisionNew(inst) { var selects = $('#' + thisTabId + ' select:visible'); for (var i = 0; i < selects.length; i++) { - if (!selects.eq(i).val() && selects.eq(i).attr('name') != 'os' && selects.eq(i).attr('name') != 'userProfile') { + if (!selects.eq(i).val() && selects.eq(i).attr('name') != 'os' && selects.eq(i).attr('name') != 'userProfile' && selects.eq(i).attr('name') != 'network') { selects.eq(i).css('border', 'solid #FF0000 1px'); ready = false; } else { @@ -6593,9 +6605,26 @@ function updateUserEntry(tabId) { privilege.push($(this).val()); }); privilege = privilege.join(''); - - var userDirectoryEntry = generateUserEntry(userId, "XCAT", memory, privilege, profile, cpuCount, network); - $('#' + tabId + ' textarea').val(userDirectoryEntry); + + // Find device to be IPL + var diskRows = $('#' + tabId + ' table:eq(0):visible tbody tr'); + var ipl; + for (var i = 0; i < diskRows.length; i++) { + var diskArgs = diskRows.eq(i).find('td'); + var address = diskArgs.eq(2).find('input').val(); + if (diskArgs.eq(7).find('input').attr("checked") === true) { + ipl = address; + break; + } + } + + // Only update directory entry if the basic tab is selected + var inst = tabId.replace('zvmProvisionTab', ''); + var hwTabIndex = $("#hwConfig" + inst).tabs('option', 'selected'); + if (hwTabIndex == 0) { + var userDirectoryEntry = generateUserEntry(userId, "XCAT", memory, privilege, profile, cpuCount, network, ipl); + $('#' + tabId + ' textarea').val(userDirectoryEntry); + } } /** @@ -6607,11 +6636,12 @@ function updateUserEntry(tabId) { * @param privilege User privilege class * @param profile User profile * @param cpuCount Number of CPU to assign to virtual machine - * @param network Network interface used by virtual machine + * @param network Network interface used by virtual machine + * @param ipl The device to be IPL * * @returns User directory entry */ -function generateUserEntry(userId, password, memory, privilege, profile, cpuCount, network) { +function generateUserEntry(userId, password, memory, privilege, profile, cpuCount, network, ipl) { var userDirectoryEntry = "USER " + userId + " XCAT " + memory + " " + memory + " " + privilege + "\n"; // Include user profile if there is one @@ -6624,6 +6654,12 @@ function generateUserEntry(userId, password, memory, privilege, profile, cpuCoun userDirectoryEntry += "CPU 0" + i + "\n"; } + // Set device IPL + if (ipl) { + userDirectoryEntry += "IPL " + ipl + "\n"; + } + + userDirectoryEntry += "MACHINE ESA\n"; // Simulate s390 architecture userDirectoryEntry += "CONSOLE 0009 3215 T\n"; // Include network interface if given @@ -6634,6 +6670,6 @@ function generateUserEntry(userId, password, memory, privilege, profile, cpuCoun userDirectoryEntry += "SPOOL 000C 2540 READER *\n"; userDirectoryEntry += "SPOOL 000D 2540 PUNCH A\n"; userDirectoryEntry += "SPOOL 000E 1403 A\n"; - + return userDirectoryEntry; } \ No newline at end of file