← Back to team overview

yahoo-eng-team team mailing list archive

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

 

Public bug reported:

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.

** Affects: horizon
     Importance: Undecided
         Status: New

-- 
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):
  New

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