Add config for default create volume option
This patch adds the ability to configure the default "create volume"
value when launching an instance with Cinder enabled.
Co-Authored-By: Rob Cresswell <robert.cresswell@outlook.com>
Closes-Bug: 1678109
Change-Id: I272f7f1b20cc1276976c464a82d1776de92d17e7
(cherry picked from commit d734f482ec
)
This commit is contained in:
parent
3bc399f3ae
commit
6c0ec31de0
@ -670,6 +670,7 @@ Default::
|
|||||||
"disable_instance_snapshot": False,
|
"disable_instance_snapshot": False,
|
||||||
"disable_volume": False,
|
"disable_volume": False,
|
||||||
"disable_volume_snapshot": False,
|
"disable_volume_snapshot": False,
|
||||||
|
"create_volume": True,
|
||||||
}
|
}
|
||||||
|
|
||||||
A dictionary of settings which can be used to provide the default values for
|
A dictionary of settings which can be used to provide the default values for
|
||||||
@ -681,6 +682,10 @@ Drive property.
|
|||||||
The ``enable_scheduler_hints`` setting specifies whether or not Scheduler Hints
|
The ``enable_scheduler_hints`` setting specifies whether or not Scheduler Hints
|
||||||
can be provided when launching an instance.
|
can be provided when launching an instance.
|
||||||
|
|
||||||
|
The ``create_volume`` setting allows you to specify the default value for the
|
||||||
|
option of creating a new volume in the workflow for image and instance snapshot
|
||||||
|
sources.
|
||||||
|
|
||||||
The ``disable_image`` setting disables Images as a valid boot source for launching
|
The ``disable_image`` setting disables Images as a valid boot source for launching
|
||||||
instances. Image sources won't show up in the Launch Instance modal.
|
instances. Image sources won't show up in the Launch Instance modal.
|
||||||
|
|
||||||
|
@ -195,6 +195,7 @@
|
|||||||
// REQUIRED for JS logic (image | snapshot | volume | volume_snapshot)
|
// REQUIRED for JS logic (image | snapshot | volume | volume_snapshot)
|
||||||
source_type: null,
|
source_type: null,
|
||||||
source: [],
|
source: [],
|
||||||
|
create_volume_default: true,
|
||||||
// REQUIRED for JS logic
|
// REQUIRED for JS logic
|
||||||
vol_create: false,
|
vol_create: false,
|
||||||
// May be null
|
// May be null
|
||||||
@ -275,6 +276,10 @@
|
|||||||
if ('config_drive' in defaults) {
|
if ('config_drive' in defaults) {
|
||||||
model.newInstanceSpec.config_drive = defaults.config_drive;
|
model.newInstanceSpec.config_drive = defaults.config_drive;
|
||||||
}
|
}
|
||||||
|
if ('create_volume' in defaults) {
|
||||||
|
// Append "_default" to distinguish from the 'vol_create' item
|
||||||
|
model.newInstanceSpec.create_volume_default = defaults.create_volume;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -158,6 +158,7 @@
|
|||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
settings = {
|
settings = {
|
||||||
LAUNCH_INSTANCE_DEFAULTS: {
|
LAUNCH_INSTANCE_DEFAULTS: {
|
||||||
|
create_volume: true,
|
||||||
config_drive: false,
|
config_drive: false,
|
||||||
disable_image: false,
|
disable_image: false,
|
||||||
disable_instance_snapshot: false,
|
disable_instance_snapshot: false,
|
||||||
@ -481,6 +482,22 @@
|
|||||||
expect(model.newInstanceSpec.config_drive).toBe(true);
|
expect(model.newInstanceSpec.config_drive).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should default create_volume to true if setting not provided', function() {
|
||||||
|
delete settings.LAUNCH_INSTANCE_DEFAULTS.create_volume;
|
||||||
|
model.initialize(true);
|
||||||
|
scope.$apply();
|
||||||
|
|
||||||
|
expect(model.newInstanceSpec.create_volume_default).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should default create_volume to false based on setting', function() {
|
||||||
|
settings.LAUNCH_INSTANCE_DEFAULTS.create_volume = false;
|
||||||
|
model.initialize(true);
|
||||||
|
scope.$apply();
|
||||||
|
|
||||||
|
expect(model.newInstanceSpec.create_volume_default).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
it('should not set availability zone if the zone list is empty', function () {
|
it('should not set availability zone if the zone list is empty', function () {
|
||||||
spyOn(novaApi, 'getAvailabilityZones').and.callFake(function () {
|
spyOn(novaApi, 'getAvailabilityZones').and.callFake(function () {
|
||||||
var deferred = $q.defer();
|
var deferred = $q.defer();
|
||||||
@ -579,6 +596,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should have proper allowedBootSources if specific settings missing', function() {
|
it('should have proper allowedBootSources if specific settings missing', function() {
|
||||||
|
delete settings.LAUNCH_INSTANCE_DEFAULTS.create_volume;
|
||||||
delete settings.LAUNCH_INSTANCE_DEFAULTS.disable_image;
|
delete settings.LAUNCH_INSTANCE_DEFAULTS.disable_image;
|
||||||
delete settings.LAUNCH_INSTANCE_DEFAULTS.disable_instance_snapshot;
|
delete settings.LAUNCH_INSTANCE_DEFAULTS.disable_instance_snapshot;
|
||||||
delete settings.LAUNCH_INSTANCE_DEFAULTS.disable_volume;
|
delete settings.LAUNCH_INSTANCE_DEFAULTS.disable_volume;
|
||||||
@ -591,6 +609,7 @@
|
|||||||
expect(model.allowedBootSources).toContain(INSTANCE_SNAPSHOT);
|
expect(model.allowedBootSources).toContain(INSTANCE_SNAPSHOT);
|
||||||
expect(model.allowedBootSources).toContain(VOLUME);
|
expect(model.allowedBootSources).toContain(VOLUME);
|
||||||
expect(model.allowedBootSources).toContain(VOLUME_SNAPSHOT);
|
expect(model.allowedBootSources).toContain(VOLUME_SNAPSHOT);
|
||||||
|
expect(model.newInstanceSpec.create_volume_default).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should have no images if disable_image is set to true', function() {
|
it('should have no images if disable_image is set to true', function() {
|
||||||
@ -746,7 +765,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(21);
|
expect(Object.keys(model.newInstanceSpec).length).toBe(22);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('sets availability zone to null', function() {
|
it('sets availability zone to null', function() {
|
||||||
@ -761,6 +780,10 @@
|
|||||||
expect(model.newInstanceSpec.config_drive).toBe(false);
|
expect(model.newInstanceSpec.config_drive).toBe(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('sets create volume to true', function() {
|
||||||
|
expect(model.newInstanceSpec.create_volume_default).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
it('sets user data to an empty string', function() {
|
it('sets user data to an empty string', function() {
|
||||||
expect(model.newInstanceSpec.user_data).toBe('');
|
expect(model.newInstanceSpec.user_data).toBe('');
|
||||||
});
|
});
|
||||||
|
@ -419,7 +419,8 @@
|
|||||||
ctrl.currentBootSource = selectedSource;
|
ctrl.currentBootSource = selectedSource;
|
||||||
if ((selectedSource === bootSourceTypes.IMAGE ||
|
if ((selectedSource === bootSourceTypes.IMAGE ||
|
||||||
selectedSource === bootSourceTypes.INSTANCE_SNAPSHOT) && $scope.model.volumeBootable) {
|
selectedSource === bootSourceTypes.INSTANCE_SNAPSHOT) && $scope.model.volumeBootable) {
|
||||||
$scope.model.newInstanceSpec.vol_create = true;
|
$scope.model.newInstanceSpec.vol_create =
|
||||||
|
$scope.model.newInstanceSpec.create_volume_default;
|
||||||
} else {
|
} else {
|
||||||
$scope.model.newInstanceSpec.vol_create = false;
|
$scope.model.newInstanceSpec.vol_create = false;
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@
|
|||||||
|
|
||||||
scope.model = {
|
scope.model = {
|
||||||
allowedBootSources: [{type: 'image', label: 'Image'}],
|
allowedBootSources: [{type: 'image', label: 'Image'}],
|
||||||
newInstanceSpec: { source: [], source_type: '' },
|
newInstanceSpec: { source: [], source_type: '', create_volume_default: true },
|
||||||
images: [ { id: 'image-1' }, { id: 'image-2' } ],
|
images: [ { id: 'image-1' }, { id: 'image-2' } ],
|
||||||
imageSnapshots: [ { id: 'imageSnapshot-1' } ],
|
imageSnapshots: [ { id: 'imageSnapshot-1' } ],
|
||||||
volumes: [ { id: 'volume-1' }, { id: 'volume-2' } ],
|
volumes: [ { id: 'volume-1' }, { id: 'volume-2' } ],
|
||||||
|
@ -257,6 +257,7 @@ OPENSTACK_KEYSTONE_BACKEND = {
|
|||||||
# 'disable_instance_snapshot': False,
|
# 'disable_instance_snapshot': False,
|
||||||
# 'disable_volume': False,
|
# 'disable_volume': False,
|
||||||
# 'disable_volume_snapshot': False,
|
# 'disable_volume_snapshot': False,
|
||||||
|
# 'create_volume': True,
|
||||||
#}
|
#}
|
||||||
|
|
||||||
# The Xen Hypervisor has the ability to set the mount point for volumes
|
# The Xen Hypervisor has the ability to set the mount point for volumes
|
||||||
|
5
releasenotes/notes/bug-1678109-4440ebe90908647d.yaml
Normal file
5
releasenotes/notes/bug-1678109-4440ebe90908647d.yaml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- Added a new ``create_volume`` setting under the
|
||||||
|
``LAUNCH_INSTANCE_DEFAULTS`` dict. This allows you to set the default value
|
||||||
|
of "Create Volume", when Cinder is available.
|
Loading…
Reference in New Issue
Block a user