Fixed gennodename() to handle VLSM. Fixed provision page layouts.
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@11265 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
678db1648e
commit
17298c84b7
@ -592,6 +592,26 @@ function createBladeProvisionExisting(inst) {
|
||||
// Create provision existing division
|
||||
var provExisting = $('<div></div>');
|
||||
|
||||
// Create VM fieldset
|
||||
var nodeFS = $('<fieldset></fieldset>');
|
||||
var nodeLegend = $('<legend>Node</legend>');
|
||||
nodeFS.append(nodeLegend);
|
||||
|
||||
var nodeAttr = $('<div style="display: inline-table; vertical-align: middle; width: 85%; margin-left: 10px;"></div>');
|
||||
nodeFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/computer.png"></img></div>'));
|
||||
nodeFS.append(nodeAttr);
|
||||
|
||||
// Create image fieldset
|
||||
var imgFS = $('<fieldset></fieldset>');
|
||||
var imgLegend = $('<legend>Image</legend>');
|
||||
imgFS.append(imgLegend);
|
||||
|
||||
var imgAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>');
|
||||
imgFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/operating_system.png"></img></div>'));
|
||||
imgFS.append(imgAttr);
|
||||
|
||||
provExisting.append(nodeFS, imgFS);
|
||||
|
||||
// Create group input
|
||||
var group = $('<div></div>');
|
||||
var groupLabel = $('<label for="provType">Group:</label>');
|
||||
@ -628,7 +648,7 @@ function createBladeProvisionExisting(inst) {
|
||||
var groupInput = $('<input type="text" name="group"/>');
|
||||
group.append(groupInput);
|
||||
}
|
||||
provExisting.append(group);
|
||||
nodeAttr.append(group);
|
||||
|
||||
// Create node input
|
||||
var node = $('<div></div>');
|
||||
@ -636,7 +656,7 @@ function createBladeProvisionExisting(inst) {
|
||||
var nodeDatatable = $('<div id="' + dTableDivId + '" style="display: inline-block; max-width: 800px;"><p>Select a group to view its nodes</p></div>');
|
||||
node.append(nodeLabel);
|
||||
node.append(nodeDatatable);
|
||||
provExisting.append(node);
|
||||
nodeAttr.append(node);
|
||||
|
||||
// Create boot method drop down
|
||||
var method = $('<div></div>');
|
||||
@ -651,7 +671,7 @@ function createBladeProvisionExisting(inst) {
|
||||
);
|
||||
method.append(methodLabel);
|
||||
method.append(methodSelect);
|
||||
provExisting.append(method);
|
||||
imgAttr.append(method);
|
||||
|
||||
// Create operating system input
|
||||
var os = $('<div></div>');
|
||||
@ -668,7 +688,7 @@ function createBladeProvisionExisting(inst) {
|
||||
});
|
||||
os.append(osLabel);
|
||||
os.append(osInput);
|
||||
provExisting.append(os);
|
||||
imgAttr.append(os);
|
||||
|
||||
// Create architecture input
|
||||
var arch = $('<div></div>');
|
||||
@ -685,7 +705,7 @@ function createBladeProvisionExisting(inst) {
|
||||
});
|
||||
arch.append(archLabel);
|
||||
arch.append(archInput);
|
||||
provExisting.append(arch);
|
||||
imgAttr.append(arch);
|
||||
|
||||
// Create profile input
|
||||
var profile = $('<div></div>');
|
||||
@ -702,7 +722,7 @@ function createBladeProvisionExisting(inst) {
|
||||
});
|
||||
profile.append(profileLabel);
|
||||
profile.append(profileInput);
|
||||
provExisting.append(profile);
|
||||
imgAttr.append(profile);
|
||||
|
||||
/**
|
||||
* Provision existing
|
||||
|
@ -163,24 +163,39 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) {
|
||||
var provForm = $('<div class="form"></div>');
|
||||
|
||||
// Create info bar
|
||||
var infoBar = createInfoBar('Provision an VMware virtual machine.');
|
||||
var infoBar = createInfoBar('Provision an KVM virtual machine.');
|
||||
provForm.append(infoBar);
|
||||
|
||||
// Append to provision tab
|
||||
$('#' + tabId).append(provForm);
|
||||
|
||||
// Create VM fieldset
|
||||
var vmFS = $('<fieldset></fieldset>');
|
||||
var vmLegend = $('<legend>Virtual Machine</legend>');
|
||||
vmFS.append(vmLegend);
|
||||
|
||||
var vmAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>');
|
||||
vmFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/computer.png"></img></div>'));
|
||||
vmFS.append(vmAttr);
|
||||
|
||||
// Create hardware fieldset
|
||||
var hwFS = $('<fieldset></fieldset>');
|
||||
var hwLegend = $('<legend>Hardware</legend>');
|
||||
hwFS.append(hwLegend);
|
||||
|
||||
var hwAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>');
|
||||
hwFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/hardware.png"></img></div>'));
|
||||
hwFS.append(hwAttr);
|
||||
|
||||
// Create image fieldset
|
||||
var imgFS = $('<fieldset></fieldset>');
|
||||
var imgLegend = $('<legend>Image</legend>');
|
||||
imgFS.append(imgLegend);
|
||||
|
||||
var imgAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>');
|
||||
imgFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/operating_system.png"></img></div>'));
|
||||
imgFS.append(imgAttr);
|
||||
|
||||
provForm.append(vmFS, hwFS, imgFS);
|
||||
|
||||
// Create hypervisor input
|
||||
@ -189,7 +204,7 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) {
|
||||
host.append(hostLabel);
|
||||
var hostInput = $('<input type="text" name="host"/>');
|
||||
host.append(hostInput);
|
||||
vmFS.append(host);
|
||||
vmAttr.append(host);
|
||||
|
||||
// Create group input
|
||||
var group = $('<div></div>');
|
||||
@ -216,7 +231,7 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) {
|
||||
var groupInput = $('<input type="text" name="group"/>');
|
||||
group.append(groupInput);
|
||||
}
|
||||
vmFS.append(group);
|
||||
vmAttr.append(group);
|
||||
|
||||
// Create node input
|
||||
var node = $('<div></div>');
|
||||
@ -224,7 +239,7 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) {
|
||||
var nodeInput = $('<input type="text" name="node"/>');
|
||||
node.append(nodeLabel);
|
||||
node.append(nodeInput);
|
||||
vmFS.append(node);
|
||||
vmAttr.append(node);
|
||||
|
||||
// Create memory input
|
||||
var memory = $('<div></div>');
|
||||
@ -232,7 +247,7 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) {
|
||||
var memoryInput = $('<input type="text" name="memory" size="5"/>');
|
||||
memory.append(memoryLabel);
|
||||
memory.append(memoryInput);
|
||||
hwFS.append(memory);
|
||||
hwAttr.append(memory);
|
||||
|
||||
// Create processor dropdown
|
||||
var cpu = $('<div></div>');
|
||||
@ -249,7 +264,7 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) {
|
||||
);
|
||||
cpu.append(cpuLabel);
|
||||
cpu.append(cpuSelect);
|
||||
hwFS.append(cpu);
|
||||
hwAttr.append(cpu);
|
||||
|
||||
// Create NIC dropdown
|
||||
var nic = $('<div></div>');
|
||||
@ -257,7 +272,7 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) {
|
||||
var nicInput = $('<input type="text" name="nic"/>');
|
||||
nic.append(nicLabel);
|
||||
nic.append(nicInput);
|
||||
hwFS.append(nic);
|
||||
hwAttr.append(nic);
|
||||
|
||||
// Create disk input
|
||||
var disk = $('<div></div>');
|
||||
@ -268,7 +283,7 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) {
|
||||
'<option value="M">MB</option>'
|
||||
);
|
||||
disk.append(diskLabel, diskInput, diskSizeSelect);
|
||||
hwFS.append(disk);
|
||||
hwAttr.append(disk);
|
||||
|
||||
// Create disk storage input
|
||||
var storage = $('<div></div>');
|
||||
@ -276,7 +291,7 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) {
|
||||
var storageInput = $('<input type="text" name="storage"/>');
|
||||
storage.append(storageLabel);
|
||||
storage.append(storageInput);
|
||||
hwFS.append(storage);
|
||||
hwAttr.append(storage);
|
||||
|
||||
// Create operating system input
|
||||
var os = $('<div></div>');
|
||||
@ -293,7 +308,7 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) {
|
||||
});
|
||||
os.append(osLabel);
|
||||
os.append(osInput);
|
||||
imgFS.append(os);
|
||||
imgAttr.append(os);
|
||||
|
||||
// Create architecture input
|
||||
var arch = $('<div></div>');
|
||||
@ -310,7 +325,7 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) {
|
||||
});
|
||||
arch.append(archLabel);
|
||||
arch.append(archInput);
|
||||
imgFS.append(arch);
|
||||
imgAttr.append(arch);
|
||||
|
||||
// Create profile input
|
||||
var profile = $('<div></div>');
|
||||
@ -327,7 +342,7 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) {
|
||||
});
|
||||
profile.append(profileLabel);
|
||||
profile.append(profileInput);
|
||||
imgFS.append(profile);
|
||||
imgAttr.append(profile);
|
||||
|
||||
// Create boot method dropdown
|
||||
var method = $('<div></div>');
|
||||
@ -342,7 +357,7 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) {
|
||||
);
|
||||
method.append(methodLabel);
|
||||
method.append(methodSelect);
|
||||
imgFS.append(method);
|
||||
imgAttr.append(method);
|
||||
|
||||
/**
|
||||
* Provision existing
|
||||
|
@ -334,6 +334,26 @@ function createIpmiProvisionExisting(inst) {
|
||||
// Create provision existing division
|
||||
var provExisting = $('<div></div>');
|
||||
|
||||
// Create VM fieldset
|
||||
var nodeFS = $('<fieldset></fieldset>');
|
||||
var nodeLegend = $('<legend>Node</legend>');
|
||||
nodeFS.append(nodeLegend);
|
||||
|
||||
var nodeAttr = $('<div style="display: inline-table; vertical-align: middle; width: 85%; margin-left: 10px;"></div>');
|
||||
nodeFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/computer.png"></img></div>'));
|
||||
nodeFS.append(nodeAttr);
|
||||
|
||||
// Create image fieldset
|
||||
var imgFS = $('<fieldset></fieldset>');
|
||||
var imgLegend = $('<legend>Image</legend>');
|
||||
imgFS.append(imgLegend);
|
||||
|
||||
var imgAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>');
|
||||
imgFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/operating_system.png"></img></div>'));
|
||||
imgFS.append(imgAttr);
|
||||
|
||||
provExisting.append(nodeFS, imgFS);
|
||||
|
||||
// Create group input
|
||||
var group = $('<div></div>');
|
||||
var groupLabel = $('<label for="provType">Group:</label>');
|
||||
@ -370,7 +390,7 @@ function createIpmiProvisionExisting(inst) {
|
||||
var groupInput = $('<input type="text" name="group"/>');
|
||||
group.append(groupInput);
|
||||
}
|
||||
provExisting.append(group);
|
||||
nodeAttr.append(group);
|
||||
|
||||
// Create node input
|
||||
var node = $('<div></div>');
|
||||
@ -378,7 +398,7 @@ function createIpmiProvisionExisting(inst) {
|
||||
var nodeDatatable = $('<div id="' + dTableDivId + '" style="display: inline-block; max-width: 800px;"><p>Select a group to view its nodes</p></div>');
|
||||
node.append(nodeLabel);
|
||||
node.append(nodeDatatable);
|
||||
provExisting.append(node);
|
||||
nodeAttr.append(node);
|
||||
|
||||
// Create boot method drop down
|
||||
var method = $('<div></div>');
|
||||
@ -393,7 +413,7 @@ function createIpmiProvisionExisting(inst) {
|
||||
);
|
||||
method.append(methodLabel);
|
||||
method.append(methodSelect);
|
||||
provExisting.append(method);
|
||||
imgAttr.append(method);
|
||||
|
||||
// Create operating system input
|
||||
var os = $('<div></div>');
|
||||
@ -410,7 +430,7 @@ function createIpmiProvisionExisting(inst) {
|
||||
});
|
||||
os.append(osLabel);
|
||||
os.append(osInput);
|
||||
provExisting.append(os);
|
||||
imgAttr.append(os);
|
||||
|
||||
// Create architecture input
|
||||
var arch = $('<div></div>');
|
||||
@ -427,7 +447,7 @@ function createIpmiProvisionExisting(inst) {
|
||||
});
|
||||
arch.append(archLabel);
|
||||
arch.append(archInput);
|
||||
provExisting.append(arch);
|
||||
imgAttr.append(arch);
|
||||
|
||||
// Create profile input
|
||||
var profile = $('<div></div>');
|
||||
@ -444,7 +464,7 @@ function createIpmiProvisionExisting(inst) {
|
||||
});
|
||||
profile.append(profileLabel);
|
||||
profile.append(profileInput);
|
||||
provExisting.append(profile);
|
||||
imgAttr.append(profile);
|
||||
|
||||
/**
|
||||
* Provision existing
|
||||
|
@ -169,18 +169,33 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) {
|
||||
// Append to provision tab
|
||||
$('#' + tabId).append(provForm);
|
||||
|
||||
// Create VM fieldset
|
||||
var vmFS = $('<fieldset></fieldset>');
|
||||
var vmLegend = $('<legend>Virtual Machine</legend>');
|
||||
vmFS.append(vmLegend);
|
||||
|
||||
var vmAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>');
|
||||
vmFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/computer.png"></img></div>'));
|
||||
vmFS.append(vmAttr);
|
||||
|
||||
// Create hardware fieldset
|
||||
var hwFS = $('<fieldset></fieldset>');
|
||||
var hwLegend = $('<legend>Hardware</legend>');
|
||||
hwFS.append(hwLegend);
|
||||
|
||||
var hwAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>');
|
||||
hwFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/hardware.png"></img></div>'));
|
||||
hwFS.append(hwAttr);
|
||||
|
||||
// Create image fieldset
|
||||
var imgFS = $('<fieldset></fieldset>');
|
||||
var imgLegend = $('<legend>Image</legend>');
|
||||
imgFS.append(imgLegend);
|
||||
|
||||
var imgAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>');
|
||||
imgFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/operating_system.png"></img></div>'));
|
||||
imgFS.append(imgAttr);
|
||||
|
||||
provForm.append(vmFS, hwFS, imgFS);
|
||||
|
||||
// Create hypervisor input
|
||||
@ -189,7 +204,7 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) {
|
||||
host.append(hostLabel);
|
||||
var hostInput = $('<input type="text" name="host"/>');
|
||||
host.append(hostInput);
|
||||
vmFS.append(host);
|
||||
vmAttr.append(host);
|
||||
|
||||
// Create group input
|
||||
var group = $('<div></div>');
|
||||
@ -216,7 +231,7 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) {
|
||||
var groupInput = $('<input type="text" name="group"/>');
|
||||
group.append(groupInput);
|
||||
}
|
||||
vmFS.append(group);
|
||||
vmAttr.append(group);
|
||||
|
||||
// Create node input
|
||||
var node = $('<div></div>');
|
||||
@ -224,7 +239,7 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) {
|
||||
var nodeInput = $('<input type="text" name="node"/>');
|
||||
node.append(nodeLabel);
|
||||
node.append(nodeInput);
|
||||
vmFS.append(node);
|
||||
vmAttr.append(node);
|
||||
|
||||
// Create memory input
|
||||
var memory = $('<div></div>');
|
||||
@ -232,7 +247,7 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) {
|
||||
var memoryInput = $('<input type="text" name="memory" size="5"/>');
|
||||
memory.append(memoryLabel);
|
||||
memory.append(memoryInput);
|
||||
hwFS.append(memory);
|
||||
hwAttr.append(memory);
|
||||
|
||||
// Create processor dropdown
|
||||
var cpu = $('<div></div>');
|
||||
@ -249,7 +264,7 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) {
|
||||
);
|
||||
cpu.append(cpuLabel);
|
||||
cpu.append(cpuSelect);
|
||||
hwFS.append(cpu);
|
||||
hwAttr.append(cpu);
|
||||
|
||||
// Create NIC dropdown
|
||||
var nic = $('<div></div>');
|
||||
@ -257,7 +272,7 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) {
|
||||
var nicInput = $('<input type="text" name="nic"/>');
|
||||
nic.append(nicLabel);
|
||||
nic.append(nicInput);
|
||||
hwFS.append(nic);
|
||||
hwAttr.append(nic);
|
||||
|
||||
// Create disk input
|
||||
var disk = $('<div></div>');
|
||||
@ -268,7 +283,7 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) {
|
||||
'<option value="M">MB</option>'
|
||||
);
|
||||
disk.append(diskLabel, diskInput, diskSizeSelect);
|
||||
hwFS.append(disk);
|
||||
hwAttr.append(disk);
|
||||
|
||||
// Create disk storage input
|
||||
var storage = $('<div></div>');
|
||||
@ -276,7 +291,7 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) {
|
||||
var storageInput = $('<input type="text" name="storage"/>');
|
||||
storage.append(storageLabel);
|
||||
storage.append(storageInput);
|
||||
hwFS.append(storage);
|
||||
hwAttr.append(storage);
|
||||
|
||||
// Create operating system input
|
||||
var os = $('<div></div>');
|
||||
@ -293,7 +308,7 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) {
|
||||
});
|
||||
os.append(osLabel);
|
||||
os.append(osInput);
|
||||
imgFS.append(os);
|
||||
imgAttr.append(os);
|
||||
|
||||
// Create architecture input
|
||||
var arch = $('<div></div>');
|
||||
@ -310,7 +325,7 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) {
|
||||
});
|
||||
arch.append(archLabel);
|
||||
arch.append(archInput);
|
||||
imgFS.append(arch);
|
||||
imgAttr.append(arch);
|
||||
|
||||
// Create profile input
|
||||
var profile = $('<div></div>');
|
||||
@ -327,7 +342,7 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) {
|
||||
});
|
||||
profile.append(profileLabel);
|
||||
profile.append(profileInput);
|
||||
imgFS.append(profile);
|
||||
imgAttr.append(profile);
|
||||
|
||||
// Create boot method dropdown
|
||||
var method = $('<div></div>');
|
||||
@ -342,7 +357,7 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) {
|
||||
);
|
||||
method.append(methodLabel);
|
||||
method.append(methodSelect);
|
||||
imgFS.append(method);
|
||||
imgAttr.append(method);
|
||||
|
||||
/**
|
||||
* Provision existing
|
||||
|
@ -504,20 +504,30 @@ zvmPlugin.prototype.loadClonePage = function(node) {
|
||||
cloneForm.append(statBar);
|
||||
cloneForm.append(infoBar);
|
||||
|
||||
// Create VM fieldset
|
||||
var vmFS = $('<fieldset></fieldset>');
|
||||
var vmLegend = $('<legend>Virtual Machine</legend>');
|
||||
vmFS.append(vmLegend);
|
||||
cloneForm.append(vmFS);
|
||||
|
||||
var vmAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>');
|
||||
vmFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/computer.png"></img></div>'));
|
||||
vmFS.append(vmAttr);
|
||||
|
||||
// Create hardware fieldset
|
||||
var hwFS = $('<fieldset></fieldset>');
|
||||
var hwLegend = $('<legend>Hardware</legend>');
|
||||
hwFS.append(hwLegend);
|
||||
cloneForm.append(hwFS);
|
||||
|
||||
vmFS.append('<div><label>Target node range:</label><input type="text" id="tgtNode" name="tgtNode" title="You must give a node or a node range. A node range must be given as: node1-node9 or node[1-9]."/></div>');
|
||||
vmFS.append('<div><label>Target user ID range:</label><input type="text" id="tgtUserId" name="tgtUserId" title="You must give a user ID or a user ID range. A user ID range must be given as: user1-user9 or user[1-9]."/></div>');
|
||||
vmFS.append('<div><label>Clone source:</label><input type="text" id="srcNode" name="srcNode" readonly="readonly" value="' + node + '" title="The source node to be cloned"/></div>');
|
||||
vmFS.append('<div><label>Hardware control point:</label><input type="text" id="newHcp" name="newHcp" readonly="readonly" value="' + hcp + '" title="The System z hardware control point (zHCP) responsible for managing the node(s). It must be the same as the source node."/></div>');
|
||||
var hwAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>');
|
||||
hwFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/hardware.png"></img></div>'));
|
||||
hwFS.append(hwAttr);
|
||||
|
||||
vmAttr.append('<div><label>Target node range:</label><input type="text" id="tgtNode" name="tgtNode" title="You must give a node or a node range. A node range must be given as: node1-node9 or node[1-9]."/></div>');
|
||||
vmAttr.append('<div><label>Target user ID range:</label><input type="text" id="tgtUserId" name="tgtUserId" title="You must give a user ID or a user ID range. A user ID range must be given as: user1-user9 or user[1-9]."/></div>');
|
||||
vmAttr.append('<div><label>Clone source:</label><input type="text" id="srcNode" name="srcNode" readonly="readonly" value="' + node + '" title="The source node to be cloned"/></div>');
|
||||
vmAttr.append('<div><label>Hardware control point:</label><input type="text" id="newHcp" name="newHcp" readonly="readonly" value="' + hcp + '" title="The System z hardware control point (zHCP) responsible for managing the node(s). It must be the same as the source node."/></div>');
|
||||
|
||||
// Create group input
|
||||
var group = $('<div></div>');
|
||||
@ -534,7 +544,7 @@ zvmPlugin.prototype.loadClonePage = function(node) {
|
||||
});
|
||||
group.append(groupLabel);
|
||||
group.append(groupInput);
|
||||
vmFS.append(group);
|
||||
vmAttr.append(group);
|
||||
|
||||
// Get list of disk pools
|
||||
var temp = hcp.split('.');
|
||||
@ -548,9 +558,9 @@ zvmPlugin.prototype.loadClonePage = function(node) {
|
||||
});
|
||||
poolDiv.append(poolLabel);
|
||||
poolDiv.append(poolInput);
|
||||
hwFS.append(poolDiv);
|
||||
hwAttr.append(poolDiv);
|
||||
|
||||
hwFS.append('<div><label>Disk password:</label><input type="password" id="diskPw" name="diskPw" title="The password that will be used for accessing the disk. This input is optional."/></div>');
|
||||
hwAttr.append('<div><label>Disk password:</label><input type="password" id="diskPw" name="diskPw" title="The password that will be used for accessing the disk. This input is optional."/></div>');
|
||||
|
||||
// Generate tooltips
|
||||
cloneForm.find('div input[title]').tooltip({
|
||||
|
@ -1160,7 +1160,7 @@ function openAddProcDialog(node) {
|
||||
|
||||
// If inputs are not complete, show warning message
|
||||
if (!node || !address || !type) {
|
||||
var warn = createWarnBar('You are missing inputs.');
|
||||
var warn = createWarnBar('Please provide a value for each missing field.');
|
||||
warn.prependTo($(this));
|
||||
} else {
|
||||
// Add processor
|
||||
@ -1269,7 +1269,7 @@ function openAddDiskDialog(node, hcp) {
|
||||
|
||||
// If inputs are not complete, show warning message
|
||||
if (!node || !type || !address || !size || !pool || !mode) {
|
||||
var warn = createWarnBar('You are missing inputs.');
|
||||
var warn = createWarnBar('Please provide a value for each missing field.');
|
||||
warn.prependTo($(this));
|
||||
} else {
|
||||
// Add disk
|
||||
@ -1500,7 +1500,7 @@ function openAddNicDialog(node, hcp) {
|
||||
|
||||
// If inputs are not complete, show warning message
|
||||
if (!node || !nicType || !networkType || !address) {
|
||||
errMsg = 'You are missing inputs.<br>';
|
||||
errMsg = 'Please provide a value for each missing field.<br>';
|
||||
ready = false;
|
||||
}
|
||||
|
||||
@ -1993,10 +1993,18 @@ function createZProvisionExisting(inst) {
|
||||
vmFS.append(vmLegend);
|
||||
provExisting.append(vmFS);
|
||||
|
||||
var vmAttr = $('<div style="display: inline-table; vertical-align: middle; width: 85%; margin-left: 10px;"></div>');
|
||||
vmFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/computer.png"></img></div>'));
|
||||
vmFS.append(vmAttr);
|
||||
|
||||
var osFS = $('<fieldset></fieldset>');
|
||||
var osLegend = $('<legend>Operating System</legend>');
|
||||
osFS.append(osLegend);
|
||||
provExisting.append(osFS);
|
||||
|
||||
var osAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>');
|
||||
osFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/operating_system.png"></img></div>'));
|
||||
osFS.append(osAttr);
|
||||
|
||||
// Create group input
|
||||
var group = $('<div></div>');
|
||||
@ -2033,16 +2041,16 @@ function createZProvisionExisting(inst) {
|
||||
var groupInput = $('<input type="text" name="group"/>');
|
||||
group.append(groupInput);
|
||||
}
|
||||
vmFS.append(group);
|
||||
vmAttr.append(group);
|
||||
|
||||
// Create node input
|
||||
var node = $('<div></div>');
|
||||
var nodeLabel = $('<label for="nodeName">Nodes:</label>');
|
||||
var nodeDatatable = $('<div class="indent" id="zNodesDatatableDIV' + inst + '"><p>Select a group to view its nodes</p></div>');
|
||||
var nodeDatatable = $('<div class="indent" id="zNodesDatatableDIV' + inst + '" style="display: inline-block; max-width: 800px;"><p>Select a group to view its nodes</p></div>');
|
||||
node.append(nodeLabel);
|
||||
node.append(nodeDatatable);
|
||||
vmFS.append(node);
|
||||
|
||||
vmAttr.append(node);
|
||||
|
||||
// Create operating system image input
|
||||
var os = $('<div></div>');
|
||||
var osLabel = $('<label for="os">Operating system image:</label>');
|
||||
@ -2059,7 +2067,7 @@ function createZProvisionExisting(inst) {
|
||||
});
|
||||
os.append(osLabel);
|
||||
os.append(osInput);
|
||||
osFS.append(os);
|
||||
osAttr.append(os);
|
||||
|
||||
// Create boot method drop down
|
||||
var bootMethod = $('<div></div>');
|
||||
@ -2073,7 +2081,7 @@ function createZProvisionExisting(inst) {
|
||||
);
|
||||
bootMethod.append(methoddLabel);
|
||||
bootMethod.append(methodSelect);
|
||||
osFS.append(bootMethod);
|
||||
osAttr.append(bootMethod);
|
||||
|
||||
// Generate tooltips
|
||||
provExisting.find('div input[title]').tooltip({
|
||||
@ -2184,22 +2192,37 @@ function createZProvisionExisting(inst) {
|
||||
function createZProvisionNew(inst) {
|
||||
// Create provision new node division
|
||||
var provNew = $('<div></div>');
|
||||
|
||||
|
||||
// Create VM fieldset
|
||||
var vmFS = $('<fieldset></fieldset>');
|
||||
var vmLegend = $('<legend>Virtual Machine</legend>');
|
||||
vmFS.append(vmLegend);
|
||||
provNew.append(vmFS);
|
||||
|
||||
var vmAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>');
|
||||
vmFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/computer.png"></img></div>'));
|
||||
vmFS.append(vmAttr);
|
||||
|
||||
// Create hardware fieldset
|
||||
var hwFS = $('<fieldset></fieldset>');
|
||||
var hwLegend = $('<legend>Hardware</legend>');
|
||||
hwFS.append(hwLegend);
|
||||
provNew.append(hwFS);
|
||||
|
||||
var hwAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>');
|
||||
hwFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/hardware.png"></img></div>'));
|
||||
hwFS.append(hwAttr);
|
||||
|
||||
// Create OS fieldset
|
||||
var osFS = $('<fieldset></fieldset>');
|
||||
var osLegend = $('<legend>Operating System</legend>');
|
||||
osFS.append(osLegend);
|
||||
provNew.append(osFS);
|
||||
|
||||
var osAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>');
|
||||
osFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/operating_system.png"></img></div>'));
|
||||
osFS.append(osAttr);
|
||||
|
||||
// Create group input
|
||||
var group = $('<div></div>');
|
||||
var groupLabel = $('<label>Group:</label>');
|
||||
@ -2216,7 +2239,7 @@ function createZProvisionNew(inst) {
|
||||
});
|
||||
group.append(groupLabel);
|
||||
group.append(groupInput);
|
||||
vmFS.append(group);
|
||||
vmAttr.append(group);
|
||||
|
||||
// Create node input
|
||||
var nodeName = $('<div></div>');
|
||||
@ -2224,11 +2247,11 @@ function createZProvisionNew(inst) {
|
||||
var nodeInput = $('<input type="text" name="nodeName" title="You must give a node or a node range. A node range must be given as: node1-node9 or node[1-9]."/>');
|
||||
nodeName.append(nodeLabel);
|
||||
nodeName.append(nodeInput);
|
||||
vmFS.append(nodeName);
|
||||
vmAttr.append(nodeName);
|
||||
|
||||
// Create user ID input
|
||||
var userId = $('<div><label>User ID:</label><input type="text" name="userId" title="You must give a user ID or a user ID range. A user ID range must be given as: user1-user9 or user[1-9]."/></div>');
|
||||
vmFS.append(userId);
|
||||
vmAttr.append(userId);
|
||||
|
||||
// Create hardware control point input
|
||||
var hcpDiv = $('<div></div>');
|
||||
@ -2256,7 +2279,7 @@ function createZProvisionNew(inst) {
|
||||
});
|
||||
hcpDiv.append(hcpLabel);
|
||||
hcpDiv.append(hcpInput);
|
||||
vmFS.append(hcpDiv);
|
||||
vmAttr.append(hcpDiv);
|
||||
|
||||
// Create operating system image input
|
||||
var os = $('<div></div>');
|
||||
@ -2274,7 +2297,7 @@ function createZProvisionNew(inst) {
|
||||
});
|
||||
os.append(osLabel);
|
||||
os.append(osInput);
|
||||
osFS.append(os);
|
||||
osAttr.append(os);
|
||||
|
||||
// Create user entry input
|
||||
var defaultChkbox = $('<input type="checkbox" name="userEntry" value="default"/>').click(function() {
|
||||
@ -2339,7 +2362,7 @@ function createZProvisionNew(inst) {
|
||||
});
|
||||
var userEntry = $('<div><label for="userEntry">Directory entry:</label><textarea/></textarea></div>');
|
||||
userEntry.append($('<span></span>').append(defaultChkbox, 'Use default'));
|
||||
hwFS.append(userEntry);
|
||||
hwAttr.append(userEntry);
|
||||
|
||||
// Create disk table
|
||||
var diskDiv = $('<div class="provision"></div>');
|
||||
@ -2451,7 +2474,7 @@ function createZProvisionNew(inst) {
|
||||
|
||||
diskDiv.append(diskLabel);
|
||||
diskDiv.append(diskTable);
|
||||
hwFS.append(diskDiv);
|
||||
hwAttr.append(diskDiv);
|
||||
|
||||
// Generate tooltips
|
||||
provNew.find('div input[title]').tooltip({
|
||||
@ -2510,7 +2533,7 @@ function createZProvisionNew(inst) {
|
||||
|
||||
// Show error message for missing inputs
|
||||
if (!ready) {
|
||||
errMsg = errMsg + 'You are missing inputs.<br>';
|
||||
errMsg = errMsg + 'Please provide a value for each missing field.<br>';
|
||||
}
|
||||
|
||||
// Check if user entry contains user ID
|
||||
|
@ -9,7 +9,8 @@ function loadHelpPage(){
|
||||
helpForm.append(
|
||||
'<fieldset>' +
|
||||
'<legend>Quick Start</legend>' +
|
||||
'<ol>' +
|
||||
'<div style="display: inline-table; vertical-align: middle;"><img src="images/help/quick_start.png" style="width: 90%;"></img></div>' +
|
||||
'<ol style="display: inline-table; vertical-align: middle;">' +
|
||||
'<li><a href="configure.php" style="color: blue;">1. Discover hardware</a><br/>Discover all hardware in the cluster. Define them in the xCAT database. Initialize your cluster.</li>' +
|
||||
'<li><a href="index.php" style="color: blue;">2. Verify defined nodes</a><br/>View nodes definition by groups in a table or graphical style.</li>' +
|
||||
'<li><a href="configure.php" style="color: blue;">3. Install compute nodes</a><br/>Copy useful files from DVD onto harddisk. Create Linux images. Install compute nodes in stateful, stateless, and statelite style.</li>' +
|
||||
@ -19,7 +20,8 @@ function loadHelpPage(){
|
||||
'</fieldset>' +
|
||||
'<fieldset>' +
|
||||
'<legend>Advanced</legend>' +
|
||||
'<ol>' +
|
||||
'<div style="display: inline-table; vertical-align: middle;"><img src="images/help/advanced_settings.png" style="width: 90%;"></img></div>' +
|
||||
'<ol style="display: inline-table; vertical-align: middle;">' +
|
||||
'<li><a href="configure.php" style="color: blue;">a. Edit the xCAT database tables</a></li>' +
|
||||
'<li><a href="configure.php" style="color: blue;">b. Update the xCAT RPM on the Management Node</a></li>' +
|
||||
'</ol>' +
|
||||
|
@ -182,15 +182,20 @@ function loadMonitorPage() {
|
||||
|
||||
// Create radio buttons for platforms
|
||||
var hwList = $('<ol>Platforms available:</ol>');
|
||||
var ipmi = $('<li><input type="radio" name="hw" value="ipmi" checked/>iDataPlex</li>');
|
||||
var esx = $('<li><input type="radio" name="hw" value="esx" checked/>ESX</li>');
|
||||
var kvm = $('<li><input type="radio" name="hw" value="kvm"/>KVM</li>');
|
||||
var zvm = $('<li><input type="radio" name="hw" value="zvm"/>z\/VM</li>');
|
||||
var ipmi = $('<li><input type="radio" name="hw" value="ipmi"/>iDataPlex</li>');
|
||||
var blade = $('<li><input type="radio" name="hw" value="blade"/>BladeCenter</li>');
|
||||
var hmc = $('<li><input type="radio" name="hw" value="hmc"/>System p</li>');
|
||||
var zvm = $('<li><input type="radio" name="hw" value="zvm"/>System z</li>');
|
||||
|
||||
hwList.append(ipmi);
|
||||
hwList.append(blade);
|
||||
hwList.append(hmc);
|
||||
|
||||
hwList.append(esx);
|
||||
hwList.append(kvm);
|
||||
hwList.append(zvm);
|
||||
hwList.append(blade);
|
||||
hwList.append(ipmi);
|
||||
hwList.append(hmc);
|
||||
|
||||
resrcForm.append(hwList);
|
||||
|
||||
var okBtn = createButton('Ok');
|
||||
@ -208,6 +213,12 @@ function loadMonitorPage() {
|
||||
// Create an instance of the plugin
|
||||
var plugin;
|
||||
switch (hw) {
|
||||
case "kvm":
|
||||
plugin = new kvmPlugin();
|
||||
break;
|
||||
case "esx":
|
||||
plugin = new esxPlugin();
|
||||
break;
|
||||
case "blade":
|
||||
plugin = new bladePlugin();
|
||||
break;
|
||||
|
@ -380,10 +380,12 @@ function mkAddNodeLink() {
|
||||
addNodeForm.append(info);
|
||||
addNodeForm.append('<div><label for="mgt">Hardware management:</label>'
|
||||
+ '<select id="mgt" name="mgt">'
|
||||
+ '<option value="esx">ESX</option>'
|
||||
+ '<option value="kvm">KVM</option>'
|
||||
+ '<option value="zvm">z\/VM</option>'
|
||||
+ '<option value="ipmi">iDataPlex</option>'
|
||||
+ '<option value="blade">BladeCenter</option>'
|
||||
+ '<option value="hmc">System p</option>' // Documentation refers to 'IBM System p' (where p is NOT capitalized)
|
||||
+ '<option value="zvm">System z</option>' // Documentation refers to 'IBM System z' (where z is NOT capitalized)
|
||||
+ '</select>'
|
||||
+ '</div>');
|
||||
|
||||
@ -439,6 +441,12 @@ function mkAddNodeLink() {
|
||||
|
||||
var plugin;
|
||||
switch(mgt) {
|
||||
case "kvm":
|
||||
plugin = new kvmPlugin();
|
||||
break;
|
||||
case "esx":
|
||||
plugin = new esxPlugin();
|
||||
break;
|
||||
case "blade":
|
||||
plugin = new bladePlugin();
|
||||
break;
|
||||
@ -1874,6 +1882,10 @@ function sortAlpha(a, b) {
|
||||
* @return Nothing
|
||||
*/
|
||||
function powerNode(node, power2) {
|
||||
// Show power loader
|
||||
var powerCol = $('#' + nodesTableId + '_wrapper .dataTables_scrollHead .datatable thead tr th:eq(3)');
|
||||
powerCol.find('img').show();
|
||||
|
||||
node = node.replace('Power', '');
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
@ -2081,6 +2093,10 @@ function updateStatusBar(data) {
|
||||
* @return Nothing
|
||||
*/
|
||||
function updatePowerStatus(data) {
|
||||
// Hide power loader
|
||||
var powerCol = $('#' + nodesTableId + '_wrapper .dataTables_scrollHead .datatable thead tr th:eq(3)');
|
||||
powerCol.find('img').hide();
|
||||
|
||||
// Get datatable
|
||||
var dTable = $('#' + nodesTableId).dataTable();
|
||||
|
||||
@ -3025,6 +3041,10 @@ function openSetAttrsDialog() {
|
||||
* @return Nothing
|
||||
*/
|
||||
function monitorNode(node, monitor) {
|
||||
// Show ganglia loader
|
||||
var gangliaCol = $('#' + nodesTableId + '_wrapper .dataTables_scrollHead .datatable thead tr th:eq(4)');
|
||||
gangliaCol.find('img').show();
|
||||
|
||||
if (monitor == 'on') {
|
||||
// Append loader to warning bar
|
||||
var warningBar = $('#nodesTab').find('.ui-state-error p');
|
||||
@ -3084,13 +3104,27 @@ function monitorNode(node, monitor) {
|
||||
data : {
|
||||
cmd : 'webrun',
|
||||
tgt : '',
|
||||
args : 'gangliastart;' + data.msg,
|
||||
msg : ''
|
||||
args : 'gangliastart;' + data.msg + ';-r',
|
||||
msg : data.msg
|
||||
},
|
||||
|
||||
success : function(data) {
|
||||
// Remove any warnings
|
||||
$('#nodesTab').find('.ui-state-error').remove();
|
||||
|
||||
// Update datatable
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'webrun',
|
||||
tgt : '',
|
||||
args : 'gangliastatus;' + data.msg,
|
||||
msg : ''
|
||||
},
|
||||
|
||||
success : loadGangliaStatus
|
||||
});
|
||||
}
|
||||
});
|
||||
} // End of if (warn)
|
||||
@ -3116,7 +3150,7 @@ function monitorNode(node, monitor) {
|
||||
} else {
|
||||
var args;
|
||||
if (node) {
|
||||
args = 'gangliastop;' + node;
|
||||
args = 'gangliastop;' + node + ';-r';
|
||||
} else {
|
||||
args = 'gangliastop';
|
||||
}
|
||||
@ -3132,7 +3166,9 @@ function monitorNode(node, monitor) {
|
||||
},
|
||||
|
||||
success : function(data) {
|
||||
// Do nothing
|
||||
// Hide ganglia loader
|
||||
var gangliaCol = $('#' + nodesTableId + '_wrapper .dataTables_scrollHead .datatable thead tr th:eq(4)');
|
||||
gangliaCol.find('img').hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -85,17 +85,17 @@ function loadProvisionPage() {
|
||||
var hwList = $('<ol>Platforms available:</ol>');
|
||||
var esx = $('<li><input type="radio" name="hw" value="esx" checked/>ESX</li>');
|
||||
var kvm = $('<li><input type="radio" name="hw" value="kvm"/>KVM</li>');
|
||||
var zvm = $('<li><input type="radio" name="hw" value="zvm"/>z\/VM</li>');
|
||||
var ipmi = $('<li><input type="radio" name="hw" value="ipmi"/>iDataPlex</li>');
|
||||
var blade = $('<li><input type="radio" name="hw" value="blade"/>BladeCenter</li>');
|
||||
var hmc = $('<li><input type="radio" name="hw" value="hmc"/>System p</li>');
|
||||
var zvm = $('<li><input type="radio" name="hw" value="zvm"/>System z</li>');
|
||||
|
||||
|
||||
hwList.append(esx);
|
||||
hwList.append(kvm);
|
||||
hwList.append(ipmi);
|
||||
hwList.append(blade);
|
||||
hwList.append(hmc);
|
||||
hwList.append(zvm);
|
||||
hwList.append(blade);
|
||||
hwList.append(ipmi);
|
||||
hwList.append(hmc);
|
||||
provPg.append(hwList);
|
||||
|
||||
/**
|
||||
@ -140,7 +140,7 @@ function loadProvisionPage() {
|
||||
break;
|
||||
case "zvm":
|
||||
plugin = new zvmPlugin();
|
||||
title = 'System z';
|
||||
title = 'z/VM';
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -175,14 +175,12 @@ function loadServiceProvisionPage(tabId) {
|
||||
|
||||
// Create radio buttons for platforms
|
||||
var hwList = $('<ol>Platforms available:</ol>');
|
||||
var ipmi = $('<li><input type="radio" name="hw" value="ipmi" checked/>iDataPlex</li>');
|
||||
var blade = $('<li><input type="radio" name="hw" value="blade"/>BladeCenter</li>');
|
||||
var hmc = $('<li><input type="radio" name="hw" value="hmc"/>System p</li>');
|
||||
var zvm = $('<li><input type="radio" name="hw" value="zvm"/>System z</li>');
|
||||
|
||||
hwList.append(ipmi);
|
||||
hwList.append(blade);
|
||||
hwList.append(hmc);
|
||||
var esx = $('<li><input type="radio" name="hw" value="esx" checked/>ESX</li>');
|
||||
var kvm = $('<li><input type="radio" name="hw" value="kvm"/>KVM</li>');
|
||||
var zvm = $('<li><input type="radio" name="hw" value="zvm"/>z\/VM</li>');
|
||||
|
||||
hwList.append(esx);
|
||||
hwList.append(kvm);
|
||||
hwList.append(zvm);
|
||||
provPg.append(hwList);
|
||||
|
||||
@ -215,6 +213,14 @@ function loadServiceProvisionPage(tabId) {
|
||||
// Create an instance of the plugin
|
||||
var plugin;
|
||||
switch (hw) {
|
||||
case "kvm":
|
||||
plugin = new kvmPlugin();
|
||||
title = 'KVM';
|
||||
break;
|
||||
case "esx":
|
||||
plugin = new esxPlugin();
|
||||
title = 'ESX';
|
||||
break;
|
||||
case "blade":
|
||||
plugin = new bladePlugin();
|
||||
title = 'BladeCenter';
|
||||
@ -229,7 +235,7 @@ function loadServiceProvisionPage(tabId) {
|
||||
break;
|
||||
case "zvm":
|
||||
plugin = new zvmPlugin();
|
||||
title = 'System z';
|
||||
title = 'z/VM';
|
||||
|
||||
// Get zVM host names
|
||||
if (!$.cookie('srv_zvm')){
|
||||
@ -897,15 +903,25 @@ function setGroupCookies(data) {
|
||||
var groups = new Array();
|
||||
|
||||
// Index 0 is the table header
|
||||
var cols, name, ip, hostname, desc;
|
||||
for ( var i = 1; i < data.rsp.length; i++) {
|
||||
var cols, name, ip, hostname, desc, comments, tmp;
|
||||
for (var i = 1; i < data.rsp.length; i++) {
|
||||
// Split into columns:
|
||||
// node, ip, hostnames, otherinterfaces, comments, disable
|
||||
cols = data.rsp[i].split(',');
|
||||
name = cols[0].replace(new RegExp('"', 'g'), '');
|
||||
ip = cols[1].replace(new RegExp('"', 'g'), '');
|
||||
hostname = cols[2].replace(new RegExp('"', 'g'), '');
|
||||
desc = cols[4].replace(new RegExp('"', 'g'), '');
|
||||
|
||||
// It should return: "description: All machines; network: 10.1.100.0/24;"
|
||||
comments = cols[4].replace(new RegExp('"', 'g'), '');
|
||||
tmp = comments.split(';');
|
||||
for (var j = 0; j < tmp.length; j++) {
|
||||
if (tmp[j].indexOf('description:') > -1) {
|
||||
desc = tmp[j].replace('description:', '');
|
||||
desc = jQuery.trim(desc);
|
||||
}
|
||||
}
|
||||
|
||||
groups.push(name + ':' + ip + ':' + hostname + ':' + desc);
|
||||
}
|
||||
|
||||
|
@ -356,10 +356,13 @@ sub gennodename {
|
||||
my $hostname_regex;
|
||||
my $ipaddr_regex;
|
||||
|
||||
my @comments;
|
||||
my $base_digit = 0;
|
||||
my $base_hostname;
|
||||
my $base_ipaddr;
|
||||
|
||||
my $network = "";
|
||||
my $mask;
|
||||
my $hostname;
|
||||
my $ipaddr;
|
||||
my $tmp;
|
||||
@ -368,7 +371,7 @@ sub gennodename {
|
||||
|
||||
# Get regular expression for hostname in 'hosts' table
|
||||
my $tab = xCAT::Table->new( 'hosts', -create => 1, -autocommit => 0 );
|
||||
my @results = $tab->getAllAttribsWhere( "node='" . $group . "'", 'ip' );
|
||||
my @results = $tab->getAllAttribsWhere( "node='" . $group . "'", 'ip', 'comments' );
|
||||
foreach (@results) {
|
||||
|
||||
# It should return: |gpok(\d+)|10.1.100.($1+0)|
|
||||
@ -385,9 +388,36 @@ sub gennodename {
|
||||
|
||||
# Get the ($1+0)
|
||||
$ipaddr_regex =~ s/$base_ipaddr//g;
|
||||
}
|
||||
|
||||
|
||||
# Get the network within comments
|
||||
# It should return: "description: All machines; network: 10.1.100.0/24;"
|
||||
# This will help determine the 1st node in the group if none exists
|
||||
@comments = split( /;/, $_->{'comments'} );
|
||||
foreach (@comments) {
|
||||
if ($_ =~ m/network:/i) {
|
||||
$network = $_;
|
||||
|
||||
# Remove network header
|
||||
$network =~ s/network://g;
|
||||
|
||||
# Trim network section
|
||||
$network =~ s/\s*$//;
|
||||
$network =~ s/^\s*//;
|
||||
|
||||
# Extract network
|
||||
$tmp = rindex($network, '/');
|
||||
if ($tmp > -1) {
|
||||
$network = substr($network, 0, $tmp);
|
||||
}
|
||||
|
||||
# Extract base digit, which depends on the netmask used
|
||||
$base_digit = substr($network, rindex($network, '.') + 1);
|
||||
}
|
||||
} # End of foreach
|
||||
} # End of foreach
|
||||
|
||||
# Are there nodes in this group already?
|
||||
# If so, use the existing nodes as a base
|
||||
my $out = `nodels $group`;
|
||||
@args = split( /\n/, $out );
|
||||
foreach (@args) {
|
||||
@ -411,10 +441,73 @@ sub gennodename {
|
||||
$ipaddr =~ s/$hostname_regex/$ipaddr_regex/gee;
|
||||
$ipaddr = $base_ipaddr . $ipaddr;
|
||||
|
||||
# Get networks in 'networks' table
|
||||
$tab = xCAT::Table->new( 'networks', -create => 1, -autocommit => 0 );
|
||||
my $entries = $tab->getAllEntries();
|
||||
|
||||
# Go through each network
|
||||
my $iprange;
|
||||
foreach (@$entries) {
|
||||
|
||||
# Get network, mask, and range
|
||||
$network = $_->{'net'};
|
||||
$mask = $_->{'mask'};
|
||||
$iprange = $_->{'dynamicrange'};
|
||||
|
||||
# If the host IP address is in this subnet, return
|
||||
if (xCAT::NetworkUtils->ishostinsubnet($ipaddr, $mask, $network)) {
|
||||
|
||||
# Exit loop
|
||||
last;
|
||||
} else {
|
||||
$network = "";
|
||||
}
|
||||
}
|
||||
|
||||
# Exit if no network exist for group
|
||||
if (!$network) {
|
||||
return;
|
||||
}
|
||||
|
||||
# Find the network range for this group
|
||||
my @ranges;
|
||||
my $iprange_low = 1;
|
||||
my $iprange_high = 254;
|
||||
if ($iprange) {
|
||||
@args = split( /;/, $iprange );
|
||||
foreach (@args) {
|
||||
# If a network range exists
|
||||
if ($_ =~ m/-/) {
|
||||
@ranges = split( /-/, $_ );
|
||||
$iprange_low = $ranges[0];
|
||||
$iprange_high = $ranges[1];
|
||||
|
||||
# Get the low and high ends digit
|
||||
$iprange_low =~ s/$base_ipaddr//g;
|
||||
$iprange_high =~ s/$base_ipaddr//g;
|
||||
}
|
||||
}
|
||||
} # End of if ($iprange)
|
||||
|
||||
# If no nodes exist in group
|
||||
# Set the base digit to the low end of the network range
|
||||
if ($iprange_low && $base_digit == 1) {
|
||||
$base_digit = $iprange_low;
|
||||
|
||||
# Generate hostname
|
||||
$hostname = $base_hostname;
|
||||
$hostname =~ s/#/$base_digit/g;
|
||||
|
||||
# Generate IP address
|
||||
$ipaddr = $hostname;
|
||||
$ipaddr =~ s/$hostname_regex/$ipaddr_regex/gee;
|
||||
$ipaddr = $base_ipaddr . $ipaddr;
|
||||
}
|
||||
|
||||
# Check xCAT tables, /etc/hosts, and ping to see if hostname is already used
|
||||
while (`nodels $hostname` || `cat /etc/hosts | grep "$ipaddr "` || !(`ping -c 4 $ipaddr` =~ m/Destination Host Unreachable/)) {
|
||||
while (`nodels $hostname` || `cat /etc/hosts | grep "$ipaddr "` || !(`ping -c 4 $ipaddr` =~ m/100% packet loss/)) {
|
||||
# Base digit invalid if over 254
|
||||
if ($base_digit > 254) {
|
||||
if ($base_digit > $iprange_high) {
|
||||
last;
|
||||
}
|
||||
|
||||
@ -429,8 +522,8 @@ sub gennodename {
|
||||
$ipaddr = $base_ipaddr . $ipaddr;
|
||||
}
|
||||
|
||||
# Range must be between 1-255
|
||||
if ($base_digit > 254) {
|
||||
# Range must be within network range
|
||||
if ($base_digit > $iprange_high) {
|
||||
return;
|
||||
} else {
|
||||
return ($hostname, $ipaddr, $base_digit);
|
||||
|
Loading…
Reference in New Issue
Block a user