Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions lib/glance.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var Request = require('./os-request');
var urllib = require('url');


//constructor - should be the only export
Expand Down Expand Up @@ -209,6 +210,34 @@ Glance.prototype.queueImage = function(data, cb)



Glance.prototype.importImage = function(id, data, cb)
{
var self = this;
var post_data = { method: {} };
var request_options = {};

//first pull the valid options out of data - I think this is done for security purposes...as opposed to just tossing in 'data'?
if(data.method)
{
post_data.method = data.method;
}

request_options = this.getRequestOptions('/images/' + escape(id) + '/import', post_data, {'Content-Type': 'application/json'});
request_options.metricPath = 'remote-calls.glance.images.import';
request_options.validateStatus = true;

this.request.post(request_options, function(error, response, body){
if(error)
{
cb(error);
return;
}
//else
console.log(body);
cb(null, self.mangleObject('Image', body));
});
}

//uploads a new image to openstack
//takes the new image id(from the queue call above?)
//a stream object... don't really get that one (download result?)
Expand Down
Loading