summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2017-06-20 07:57:49 +0000
committerGerrit Code Review <review@openstack.org>2017-06-20 07:57:49 +0000
commitf87d87a2fa5836b11769ef5109767353200e01be (patch)
tree168b0d202e92f915e3b8b013ab2df23c3c7f2b53
parent8eb4ff5d0fc9fed89c4e56f93efb014df177fd12 (diff)
parent6c0ec31de0e07097f338c9259e99dae5d6abf2b7 (diff)
Merge "Add config for default create volume option" into stable/ocata11.0.3
-rw-r--r--doc/source/topics/settings.rst5
-rw-r--r--openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-model.service.js5
-rw-r--r--openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-model.service.spec.js25
-rw-r--r--openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/source/source.controller.js3
-rw-r--r--openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/source/source.controller.spec.js2
-rw-r--r--openstack_dashboard/local/local_settings.py.example1
-rw-r--r--releasenotes/notes/bug-1678109-4440ebe90908647d.yaml5
7 files changed, 43 insertions, 3 deletions
diff --git a/doc/source/topics/settings.rst b/doc/source/topics/settings.rst
index b2a754d..ccf893e 100644
--- a/doc/source/topics/settings.rst
+++ b/doc/source/topics/settings.rst
@@ -670,6 +670,7 @@ Default::
670 "disable_instance_snapshot": False, 670 "disable_instance_snapshot": False,
671 "disable_volume": False, 671 "disable_volume": False,
672 "disable_volume_snapshot": False, 672 "disable_volume_snapshot": False,
673 "create_volume": True,
673 } 674 }
674 675
675A dictionary of settings which can be used to provide the default values for 676A dictionary of settings which can be used to provide the default values for
@@ -681,6 +682,10 @@ Drive property.
681The ``enable_scheduler_hints`` setting specifies whether or not Scheduler Hints 682The ``enable_scheduler_hints`` setting specifies whether or not Scheduler Hints
682can be provided when launching an instance. 683can be provided when launching an instance.
683 684
685The ``create_volume`` setting allows you to specify the default value for the
686option of creating a new volume in the workflow for image and instance snapshot
687sources.
688
684The ``disable_image`` setting disables Images as a valid boot source for launching 689The ``disable_image`` setting disables Images as a valid boot source for launching
685instances. Image sources won't show up in the Launch Instance modal. 690instances. Image sources won't show up in the Launch Instance modal.
686 691
diff --git a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-model.service.js b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-model.service.js
index deebfdf..f76ea5b 100644
--- a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-model.service.js
+++ b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-model.service.js
@@ -195,6 +195,7 @@
195 // REQUIRED for JS logic (image | snapshot | volume | volume_snapshot) 195 // REQUIRED for JS logic (image | snapshot | volume | volume_snapshot)
196 source_type: null, 196 source_type: null,
197 source: [], 197 source: [],
198 create_volume_default: true,
198 // REQUIRED for JS logic 199 // REQUIRED for JS logic
199 vol_create: false, 200 vol_create: false,
200 // May be null 201 // May be null
@@ -278,6 +279,10 @@
278 if ('config_drive' in defaults) { 279 if ('config_drive' in defaults) {
279 model.newInstanceSpec.config_drive = defaults.config_drive; 280 model.newInstanceSpec.config_drive = defaults.config_drive;
280 } 281 }
282 if ('create_volume' in defaults) {
283 // Append "_default" to distinguish from the 'vol_create' item
284 model.newInstanceSpec.create_volume_default = defaults.create_volume;
285 }
281 } 286 }
282 287
283 /** 288 /**
diff --git a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-model.service.spec.js b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-model.service.spec.js
index 87b07fe..0ed7f92 100644
--- a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-model.service.spec.js
+++ b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-model.service.spec.js
@@ -158,6 +158,7 @@
158 beforeEach(function () { 158 beforeEach(function () {
159 settings = { 159 settings = {
160 LAUNCH_INSTANCE_DEFAULTS: { 160 LAUNCH_INSTANCE_DEFAULTS: {
161 create_volume: true,
161 config_drive: false, 162 config_drive: false,
162 disable_image: false, 163 disable_image: false,
163 disable_instance_snapshot: false, 164 disable_instance_snapshot: false,
@@ -485,6 +486,22 @@
485 expect(model.newInstanceSpec.config_drive).toBe(true); 486 expect(model.newInstanceSpec.config_drive).toBe(true);
486 }); 487 });
487 488
489 it('should default create_volume to true if setting not provided', function() {
490 delete settings.LAUNCH_INSTANCE_DEFAULTS.create_volume;
491 model.initialize(true);
492 scope.$apply();
493
494 expect(model.newInstanceSpec.create_volume_default).toBe(true);
495 });
496
497 it('should default create_volume to false based on setting', function() {
498 settings.LAUNCH_INSTANCE_DEFAULTS.create_volume = false;
499 model.initialize(true);
500 scope.$apply();
501
502 expect(model.newInstanceSpec.create_volume_default).toBe(false);
503 });
504
488 it('should not set availability zone if the zone list is empty', function () { 505 it('should not set availability zone if the zone list is empty', function () {
489 spyOn(novaApi, 'getAvailabilityZones').and.callFake(function () { 506 spyOn(novaApi, 'getAvailabilityZones').and.callFake(function () {
490 var deferred = $q.defer(); 507 var deferred = $q.defer();
@@ -583,6 +600,7 @@
583 }); 600 });
584 601
585 it('should have proper allowedBootSources if specific settings missing', function() { 602 it('should have proper allowedBootSources if specific settings missing', function() {
603 delete settings.LAUNCH_INSTANCE_DEFAULTS.create_volume;
586 delete settings.LAUNCH_INSTANCE_DEFAULTS.disable_image; 604 delete settings.LAUNCH_INSTANCE_DEFAULTS.disable_image;
587 delete settings.LAUNCH_INSTANCE_DEFAULTS.disable_instance_snapshot; 605 delete settings.LAUNCH_INSTANCE_DEFAULTS.disable_instance_snapshot;
588 delete settings.LAUNCH_INSTANCE_DEFAULTS.disable_volume; 606 delete settings.LAUNCH_INSTANCE_DEFAULTS.disable_volume;
@@ -595,6 +613,7 @@
595 expect(model.allowedBootSources).toContain(INSTANCE_SNAPSHOT); 613 expect(model.allowedBootSources).toContain(INSTANCE_SNAPSHOT);
596 expect(model.allowedBootSources).toContain(VOLUME); 614 expect(model.allowedBootSources).toContain(VOLUME);
597 expect(model.allowedBootSources).toContain(VOLUME_SNAPSHOT); 615 expect(model.allowedBootSources).toContain(VOLUME_SNAPSHOT);
616 expect(model.newInstanceSpec.create_volume_default).toBe(true);
598 }); 617 });
599 618
600 it('should have no images if disable_image is set to true', function() { 619 it('should have no images if disable_image is set to true', function() {
@@ -750,7 +769,7 @@
750 // This is here to ensure that as people add/change items, they 769 // This is here to ensure that as people add/change items, they
751 // don't forget to implement tests for them. 770 // don't forget to implement tests for them.
752 it('has the right number of properties', function() { 771 it('has the right number of properties', function() {
753 expect(Object.keys(model.newInstanceSpec).length).toBe(21); 772 expect(Object.keys(model.newInstanceSpec).length).toBe(22);
754 }); 773 });
755 774
756 it('sets availability zone to null', function() { 775 it('sets availability zone to null', function() {
@@ -765,6 +784,10 @@
765 expect(model.newInstanceSpec.config_drive).toBe(false); 784 expect(model.newInstanceSpec.config_drive).toBe(false);
766 }); 785 });
767 786
787 it('sets create volume to true', function() {
788 expect(model.newInstanceSpec.create_volume_default).toBe(true);
789 });
790
768 it('sets user data to an empty string', function() { 791 it('sets user data to an empty string', function() {
769 expect(model.newInstanceSpec.user_data).toBe(''); 792 expect(model.newInstanceSpec.user_data).toBe('');
770 }); 793 });
diff --git a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/source/source.controller.js b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/source/source.controller.js
index 8444d70..4892c86 100644
--- a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/source/source.controller.js
+++ b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/source/source.controller.js
@@ -418,7 +418,8 @@
418 ctrl.currentBootSource = selectedSource; 418 ctrl.currentBootSource = selectedSource;
419 if ((selectedSource === bootSourceTypes.IMAGE || 419 if ((selectedSource === bootSourceTypes.IMAGE ||
420 selectedSource === bootSourceTypes.INSTANCE_SNAPSHOT) && $scope.model.volumeBootable) { 420 selectedSource === bootSourceTypes.INSTANCE_SNAPSHOT) && $scope.model.volumeBootable) {
421 $scope.model.newInstanceSpec.vol_create = true; 421 $scope.model.newInstanceSpec.vol_create =
422 $scope.model.newInstanceSpec.create_volume_default;
422 } else { 423 } else {
423 $scope.model.newInstanceSpec.vol_create = false; 424 $scope.model.newInstanceSpec.vol_create = false;
424 } 425 }
diff --git a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/source/source.controller.spec.js b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/source/source.controller.spec.js
index b874c13..5834a8d 100644
--- a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/source/source.controller.spec.js
+++ b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/source/source.controller.spec.js
@@ -50,7 +50,7 @@
50 50
51 scope.model = { 51 scope.model = {
52 allowedBootSources: [{type: 'image', label: 'Image'}], 52 allowedBootSources: [{type: 'image', label: 'Image'}],
53 newInstanceSpec: { source: [], source_type: '' }, 53 newInstanceSpec: { source: [], source_type: '', create_volume_default: true },
54 images: [ { id: 'image-1' }, { id: 'image-2' } ], 54 images: [ { id: 'image-1' }, { id: 'image-2' } ],
55 imageSnapshots: [ { id: 'imageSnapshot-1' } ], 55 imageSnapshots: [ { id: 'imageSnapshot-1' } ],
56 volumes: [ { id: 'volume-1' }, { id: 'volume-2' } ], 56 volumes: [ { id: 'volume-1' }, { id: 'volume-2' } ],
diff --git a/openstack_dashboard/local/local_settings.py.example b/openstack_dashboard/local/local_settings.py.example
index deca94c..2eb3d22 100644
--- a/openstack_dashboard/local/local_settings.py.example
+++ b/openstack_dashboard/local/local_settings.py.example
@@ -257,6 +257,7 @@ OPENSTACK_KEYSTONE_BACKEND = {
257# 'disable_instance_snapshot': False, 257# 'disable_instance_snapshot': False,
258# 'disable_volume': False, 258# 'disable_volume': False,
259# 'disable_volume_snapshot': False, 259# 'disable_volume_snapshot': False,
260# 'create_volume': True,
260#} 261#}
261 262
262# The Xen Hypervisor has the ability to set the mount point for volumes 263# The Xen Hypervisor has the ability to set the mount point for volumes
diff --git a/releasenotes/notes/bug-1678109-4440ebe90908647d.yaml b/releasenotes/notes/bug-1678109-4440ebe90908647d.yaml
new file mode 100644
index 0000000..e0cde11
--- /dev/null
+++ b/releasenotes/notes/bug-1678109-4440ebe90908647d.yaml
@@ -0,0 +1,5 @@
1---
2features:
3 - Added a new ``create_volume`` setting under the
4 ``LAUNCH_INSTANCE_DEFAULTS`` dict. This allows you to set the default value
5 of "Create Volume", when Cinder is available.