Skip to content

Commit

Permalink
Merge pull request #9 from FELDSAM-INC/feldsam/locking
Browse files Browse the repository at this point in the history
VM & Image added lock & unlock methods
  • Loading branch information
apocas authored Dec 4, 2018
2 parents 6f9a7d3 + 8fdd051 commit a30a243
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ one.createVM('GRAPHICS=[TYPE="vnc",LISTEN="0.0.0.0"]\nMEMORY="1024"\n FROM_APP="
* vm.updateConf(template, callback)
* vm.revertDiskSnapshot(disk, snapshot, callback)
* vm.deleteDiskSnapshot(disk, snapshot, callback)
* vm.lock(level, callback)
* vm.unlock(callback)

### Datastore

Expand Down Expand Up @@ -216,6 +218,8 @@ one.createVM('GRAPHICS=[TYPE="vnc",LISTEN="0.0.0.0"]\nMEMORY="1024"\n FROM_APP="
* image.chtype(type, callback)
* image.enable(callback)
* image.disable(callback)
* image.lock(level, callback)
* image.unlock(callback)

### User

Expand Down
14 changes: 14 additions & 0 deletions lib/image.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,18 @@ Image.prototype.disable = function(callback) {
});
};

Image.prototype.lock = function(level, callback) {
this.modem.call('image.lock', [this.id, level], function(err, data) {
if(err) return callback(err);
callback(null, data);
});
};

Image.prototype.unlock = function(callback) {
this.modem.call('image.unlock', [this.id], function(err, data) {
if(err) return callback(err);
callback(null, data);
});
};

module.exports = Image;
14 changes: 14 additions & 0 deletions lib/vm.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,4 +178,18 @@ VM.prototype.recover = function(recover, callback) {
});
};

VM.prototype.lock = function(level, callback) {
this.modem.call('vm.lock', [this.id, level], function(err, data) {
if (err) return callback(err);
callback(null, data);
});
};

VM.prototype.unlock = function(callback) {
this.modem.call('vm.unlock', [this.id], function(err, data) {
if (err) return callback(err);
callback(null, data);
});
};

module.exports = VM;

0 comments on commit a30a243

Please sign in to comment.