Merge "Do not specify device_name when creating server with BFV"

This commit is contained in:
Zuul 2019-05-08 10:47:17 +00:00 committed by Gerrit Code Review
commit db43af3468
2 changed files with 13 additions and 14 deletions

View File

@ -205,8 +205,6 @@
// REQUIRED for JS logic // REQUIRED for JS logic
hide_create_volume: false, hide_create_volume: false,
vol_create: false, vol_create: false,
// May be null
vol_device_name: 'vda',
vol_delete_on_instance_delete: false, vol_delete_on_instance_delete: false,
vol_size: 1 vol_size: 1
}; };
@ -750,10 +748,10 @@
setFinalSpecBootImageToVolume(finalSpec); setFinalSpecBootImageToVolume(finalSpec);
break; break;
case bootSourceTypes.VOLUME: case bootSourceTypes.VOLUME:
setFinalSpecBootFromVolumeDevice(finalSpec, 'vol'); setFinalSpecBootFromVolumeDevice(finalSpec, 'volume');
break; break;
case bootSourceTypes.VOLUME_SNAPSHOT: case bootSourceTypes.VOLUME_SNAPSHOT:
setFinalSpecBootFromVolumeDevice(finalSpec, 'snap'); setFinalSpecBootFromVolumeDevice(finalSpec, 'snapshot');
break; break;
default: default:
$log.error("Unknown source type: " + finalSpec.source_type); $log.error("Unknown source type: " + finalSpec.source_type);
@ -765,7 +763,6 @@
// at launch time. // at launch time.
delete finalSpec.source_type; delete finalSpec.source_type;
delete finalSpec.vol_create; delete finalSpec.vol_create;
delete finalSpec.vol_device_name;
delete finalSpec.vol_delete_on_instance_delete; delete finalSpec.vol_delete_on_instance_delete;
delete finalSpec.vol_size; delete finalSpec.vol_size;
} }
@ -789,14 +786,16 @@
} }
function setFinalSpecBootFromVolumeDevice(finalSpec, sourceType) { function setFinalSpecBootFromVolumeDevice(finalSpec, sourceType) {
finalSpec.block_device_mapping = {}; finalSpec.block_device_mapping_v2 = [];
finalSpec.block_device_mapping[finalSpec.vol_device_name] = [ finalSpec.block_device_mapping_v2.push(
finalSpec.source_id, {
':', 'source_type': sourceType,
sourceType, 'destination_type': bootSourceTypes.VOLUME,
'::', 'delete_on_termination': finalSpec.vol_delete_on_instance_delete,
finalSpec.vol_delete_on_instance_delete 'uuid': finalSpec.source_id,
].join(''); 'boot_index': '0'
}
);
// Source ID must be empty for API // Source ID must be empty for API
finalSpec.source_id = ''; finalSpec.source_id = '';

View File

@ -841,7 +841,7 @@
// This is here to ensure that as people add/change items, they // This is here to ensure that as people add/change items, they
// don't forget to implement tests for them. // don't forget to implement tests for them.
it('has the right number of properties', function() { it('has the right number of properties', function() {
expect(Object.keys(model.newInstanceSpec).length).toBe(23); expect(Object.keys(model.newInstanceSpec).length).toBe(22);
}); });
it('sets availability zone to null', function() { it('sets availability zone to null', function() {