This commit is contained in:
William Mantly 2016-05-26 20:14:01 -04:00
parent 66f6c3b92a
commit f32d6f70a9
2 changed files with 5 additions and 5 deletions

8
lxc.js
View File

@ -30,7 +30,7 @@ var lxc = {
destroy: function(name, callback){ destroy: function(name, callback){
return sysExec('lxc-destroy -n '+ name, function(data){ return sysExec('lxc-destroy -n '+ name, function(data){
var info = data.match(/Destroyed container/); var info = data.match(/Destroyed container/);
console.log('destroy info:', info); // console.log('destroy info:', info);
var args = [true].concat(Array.prototype.slice.call(arguments, 1)); var args = [true].concat(Array.prototype.slice.call(arguments, 1));
return callback.apply(this, args); return callback.apply(this, args);
}); });
@ -43,7 +43,7 @@ var lxc = {
startEphemeral: function(name, base_name, ip, callback){ startEphemeral: function(name, base_name, ip, callback){
var command = 'lxc-start-ephemeral -o '+base_name+ ' -n '+name +' --union-type overlayfs -d'; var command = 'lxc-start-ephemeral -o '+base_name+ ' -n '+name +' --union-type overlayfs -d';
return sysExec(command, ip, function(data){ return sysExec(command, ip, function(data){
console.log('startEphemeral', arguments); // console.log('startEphemeral', arguments);
if(data.match("doesn't exist.")){ if(data.match("doesn't exist.")){
return callback({status: 500, error: "doesn't exist."}); return callback({status: 500, error: "doesn't exist."});
} }
@ -58,7 +58,7 @@ var lxc = {
}); });
}, },
stop: function(name, callback, ip){ stop: function(name, ip, callback){
return sysExec('lxc-stop -n '+ name, ip, callback); return sysExec('lxc-stop -n '+ name, ip, callback);
}, },
@ -72,7 +72,7 @@ var lxc = {
info: function(name, callback){ info: function(name, callback){
return sysExec('lxc-info -n '+name, function(data){ return sysExec('lxc-info -n '+name, function(data){
console.log('info', arguments); // console.log('info', arguments);
if(data.match("doesn't exist")){ if(data.match("doesn't exist")){
return callback({state: 'NULL'}); return callback({state: 'NULL'});
} }

View File

@ -24,7 +24,7 @@ var getFreeMem = function(ip, callback){
}; };
var containerFree = function(container){ var containerFree = function(container){
lxc.stop(name, container); lxc.stop(container.name, container.worker.ip);
container.worker.usedContainer--; container.worker.usedContainer--;
delete label2container[container.label]; delete label2container[container.label];
}; };