Merge "Add hide_create_volume to LAUNCH_INSTANCE_DEFAULTS"
This commit is contained in:
commit
741624d3f1
|
@ -1965,6 +1965,10 @@ LAUNCH_INSTANCE_DEFAULTS
|
||||||
|
|
||||||
Added the ``create_volume`` option.
|
Added the ``create_volume`` option.
|
||||||
|
|
||||||
|
.. versionchanged:: 15.0.0(Stein)
|
||||||
|
|
||||||
|
Added the ``hide_create_volume`` option.
|
||||||
|
|
||||||
Default:
|
Default:
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
@ -1972,6 +1976,7 @@ Default:
|
||||||
{
|
{
|
||||||
"config_drive": False,
|
"config_drive": False,
|
||||||
"create_volume": True,
|
"create_volume": True,
|
||||||
|
"hide_create_volume": False,
|
||||||
"disable_image": False,
|
"disable_image": False,
|
||||||
"disable_instance_snapshot": False,
|
"disable_instance_snapshot": False,
|
||||||
"disable_volume": False,
|
"disable_volume": False,
|
||||||
|
@ -2002,6 +2007,17 @@ Default: ``True``
|
||||||
This setting allows you to specify the default value for the option of creating
|
This 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.
|
a new volume in the workflow for image and instance snapshot sources.
|
||||||
|
|
||||||
|
hide_create_volume
|
||||||
|
##################
|
||||||
|
|
||||||
|
.. versionadded:: 15.0.0(Stein)
|
||||||
|
|
||||||
|
Default: ``False``
|
||||||
|
|
||||||
|
This setting allow your to hide the "Create New Volume" option and rely on the
|
||||||
|
default value you select with ``create_volume`` to be the most suitable for your
|
||||||
|
users.
|
||||||
|
|
||||||
disable_image
|
disable_image
|
||||||
#############
|
#############
|
||||||
|
|
||||||
|
|
|
@ -203,6 +203,7 @@
|
||||||
source: [],
|
source: [],
|
||||||
create_volume_default: true,
|
create_volume_default: true,
|
||||||
// REQUIRED for JS logic
|
// REQUIRED for JS logic
|
||||||
|
hide_create_volume: false,
|
||||||
vol_create: false,
|
vol_create: false,
|
||||||
// May be null
|
// May be null
|
||||||
vol_device_name: 'vda',
|
vol_device_name: 'vda',
|
||||||
|
@ -297,6 +298,9 @@
|
||||||
// Append "_default" to distinguish from the 'vol_create' item
|
// Append "_default" to distinguish from the 'vol_create' item
|
||||||
model.newInstanceSpec.create_volume_default = defaults.create_volume;
|
model.newInstanceSpec.create_volume_default = defaults.create_volume;
|
||||||
}
|
}
|
||||||
|
if ('hide_create_volume' in defaults) {
|
||||||
|
model.newInstanceSpec.hide_create_volume = defaults.hide_create_volume;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -160,6 +160,7 @@
|
||||||
settings = {
|
settings = {
|
||||||
LAUNCH_INSTANCE_DEFAULTS: {
|
LAUNCH_INSTANCE_DEFAULTS: {
|
||||||
create_volume: true,
|
create_volume: true,
|
||||||
|
hide_create_volume: false,
|
||||||
config_drive: false,
|
config_drive: false,
|
||||||
disable_image: false,
|
disable_image: false,
|
||||||
disable_instance_snapshot: false,
|
disable_instance_snapshot: false,
|
||||||
|
@ -512,6 +513,22 @@
|
||||||
expect(model.newInstanceSpec.create_volume_default).toBe(false);
|
expect(model.newInstanceSpec.create_volume_default).toBe(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should default hide_create_volume to false if setting not provided', function() {
|
||||||
|
delete settings.LAUNCH_INSTANCE_DEFAULTS.hide_create_volume;
|
||||||
|
model.initialize(true);
|
||||||
|
scope.$apply();
|
||||||
|
|
||||||
|
expect(model.newInstanceSpec.hide_create_volume).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should default hide_create_volume to true based on setting', function() {
|
||||||
|
settings.LAUNCH_INSTANCE_DEFAULTS.hide_create_volume = true;
|
||||||
|
model.initialize(true);
|
||||||
|
scope.$apply();
|
||||||
|
|
||||||
|
expect(model.newInstanceSpec.hide_create_volume).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
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();
|
||||||
|
@ -825,7 +842,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(22);
|
expect(Object.keys(model.newInstanceSpec).length).toBe(23);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('sets availability zone to null', function() {
|
it('sets availability zone to null', function() {
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
<div ng-if="(model.newInstanceSpec.source_type.type === 'image' ||
|
<div ng-if="(model.newInstanceSpec.source_type.type === 'image' ||
|
||||||
model.newInstanceSpec.source_type.type === 'snapshot') &&
|
model.newInstanceSpec.source_type.type === 'snapshot') &&
|
||||||
model.allowCreateVolumeFromImage">
|
model.allowCreateVolumeFromImage && !model.newInstanceSpec.hide_create_volume">
|
||||||
<div class="col-xs-6">
|
<div class="col-xs-6">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="vol-create" translate>Create New Volume</label><br/>
|
<label for="vol-create" translate>Create New Volume</label><br/>
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
---
|
||||||
|
features:
|
||||||
|
- Added a new ``hide_create_volume`` setting under the
|
||||||
|
``LAUNCH_INSTANCE_DEFAULTS`` dict. This allows you to hide the
|
||||||
|
"Create New Volume" option in the "Launch Instance" form and instead rely
|
||||||
|
on the default value you select with ``create_volume`` is the best suitable
|
||||||
|
option for your users.
|
Loading…
Reference in New Issue