Make "Delete Volume on Instance Delete" configurable

Adds support for configuring the default value of
the 'Delete Volume on Instance Delete' option during
instance creation.

Co-authored-by: Tim Bishop <https://launchpad.net/~tdb>
Change-Id: I0f7d38bd9ad1be653d5f9d551b611e62c4b082b4
Closes-Bug: #2081878
This commit is contained in:
Dmitriy Chubinidze
2025-04-24 10:23:31 +00:00
parent 7dcf84aa10
commit f0ea8b153d
5 changed files with 29 additions and 3 deletions

View File

@@ -2242,6 +2242,10 @@ LAUNCH_INSTANCE_DEFAULTS
Added the ``enable_metadata``, ``enable_net_ports`` options.
.. versionchanged:: 2025.2(Flamingo)
Added the ``vol_delete_on_instance_delete`` option.
Default:
.. code-block:: python
@@ -2258,6 +2262,7 @@ Default:
"enable_metadata": True,
"enable_net_ports": True,
"default_availability_zone": "Any",
"vol_delete_on_instance_delete": False
}
A dictionary of settings which can be used to provide the default values for
@@ -2380,6 +2385,18 @@ specified in this setting is not found in the availability zone list,
the setting will be ignored and the behavior will be same as when ``Any``
is specified.
vol_delete_on_instance_delete
#############################
.. versionadded:: 2025.2(Flamingo)
Default: ``False``
This option controls the default behavior of the 'Delete Volume on Instance
Delete' setting in the web interface. If set to ``True``, the default is 'Yes',
meaning volumes will be deleted when the instance is deleted. If set to
``False`` (default), the setting remains 'No', and volumes are preserved.
OPENSTACK_SERVER_DEFAULT_USER_DATA
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@@ -309,6 +309,10 @@
if ('default_availability_zone' in defaults) {
model.default_availability_zone = defaults.default_availability_zone;
}
if ('vol_delete_on_instance_delete' in defaults) {
model.newInstanceSpec.vol_delete_on_instance_delete =
defaults.vol_delete_on_instance_delete;
}
}
/**

View File

@@ -471,7 +471,6 @@
} else {
$scope.model.newInstanceSpec.vol_create = false;
}
$scope.model.newInstanceSpec.vol_delete_on_instance_delete = false;
changeBootSource(selectedSource, preSelection);
validateBootSourceType();
}

View File

@@ -357,7 +357,6 @@
expect(ctrl.currentBootSource).toEqual('image');
expect(scope.model.newInstanceSpec.vol_create).toBe(false);
expect(scope.model.newInstanceSpec.vol_delete_on_instance_delete).toBe(false);
// check table data
expect(ctrl.tableData).toBeDefined();
@@ -373,7 +372,6 @@
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() {

View File

@@ -0,0 +1,8 @@
---
features:
- |
Added support for configuring the default value of the
"Delete Volume on Instance Delete" option during instance creation.
This setting can now be predefined in the Horizon local_settings.py
file, allowing administrators to control the default behavior for volume
deletion when an instance is deleted.