← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 2081878] Re: Allow the default for "Delete Volume on Instance Delete" instance creation option to be configurable

 

Reviewed:  https://review.opendev.org/c/openstack/horizon/+/948058
Committed: https://opendev.org/openstack/horizon/commit/f0ea8b153de1510ee5302d4bcdfd564572c4c09f
Submitter: "Zuul (22348)"
Branch:    master

commit f0ea8b153de1510ee5302d4bcdfd564572c4c09f
Author: Dmitriy Chubinidze <dcu995@xxxxxxxxx>
Date:   Thu Apr 24 10:23:31 2025 +0000

    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


** Changed in: horizon
       Status: In Progress => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Dashboard (Horizon).
https://bugs.launchpad.net/bugs/2081878

Title:
  Allow the default for "Delete Volume on Instance Delete" instance
  creation option to be configurable

Status in OpenStack Dashboard (Horizon):
  Fix Released

Bug description:
  When creating an instance with the "Create New Volume" option selected
  (the default), there's an option to "Delete Volume on Instance Delete"
  which defaults to "No". This default is hard-coded, and is a sensible
  default, but there are situations when an operator may wish to change
  the default to "Yes". I'm in that position where we have a more
  controlled use case and don't want users accidentally leaving orphaned
  volumes behind.

  A simple change to allow this is:

  --- horizon-24.0.0.orig/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-model.service.js
  +++ horizon-24.0.0/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-model.service.js
  @@ -309,6 +309,9 @@
         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;
  +      }
       }

       /**
  --- horizon-24.0.0.orig/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/source/source.controller.js
  +++ horizon-24.0.0/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/source/source.controller.js
  @@ -471,7 +471,7 @@
         } else {
           $scope.model.newInstanceSpec.vol_create = false;
         }
  -      $scope.model.newInstanceSpec.vol_delete_on_instance_delete = false;
  +      //$scope.model.newInstanceSpec.vol_delete_on_instance_delete = false;
         changeBootSource(selectedSource, preSelection);
         validateBootSourceType();
       }

  
  This doesn't alter the existing behaviour by default, but does allow local_settings.py to optionally contain:

  LAUNCH_INSTANCE_DEFAULTS.update({
      'vol_delete_on_instance_delete': True,
  })

  Which then changes the default for "Delete Volume on Instance Delete"
  to "Yes" in the web interface.

  Change tested against 24.0.0.

To manage notifications about this bug go to:
https://bugs.launchpad.net/horizon/+bug/2081878/+subscriptions



References