Jump to: navigation, search

Osops/Osops-coda

What is Coda?

Coda is a Horizon dashboard and panel (both share the name) that facilitates resource clean up of a project once that project is no longer needed (e.g. A customer cancels their account).

It consists of a single text entry box which allows you to search by project ID and will display all resources, project info, and user info for the project. Upon pressing the delete button the user is prompted each time for valid admin credentials (annoying but a purposeful safe-guard) and will then walk the list of resources deleting each one and will display the outcome of each operation in a tabular format.

History

This project started as a stand-alone Django app inside HP and has been very valuable in operating our public cloud. It was originally called Scrubber (because that’s what it did) but was renamed to Coda after being ported to Horizon and adapted for Keystone instead of a proprietary Identity service. It is the intent of HP to open source our entire suite of tools using a musical theme. Coda was chosen as the name for this project as a coda in music is a passage that brings a piece to an end. It is particularly apropos for this use because the symbol for a coda resembles a cross hair.

Requirements

Coda can be installed on a standard Horizon install. The only additional requirement is to have memcached installed and configured.

Installation

Coda can be installed / enabled using the standard Horizon method of placing an extension file under the horizon/openstack_dashboard/local/enabled/ or horizon/openstack_dashboard/enabled/ directory. I named mine _ 42_coda.py and here are the contents.

# The name of the dashboard to be added to HORIZON['dashboards']. Required.
DASHBOARD = 'coda'

# If set to True, this dashboard will not be added to the settings.
DISABLED = False

# A list of applications to be added to INSTALLED_APPS.
ADD_INSTALLED_APPS = [
    'openstack_dashboard.dashboards.coda',
]

I put the contents of the git repo into /horizon/openstack_dashboard/dashboards/coda.

Finally in order to pick up coda specific configs found in the file mentioned below I needed to add the following code to the end of the local_settings.py file:

def load_coda():
      import imp
  
      #Go up a level, coda should be installed there.
      local_settings_dir = os.path.split(os.path.dirname(os.path.realpath(__file__)))[0]
      local_settings_dir+="/dashboards/coda"
  
      #print local_settings_dir
      module = imp.load_source("coda", "%s/coda.py" % local_settings_dir)
      for attr in dir(module):
          if not attr.startswith('_'):
              globals()[attr] = getattr(module, attr)

load_coda()

This is probably less than ideal and is one of my next priorities to fix.

Additionally there are settings in a file on the dashboard root directory called coda.py. The git repo contains example settings in this file and will need to be adjusted for your environment.

Warning

Test this throughly in your development environment before running it in production. This code deletes resources and once they are gone there is no turning back!

Road Map

Fixes and improvements I want to make soon.

  • Images are handled differently. This is because HP's public cloud used v1 of the glance API which doesn't have a good way to filter images (we had over 10k, and the call took a while to return). My work around was to get all images up front and store them separately. In testing on HOS which used v2 I found this to be unnecessary and this code path can be removed and standardized to use the dispatch map like the other API calls.
  • Make a version that works with both Keystone 2.0 and 3.0 (in order to upload this version I had to rip out domain support. I'd like to get that back.)
  • Add appropriate logging
  • Add a logo and clean up some of the UI ugliness

Demo

This is also the first demo video I've ever made so no making fun of me please. Well, ok, just keep it with in reason :) Coda Demo on my YouTube Channel