SlideShare a Scribd company logo
OpenStack Horizon: 
Controlling the Cloud using Django 
OPENSTACK THAT JUST WORKS 
David Lapsley 
@devlaps, david.lapsley@metacloud.com 
August 21, 2014
OpenStack Horizon in Action 
OPENSTACK THAT JUST WORKS
Launching an Instance
Admin Overview
Project Overview
Launching an Instance
Launching an Instance
Launching an Instance
Launching an Instance
Launching an Instance
Launching an Instance
OpenStack Clouds 
Architecture and Model 
OPENSTACK THAT JUST WORKS
OpenStack Model 
http://docs.openstack.org/openstack-ops/content/example_architecture.html 
http://docs.openstack.org/training-guides/content/module001-ch004-openstack-architecture.html
OpenStack Projects 
● Compute (Nova) 
● Network (Nova, Neutron) 
● VM Registration (Glance) 
● Identity (Keystone) 
● Object Storage (Swift, …) 
● Block Storage (Cinder) 
● Dashboard (Horizon)
OpenStack Horizon 
Controlling the Cloud with Django 
OPENSTACK THAT JUST WORKS
Horizon Overview 
● Django-based application deployed via 
Apache and WSGI 
● Provides access to OpenStack services 
● Leverages existing technologies 
o Bootstrap, jQuery, Underscore.js, 
AngularJS, D3.js, Rickshaw, LESS CSS 
● Extends Django to enhance extensibility
Django Stack
Horizon Stack
Horizon UI Structure 
Branding 
Dashboard 
Panel Group 
Panel 
Sidebar 
Projects User Info 
Panel Content
Admin Dashboard
Admin Dashboard
Project Dashboard
Project Dashboard
Horizon CSS Structure
OpenStack Horizon 
Panels and Features 
OPENSTACK THAT JUST WORKS
Instance List
Filtering
Sorting
Sorting
Row Actions
Table Actions
Table Actions
Table Actions
Table Actions
Instance Details
Instance Details
Instance Log
Instance Console
OpenStack Horizon 
Dashboards and Panels 
OPENSTACK THAT JUST WORKS
Dashboards & Panels 
● Horizon provides a flexible framework for 
creating Dashboards and Panels 
● Panels grouped into PanelGroups 
● PanelGroups into Dashboards
Dashboard App 
● Dashboards created as Django Applications 
● Dashboard modules partitioned into: 
o static 
o templates 
o python modules
Directory Structure 
cloudopen/ 
__init__.py 
dashboard.py 
templates/ 
cloudopen/ 
static/ 
cloudopen/ 
css/ 
img/ 
js/
settings.py 
INSTALLED_APPS = ( 
... 
'horizon', 
'openstack_dashboard.dashboards.project', 
'openstack_dashboard.dashboards.admin', 
'openstack_dashboard.dashboards.metacloud', 
'openstack_dashboard.dashboards.settings', 
'openstack_dashboard.dashboards.cloudopen', 
... 
)
dashboard.py 
class BasePanelGroup(horizon.PanelGroup): 
slug = "overview" 
name = _("Overview") 
panels = ("hypervisors",) 
class CloudOpen(horizon.Dashboard): 
name = _("Cloudopen") 
slug = "cloudopen" 
panels = (BasePanelGroup,) 
default_panel = "hypervisors" 
roles = ("admin",) 
horizon.register(CloudOpen)
CloudOpen Dashboard 
Dashboard 
PanelGroup
Panel 
● Panels are created as Python Modules 
● Panel modules partitioned into: 
o static/ 
o templates/ 
o python modules: 
 urls.py, views.py, panel.py 
 tables.py, forms.py, tabs.py, tests.py
Directory Structure 
cloudopen/ 
hypervisors/ 
__init__.py 
panel.py 
urls.py 
views.py 
tests.py 
tables.py 
templates/ 
cloudopen/ 
hypervisors/ 
index.html 
static/ 
cloudopen/ 
hypervisors/
panel.py 
from django.utils.translation import ugettext_lazy as _ 
import horizon 
from openstack_dashboard.dashboards.cloudopen import dashboard 
class Hypervisors(horizon.Panel): 
name = _(”Hypervisors") 
slug = 'hypervisors' 
dashboard.CloudOpen.register(Hypervisors)
CloudOpen Dashboard 
Dashboard 
PanelGroup 
Panel
View Module 
● View module ties together everything: 
o Tables, Templates, API Calls 
● Horizon base views: 
o APIView, LoginView, MultiTableView, 
DataTableView, MixedDataTableView, 
TabView, TabbedTableView, WorkflowView
views.py 
from horizon import tables 
class HypervisorsIndexView(tables.DataTableView): 
table_class = hv_tables.AdminHypervisorsTable 
template_name = ’cloudopen/hypervisors/index.html’ 
def get_data(self): 
hypervisors = [] 
states = {} 
hypervisors = api.nova.hypervisor_list(self.request) 
… 
return hypervisors
Table Module 
● Table classes provide framework for tables: 
o consistent look and feel 
o configurable table_actions and row_actions 
o select/multi-select column 
o sorting 
o pagination 
● Functionality is split server- and client-side
tables.py 
class EnableAction(tables.BatchAction): 
… 
class DisableAction(tables.BatchAction): 
name = 'disable' 
classes = ('btn-danger',) 
def allowed(self, request, hv): 
return hv.service.get('status') == 'enabled' 
def action(self, request, obj_id): 
hv = api.nova.hypervisor_get(request, obj_id) 
host = getattr(hv, hv.NAME_ATTR) 
return api.nova.service_disable(request, host, 'nova-compute') 
def search_link(x): 
return '/admin/instances?q={0}'.format(x.hypervisor_hostname)
tables.py 
class AdminHypervisorsTable(tables.DataTable): 
hypervisor_hostname = tables.Column( 
'hypervisor_hostname', verbose_name=_('Hostname')) 
state = tables.Column( 
lambda hyp: hyp.service.get('state', _('UNKNOWN')).title(), 
verbose_name=_('State')) 
running_vms = tables.Column( 
'running_vms', link=search_link, verbose_name=_('Instances')) 
... 
class Meta: 
name = 'hypervisors' 
verbose_name = _('Hypervisors') 
row_actions = (EnableAction, DisableAction)
Template 
● Standard Django template format 
● Typically leverage base horizon templates 
(e.g. base.html)
index.html 
{% extends 'base.html' %} 
{% load i18n horizon humanize sizeformat %} 
{% block title %}{% trans 'Hypervisors' %}{% endblock %} 
{% block page_header %} 
{% include 'horizon/common/_page_header.html' with title=_('All 
Hypervisors') %} 
{% endblock page_header %} 
{% block main %} 
<div class="quota-dynamic"> 
<h3>{% trans "Hypervisor Summary" %}</h3> 
<div class="d3_quota_bar"> 
<div class="d3_pie_chart" …></div> 
</div> 
… 
</div> 
{{ table.render }} 
{% endblock %}
URLs Modules 
● Provides URL to View mappings
urls.py 
from django.conf.urls import patterns 
from django.conf.urls import url 
from openstack_dashboard.dashboards.cloudopen.hypervisors import views 
urlpatterns = patterns( 
'openstack_dashboard.dashboards.cloudopen.hypervisors.views' 
url(r'^$', views.IndexView.as_view(), name='index'), 
)
Completed Dashboard! 
Nav entries 
Column sorting 
Panel rendering 
Linking 
Data retrieval RPC 
Row actions
Click through to Instances
OpenStack Horizon 
Customization Hooks 
OPENSTACK THAT JUST WORKS
Customization Hooks 
● Change Site Title, Logo, Brand Links 
● Modify Dashboards and Panels 
● Change Button Styles 
● Use Custom Stylesheets 
● Use Custom Javascript
Custom Overrides Module 
● For site-wide customization, Horizon allows for a 
user-defined python customization module 
● Customizations can include: 
o Registering/unregistering panels 
o Modifying dashboard or panel attributes 
o Moving panels between dashboards 
o Modifying attributes of existing UI elements
local_settings.py 
HORIZON_CONFIG = { 
... 
'customization_module': 
'openstack_dashboard.dashboards.cloudopen.overrides', 
'test_enabled': True, 
}
overrides.py 
from openstack_dashboard.dashboards.cloudopen.test import panel 
as test_panel 
from openstack_dashboard.dashboards.cloudopen import dashboard  
as cloudopen_dashboard 
from django.conf import settings 
import horizon 
CLOUDOPEN_DASHBOARD_SETTINGS = horizon.get_dashboard('cloudopen') 
if settings.HORIZON_CONFIG.get('test_enabled'): 
CLOUDOPEN_DASHBOARD_SETTINGS .register(test_panel.Tests)
Full CloudOpen Dashboard
Test Panel
OpenStack Horizon 
Pluggable Settings 
OPENSTACK THAT JUST WORKS
Pluggable Settings 
● Since Icehouse release, Horizon enables 
pluggable settings to control structure 
o Enable/Disable new Dashboards 
o Add new PanelGroups 
o Add/Remove Panels to/from PanelGroups 
● Settings all live in: 
o openstack_dashboard/local/enabled
Pluggable Settings 
_10_cloudopen.py 
_20_cloudopen_add_panel_group.py 
_30_tests_add_panel.py 
__init__.py
Pluggable Settings 
_10_cloudopen.py 
DASHBOARD = 'cloudopen' 
DISABLED = False 
ADD_INSTALLED_APPS = [ 
'openstack_dashboard.dashboards.cloudopen', 
]
Pluggable Settings 
_20_cloudopen_add_panel_group.py 
PANEL_GROUP = 'tests' 
PANEL_GROUP_NAME = 'Tests' 
PANEL_GROUP_DASHBOARD = 'cloudopen'
Pluggable Settings 
_30_tests_add_panel.py 
PANEL = 'test' 
PANEL_DASHBOARD = 'cloudopen' 
PANEL_GROUP = 'tests' 
ADD_PANEL =  
'openstack_dashboard.dashboards.cloudopen.test.panel.Tests'
Pluggable Settings 
_30_tests_add_panel.py 
PANEL = 'test' 
PANEL_DASHBOARD = 'cloudopen' 
PANEL_GROUP = 'tests' 
ADD_PANEL =  
'openstack_dashboard.dashboards.cloudopen.test.panel.Tests'
Pluggable Settings
Pluggable Settings 
_30_overview_add_panel.py 
PANEL = 'test' 
PANEL_DASHBOARD = 'cloudopen' 
PANEL_GROUP = 'overview' 
ADD_PANEL =  
'openstack_dashboard.dashboards.cloudopen.test.panel.Tests'
Pluggable Settings
OpenStack Horizon 
Custom CSS and JS 
OPENSTACK THAT JUST WORKS
Custom CSS and Javascript 
● Horizon templates provides blocks for custom 
CSS and Javascript 
● To add custom CSS/JS, can either extend existing 
templates, or replace with your own custom 
templates
base.html 
<!DOCTYPE html> 
<html> 
<head> 
<title>{% block title %}{% endblock %} - {% site_branding %}</title> 
{% block css %} 
{% include "_stylesheets.html" %} 
{% endblock %} 
. . . 
</head> 
<body id="{% block body_id %}{% endblock %}"> 
{% block content %} 
. . . 
{% endblock %} 
<div id="footer">{% block footer %}{% endblock %}</div> 
{% block js %} 
{% include "horizon/_scripts.html" %} 
{% endblock %} 
</body> 
</html>
index.html 
{% extends "base.html" %} 
{% load i18n %} 
{% block title %}{% trans "Volumes" %}{% endblock %} 
{% block css %} 
{% include "cloudopen/_stylesheets.html" %} 
{% endblock %} 
{% block page_header %} 
{% include "horizon/common/_page_header.html" with title=_("Volumes") %} 
{% endblock page_header %} 
{% block main %} 
<div id="volumes">{{ volumes_table.render }}</div> 
<div id="volume-types">{{ volume_types_table.render }}</div> 
{% endblock %} 
{% block js%} 
{% include "cloudopen/_scripts.html" %} 
{% endblock %}
Horizon Base View
Customized UI 
Home button Project selector 
Simplified Nav 
Context-driven Admin Panel
Customized UI
Customized UI
Customized UI 
Instance locking
Customized UI 
Hypervisor Actions 
Controller Page
Advanced Features 
OPENSTACK THAT JUST WORKS
Client-side Rendering 
“Full” dataset search 
“Full” pagination Cache up to 1K records client-side
Real-time Data 
Updates every 5s 
Increased platform visibility 
Every node instrumented
Historical Metrics 
Up to 1 year of data 
Convenient access 
Increased platform visibility Every node instrumented
OpenStack Horizon 
OPENSTACK THAT JUST WORKS 
Contributing
Devstack and Contributing 
● Devstack: 
o “A documented shell script to build complete 
OpenStack development environments.” 
o http://devstack.org 
● Contributing to Horizon: 
– http://docs.openstack.org/developer/horizo 
n/contributing.html
OPENSTACK THAT JUST WORKS 
Thank You 
David Lapsley 
@devlaps, david.lapsley@metacloud.com
20140821 delapsley-cloudopen-public

More Related Content

PPTX
20141002 delapsley-socalangularjs-final
PPTX
20141001 delapsley-oc-openstack-final
PPTX
Client-side Rendering with AngularJS
PPTX
OpenStack Horizon: Controlling the Cloud using Django
PDF
Reporting solutions for ADF Applications
PDF
ERGroupware
PDF
Using redux and angular 2 with meteor
PDF
Revolution or Evolution in Page Object
20141002 delapsley-socalangularjs-final
20141001 delapsley-oc-openstack-final
Client-side Rendering with AngularJS
OpenStack Horizon: Controlling the Cloud using Django
Reporting solutions for ADF Applications
ERGroupware
Using redux and angular 2 with meteor
Revolution or Evolution in Page Object

What's hot (20)

PPTX
An ADF Special Report
PDF
iOS for ERREST - alternative version
PDF
Arquitetando seu aplicativo Android com Jetpack
KEY
Using ActiveObjects in Atlassian Plugins
PPT
Developing application for Windows Phone 7 in TDD
PPTX
Azure Day Reloaded 2019 - ARM Template workshop
PPTX
SenchaCon 2016: Ext JS + React: A Match Made in UX Heaven - Mark Brocato
PDF
Drupal8Day: Demystifying Drupal 8 Ajax Callback commands
PDF
Simplify AJAX using jQuery
PPT
Spring batch
PDF
Demystifying AJAX Callback Commands in Drupal 8
PPTX
Stratalux Cloud Formation and Chef Integration Presentation
PDF
XQuery Rocks
PDF
Drupal 8: Fields reborn
PPTX
Inside Azure Diagnostics
PDF
Михаил Крайнюк - Form API + Drupal 8: Form and AJAX
PPTX
Test and profile your Windows Phone 8 App
PDF
Effiziente Datenpersistierung mit JPA 2.1 und Hibernate
PPT
Presentation
PDF
Not your Grandma's XQuery
An ADF Special Report
iOS for ERREST - alternative version
Arquitetando seu aplicativo Android com Jetpack
Using ActiveObjects in Atlassian Plugins
Developing application for Windows Phone 7 in TDD
Azure Day Reloaded 2019 - ARM Template workshop
SenchaCon 2016: Ext JS + React: A Match Made in UX Heaven - Mark Brocato
Drupal8Day: Demystifying Drupal 8 Ajax Callback commands
Simplify AJAX using jQuery
Spring batch
Demystifying AJAX Callback Commands in Drupal 8
Stratalux Cloud Formation and Chef Integration Presentation
XQuery Rocks
Drupal 8: Fields reborn
Inside Azure Diagnostics
Михаил Крайнюк - Form API + Drupal 8: Form and AJAX
Test and profile your Windows Phone 8 App
Effiziente Datenpersistierung mit JPA 2.1 und Hibernate
Presentation
Not your Grandma's XQuery
Ad

Similar to 20140821 delapsley-cloudopen-public (20)

PDF
Introduction openstack horizon
PPT
OpenStack Dashboard - Diablo
PPT
Open stack dashboard diablo
PPSX
Extending Openstack Horizon for multi cloud management
PPSX
Extending Openstack Horizon for multi cloud management
PPT
openstack-session.ppt
PDF
"OpenStack — more than just software". Tom Fifield, OpenStack
PDF
OpenStack API's and WSGI
PPTX
Getting-Started-With-Openstack
PDF
Compute 101 - OpenStack Summit Vancouver 2015
PPTX
Extending OpenStack for Fun and Profit.pptx
PDF
Minimal OpenStack LinuxCon NA 2015
PPTX
Extending OpenStack for Fun and Profit
PPTX
Getting-Started-With-Openstack
PDF
Chef and OpenStack Workshop from ChefConf 2013
PPTX
Quick overview of Openstack architecture
PPTX
Some Advanced OpenStack Overview Document
PDF
Openstack 101
ODP
Deep Dive: OpenStack Summit (Red Hat Summit 2014)
PDF
Just one-shade-of-openstack
Introduction openstack horizon
OpenStack Dashboard - Diablo
Open stack dashboard diablo
Extending Openstack Horizon for multi cloud management
Extending Openstack Horizon for multi cloud management
openstack-session.ppt
"OpenStack — more than just software". Tom Fifield, OpenStack
OpenStack API's and WSGI
Getting-Started-With-Openstack
Compute 101 - OpenStack Summit Vancouver 2015
Extending OpenStack for Fun and Profit.pptx
Minimal OpenStack LinuxCon NA 2015
Extending OpenStack for Fun and Profit
Getting-Started-With-Openstack
Chef and OpenStack Workshop from ChefConf 2013
Quick overview of Openstack architecture
Some Advanced OpenStack Overview Document
Openstack 101
Deep Dive: OpenStack Summit (Red Hat Summit 2014)
Just one-shade-of-openstack
Ad

More from David Lapsley (7)

PPTX
Learn you some Ansible for great good!
PPTX
VXLAN Distributed Service Node
PPTX
Empowering Admins by taking away root (Improving platform visibility in Horizon)
PPTX
Real-time Statistics with Horizon
PPTX
Openstack Quantum Security Groups Session
PPTX
Openstack Quantum + Devstack Tutorial
PPTX
Openstack Nova and Quantum
Learn you some Ansible for great good!
VXLAN Distributed Service Node
Empowering Admins by taking away root (Improving platform visibility in Horizon)
Real-time Statistics with Horizon
Openstack Quantum Security Groups Session
Openstack Quantum + Devstack Tutorial
Openstack Nova and Quantum

20140821 delapsley-cloudopen-public

Editor's Notes

  • #19: Add client-side…
  • #24: Orchestration engine to launch multiple cloud applications based on templates in the form of text files that can be treated like code. Compatible with AWS Cloud Formation
  • #45: ----- Meeting Notes (8/20/14 20:59) ----- 30 mins
  • #49: ----- Meeting Notes (8/20/14 20:59) ----- 30 mins
  • #66: Old way of customizing v. new way..
  • #93: Server provides data over RESTful API – json data Client responsible for rendering and presenting Much more interactive, client can now take immediate action on data it knows about instead of round tripping to server Faster feature velocity, server and client can be developed in parallel Simpler code
  • #94: Instrument each node with livestastd Controllers and Hypervisors Pull information about processes, network, disk, cpu Updates every 5 seconds Using the same client-side rendering pattern as before Aggregating real-time data Greatly increases visibility into platform..
  • #95: Our customers also wanted to see more historical data. We instrumented all of our nodes and push data into Graphite Very high performance and flexiblie time series tool Evolution of RRD Tool Graphite provides data over RESTful API, so we just pull that data and use it to populate these charts.. Easy access for the user (simply click on controller or hypervisor row and chart will drop down) Data from 1 hour range to 1 year range..