Horizon
Horizon is a web based graphical interface for your cloud. Without Horizon your cloud will perform as well and all Horizon do is giving you a Graphical User Interface. Horizon is dependent on Key Stone (authentication) service. It's important to know if Horizon suit your needs or not. Although Horizon is extensible and you can develop it to satisfy your need.
Terminology
Instance: It refer to an configured virtual machine which is ready to perform.
Flavor: Flavor is set of a virtual machine configuration such as it's memory, processor and root disk. When you create a flavor it will be saved and you can make a instance in the future.
Image: Image is a snapshot of an instance. You can have images to backup your instances. You can use images like flavor to keep configured machine. The difference is flavor are about hardware but images are about software.
Project: The main abstract that tenant will interact with is project. A project is set of images, flavors, instances, volumes, floating IPs and subnets.
What tenant can do?
When a tenant register to your private or public cloud it should be permitted to use a project. This is not an automated task and admin should do this in default horizon because the idea of OpenStack is not to giving you a IaaS or DaaS. Only admins can create project, flavors and images. When admin create a project he has to add predefined flavors and image to project. Admin also has to set limitations of project such as maximum number of instances, virtual CPUs, volumes, subnets and routers, and maximum total usage of memory and disk. Now tenants can make instances using provided images and flavors. And can setup their own private subnet with given routers and floating IPs.
Develop Horizon
Horizon is written in python just like other OpenStack projects. It is powered by Django web framework. Horizon let you add you features by adding new dashboards. Dashboards are web pages in Horizon with an access level. Horizon also give you set of APIs to call other services. Just for an example this code will return list of all instances.
def get_instances_data(self):
try:
marker = self.request.GET.get(
tables.InstancesTable._meta.pagination_param, None)
instances, self._has_more = api.nova.server_list(
self.request,
search_opts={'marker': marker, 'paginate': True})
return instances
except Exception:
self._has_more = False
error_message = _('Unable to get instances')
exceptions.handle(self.request, error_message)
return []