Browse Source

Merge "Fix Launch Instance without Cinder" into stable/newton

Jenkins 2 years ago
parent
commit
74c83bdcae

+ 1
- 1
openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-model.service.js View File

@@ -182,7 +182,7 @@
182 182
         source_type: null,
183 183
         source: [],
184 184
         // REQUIRED for JS logic
185
-        vol_create: true,
185
+        vol_create: false,
186 186
         // May be null
187 187
         vol_device_name: 'vda',
188 188
         vol_delete_on_instance_delete: false,

+ 1
- 1
openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-model.service.spec.js View File

@@ -814,7 +814,7 @@
814 814
         });
815 815
 
816 816
         it('sets volume options appropriately', function() {
817
-          expect(model.newInstanceSpec.vol_create).toBe(true);
817
+          expect(model.newInstanceSpec.vol_create).toBe(false);
818 818
           expect(model.newInstanceSpec.vol_device_name).toBe('vda');
819 819
           expect(model.newInstanceSpec.vol_delete_on_instance_delete).toBe(false);
820 820
           expect(model.newInstanceSpec.vol_size).toBe(1);

+ 5
- 1
openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/source/source.controller.js View File

@@ -401,7 +401,11 @@
401 401
 
402 402
     function updateBootSourceSelection(selectedSource) {
403 403
       ctrl.currentBootSource = selectedSource;
404
-      $scope.model.newInstanceSpec.vol_create = true;
404
+      if ((selectedSource === bootSourceTypes.IMAGE) && $scope.model.volumeBootable) {
405
+        $scope.model.newInstanceSpec.vol_create = true;
406
+      } else {
407
+        $scope.model.newInstanceSpec.vol_create = false;
408
+      }
405 409
       $scope.model.newInstanceSpec.vol_delete_on_instance_delete = false;
406 410
       changeBootSource(selectedSource);
407 411
       validateBootSourceType();

+ 12
- 2
openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/source/source.controller.spec.js View File

@@ -229,12 +229,12 @@
229 229
           var tableKeys = ['available', 'allocated',
230 230
             'displayedAvailable', 'displayedAllocated'];
231 231
 
232
-          it('updates the scope appropriately', function() {
232
+          it('updates the scope appropriately, without Cinder available', function() {
233 233
             var selSource = 'image';
234 234
             ctrl.updateBootSourceSelection(selSource);
235 235
 
236 236
             expect(ctrl.currentBootSource).toEqual('image');
237
-            expect(scope.model.newInstanceSpec.vol_create).toBe(true);
237
+            expect(scope.model.newInstanceSpec.vol_create).toBe(false);
238 238
             expect(scope.model.newInstanceSpec.vol_delete_on_instance_delete).toBe(false);
239 239
 
240 240
             // check table data
@@ -244,6 +244,16 @@
244 244
             expect(ctrl.tableBodyCells.length).toBeGreaterThan(0);
245 245
           });
246 246
 
247
+          it('updates the scope appropriately, with Cinder available', function() {
248
+            scope.model.volumeBootable = true;
249
+            var selSource = 'image';
250
+            ctrl.updateBootSourceSelection(selSource);
251
+
252
+            expect(ctrl.currentBootSource).toEqual('image');
253
+            expect(scope.model.newInstanceSpec.vol_create).toBe(true);
254
+            expect(scope.model.newInstanceSpec.vol_delete_on_instance_delete).toBe(false);
255
+          });
256
+
247 257
           it('should broadcast event when boot source changes', function() {
248 258
             spyOn(scope, '$broadcast');
249 259
             scope.$apply();

Loading…
Cancel
Save