Added Intel AMT wake support.
This commit is contained in:
parent
9f8a5646ee
commit
8eb80efe39
|
@ -59,6 +59,11 @@ module.exports.CreateAmtManager = function(parent) {
|
||||||
|
|
||||||
// React to node being removed
|
// React to node being removed
|
||||||
if (event.action == 'removenode') { removeDevice(event.nodeid); }
|
if (event.action == 'removenode') { removeDevice(event.nodeid); }
|
||||||
|
|
||||||
|
// React to node wakeup command, perform Intel AMT wake if possible
|
||||||
|
if ((event.action == 'wakedevices') && (Array.isArray(event.nodeids))) {
|
||||||
|
for (var i in event.nodeids) { performPowerAction(event.nodeids[i], 2); }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove a device
|
// Remove a device
|
||||||
|
@ -69,6 +74,18 @@ module.exports.CreateAmtManager = function(parent) {
|
||||||
delete obj.amtDevices[nodeid];
|
delete obj.amtDevices[nodeid];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Perform a power action: 2 = Power up, 5 = Power cycle, 8 = Power down, 10 = Reset
|
||||||
|
function performPowerAction(nodeid, action) {
|
||||||
|
var dev = obj.amtDevices[nodeid];
|
||||||
|
if ((dev == null) || (dev.amtstack == null)) return;
|
||||||
|
try { dev.amtstack.RequestPowerStateChange(action, performPowerActionResponse); } catch (ex) { }
|
||||||
|
}
|
||||||
|
|
||||||
|
// Response to Intel AMT power action
|
||||||
|
function performPowerActionResponse(stack, name, responses, status) {
|
||||||
|
//console.log('performPowerActionResponse', status);
|
||||||
|
}
|
||||||
|
|
||||||
// Update information about a device
|
// Update information about a device
|
||||||
function fetchIntelAmtInformation(nodeid) {
|
function fetchIntelAmtInformation(nodeid) {
|
||||||
parent.db.Get(nodeid, function (err, nodes) {
|
parent.db.Get(nodeid, function (err, nodes) {
|
||||||
|
|
|
@ -3539,6 +3539,11 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
||||||
// - We should get a full list of all MAC's to wake first.
|
// - We should get a full list of all MAC's to wake first.
|
||||||
// - We should try to only have one agent per subnet (using Gateway MAC) send a wake-on-lan.
|
// - We should try to only have one agent per subnet (using Gateway MAC) send a wake-on-lan.
|
||||||
if (common.validateArray(command.nodeids, 1) == false) break; // Check nodeid's
|
if (common.validateArray(command.nodeids, 1) == false) break; // Check nodeid's
|
||||||
|
|
||||||
|
// Event wakeup, this will cause Intel AMT wake operations on this and other servers.
|
||||||
|
parent.parent.DispatchEvent('*', obj, { action: 'wakedevices', userid: user._id, username: user.name, nodeids: command.nodeids, domain: domain.id, nolog: 1 });
|
||||||
|
|
||||||
|
// Perform wake-on-lan
|
||||||
for (i in command.nodeids) {
|
for (i in command.nodeids) {
|
||||||
// Get the node and the rights for this node
|
// Get the node and the rights for this node
|
||||||
parent.GetNodeWithRights(domain, user, command.nodeids[i], function (node, rights, visible) {
|
parent.GetNodeWithRights(domain, user, command.nodeids[i], function (node, rights, visible) {
|
||||||
|
|
Loading…
Reference in New Issue