Skip to content

Commit

Permalink
Merge 1fd342e into bbdbf25
Browse files Browse the repository at this point in the history
  • Loading branch information
mdsummers committed Apr 13, 2015
2 parents bbdbf25 + 1fd342e commit 352acd4
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
5 changes: 5 additions & 0 deletions lib/pkgcloud/openstack/blockstorage/client/volumes.js
Expand Up @@ -78,6 +78,7 @@ exports.getVolume = function (volume, callback) {
* @param {number} options.size the size of the new volume in GB
* @param {String} [options.snapshotId] the snapshotId to use in creating the new volume
* @param {object|String} [options.volumeType] the volumeType for the new volume
* @param {String} [options.availabilityZone] the availability zone for the new volume
* @param {function} callback
* @returns {*}
*/
Expand Down Expand Up @@ -107,6 +108,10 @@ exports.createVolume = function (options, callback) {
createOptions.body.volume['snapshot_id'] = options.snapshotId;
}

if (options.availabilityZone) {
createOptions.body.volume['availability_zone'] = options.availabilityZone;
}

self._request(createOptions, function (err, body) {
return err
? callback(err)
Expand Down
3 changes: 2 additions & 1 deletion lib/pkgcloud/openstack/blockstorage/volume.js
Expand Up @@ -27,11 +27,12 @@ Volume.prototype._setProperties = function (details) {
this.volumeType = details.volumeType || details['volume_type'];
this.attachments = details.attachments;
this.snapshotId = details.snapshotId || details['snapshot_id'];
this.availabilityZone = details['availability_zone'];
};

Volume.prototype.toJSON = function () {
return _.pick(this, ['id', 'status', 'name', 'description', 'createdAt',
'size', 'volumeType', 'attachments', 'snapshotId']);
'size', 'volumeType', 'attachments', 'snapshotId', 'availabilityZone']);
};


5 changes: 5 additions & 0 deletions lib/pkgcloud/openstack/compute/client/servers.js
Expand Up @@ -124,6 +124,7 @@ exports.getServers = function getServers(options, callback) {
* @param {Object} [details.keyname] optional keyname configuration
* @param {Object} [details.personality] optional personality configuration
* @param {Object} [details.metadata] optional metadata configuration
* @param {String} [details.availabilityZone] optional the availability zone to use
* @param callback
* @returns {request|*}
*/
Expand Down Expand Up @@ -178,6 +179,10 @@ exports.createServer = function createServer(details, callback) {
createOptions.body.server.config_drive = true;
}

if (details.availabilityZone) {
createOptions.body.server.availability_zone = details.availabilityZone;
}

return this._request(createOptions, function (err, body) {
if (err) {
return callback(err);
Expand Down
3 changes: 2 additions & 1 deletion lib/pkgcloud/openstack/compute/server.js
Expand Up @@ -72,6 +72,7 @@ Server.prototype._setProperties = function (details) {
this.created = details.created || this.created;
this.updated = details.updated || this.updated;
this.original = this.openstack = details;
this['OS-EXT-AZ:availability_zone'] = details['OS-EXT-AZ:availability_zone'];

if (Object.keys(this.addresses).length && !this.addresses.public
&& !this.addresses.private) {
Expand Down Expand Up @@ -139,5 +140,5 @@ Server.prototype.toJSON = function() {
'links', 'key_name', 'imageId', 'flavorId', 'user_id', 'tenant_id', 'progress',
'OS-EXT-STS:task_state', 'OS-EXT-STS:vm_state', 'OS-EXT-STS:power_state',
'OS-DCF:diskConfig', 'accessIPv4', 'accessIPv6', 'config_drive', 'metadata',
'created', 'updated']);
'created', 'updated', 'OS-EXT-AZ:availability_zone']);
};

0 comments on commit 352acd4

Please sign in to comment.