Events logging for debugging.

This commit is contained in:
Julien Fontanet 2013-10-04 14:41:06 +02:00
parent e8b1be6568
commit 424c6403e1
2 changed files with 6 additions and 8 deletions

View File

@ -52,7 +52,9 @@ Xapi.prototype.call = function (method) {
// no longer pool master (`event.next`), so we have to
// retry at least once to know who is the new pool master.
if (('ECONNRESET' === current)
|| ('ECONNREFUSED' === current))
|| ('ECONNREFUSED' === current) // More or less similar to above.
|| ('HOST_STILL_BOOTING' === current)
|| ('HOST_HAS_NO_MANAGEMENT_IP' === current)) // Similar to above.
{
// Node.js seems to reuse the broken socket, so we add
// a small delay.
@ -62,12 +64,6 @@ Xapi.prototype.call = function (method) {
return Q.delay(1000).then(helper);
}
//
if ('HOST_STILL_BOOTING' === current)
{
return Q.delay(2000).then(helper);
}
// XAPI is sometimes reinitialized and sessions are lost.
// We try log in again if necessary.
if ('SESSION_INVALID' === current)

View File

@ -325,6 +325,8 @@ Xo.prototype.start = function (cfg) {
record.id = event.ref;
record.pool = pool_id;
console.log(xapi.host, event.class, event.ref);
// @todo Handle operation types.
collection.add(event.snapshot, {'replace': true});
@ -346,7 +348,7 @@ Xo.prototype.start = function (cfg) {
});
}();
}).fail(function (error) {
console.error(error);
console.error(xapi.host, error);
});
};
// Connect existing servers.