Fix Launch Instance without Cinder
A previous patch altered the defaults in the angular Launch Instance, but didn't account for those running without Cinder. This patch fixes those assumptions. Co-Authored-By: Rob Cresswell <robert.cresswell@outlook.com> Change-Id: I8dc54fa40fa7eb8ae95a13741405f2a80337b33d Closes-Bug: 1585761
This commit is contained in:
parent
129f33ceb3
commit
723e547e84
|
@ -182,7 +182,7 @@
|
|||
source_type: null,
|
||||
source: [],
|
||||
// REQUIRED for JS logic
|
||||
vol_create: true,
|
||||
vol_create: false,
|
||||
// May be null
|
||||
vol_device_name: 'vda',
|
||||
vol_delete_on_instance_delete: false,
|
||||
|
|
|
@ -814,7 +814,7 @@
|
|||
});
|
||||
|
||||
it('sets volume options appropriately', function() {
|
||||
expect(model.newInstanceSpec.vol_create).toBe(true);
|
||||
expect(model.newInstanceSpec.vol_create).toBe(false);
|
||||
expect(model.newInstanceSpec.vol_device_name).toBe('vda');
|
||||
expect(model.newInstanceSpec.vol_delete_on_instance_delete).toBe(false);
|
||||
expect(model.newInstanceSpec.vol_size).toBe(1);
|
||||
|
|
|
@ -401,7 +401,11 @@
|
|||
|
||||
function updateBootSourceSelection(selectedSource) {
|
||||
ctrl.currentBootSource = selectedSource;
|
||||
$scope.model.newInstanceSpec.vol_create = true;
|
||||
if ((selectedSource === bootSourceTypes.IMAGE) && $scope.model.volumeBootable) {
|
||||
$scope.model.newInstanceSpec.vol_create = true;
|
||||
} else {
|
||||
$scope.model.newInstanceSpec.vol_create = false;
|
||||
}
|
||||
$scope.model.newInstanceSpec.vol_delete_on_instance_delete = false;
|
||||
changeBootSource(selectedSource);
|
||||
validateBootSourceType();
|
||||
|
|
|
@ -229,12 +229,12 @@
|
|||
var tableKeys = ['available', 'allocated',
|
||||
'displayedAvailable', 'displayedAllocated'];
|
||||
|
||||
it('updates the scope appropriately', function() {
|
||||
it('updates the scope appropriately, without Cinder available', function() {
|
||||
var selSource = 'image';
|
||||
ctrl.updateBootSourceSelection(selSource);
|
||||
|
||||
expect(ctrl.currentBootSource).toEqual('image');
|
||||
expect(scope.model.newInstanceSpec.vol_create).toBe(true);
|
||||
expect(scope.model.newInstanceSpec.vol_create).toBe(false);
|
||||
expect(scope.model.newInstanceSpec.vol_delete_on_instance_delete).toBe(false);
|
||||
|
||||
// check table data
|
||||
|
@ -244,6 +244,16 @@
|
|||
expect(ctrl.tableBodyCells.length).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
it('updates the scope appropriately, with Cinder available', function() {
|
||||
scope.model.volumeBootable = true;
|
||||
var selSource = 'image';
|
||||
ctrl.updateBootSourceSelection(selSource);
|
||||
|
||||
expect(ctrl.currentBootSource).toEqual('image');
|
||||
expect(scope.model.newInstanceSpec.vol_create).toBe(true);
|
||||
expect(scope.model.newInstanceSpec.vol_delete_on_instance_delete).toBe(false);
|
||||
});
|
||||
|
||||
it('should broadcast event when boot source changes', function() {
|
||||
spyOn(scope, '$broadcast');
|
||||
scope.$apply();
|
||||
|
|
Loading…
Reference in New Issue