« Previous - Version 3/4 (diff) - Next » - Current version
Anil Gulecha, 01/04/2011 02:46 am


Plugin File Structure

We will take a look at how a plugin is organized, and what files consist a plugin.

NexentaStor plugins are a collection of debian packages. Typically, a plugin can consist of any plugin that extends the three components of the Nexenta Appliance, namely: nms (Nexenta Management Service), nmc (Nexenta Management Console), nmv (Nexenta Management View).

The best way to write a plugin is to simply use one of the multiple open plugins as reference to write up an empty plugin with all the initial bits in place. Let's the the following two example plugins and discuss their structure to help understand the purpose of various files : ddclient and simple-encryption.

Package Example: ddclient

ddclient

This image shows the file structure of the ddclient package. You can download this package offline via the commands listed on the repository page.

Files

The main package directory nmc-ddcleint forms all of plugin, i.e, the plugin only has the nmc component. This folder has another directory (debian) and 2 perl modules (Ddclient.pm, metafile.pm)

  • Ddclient.pm - This is the main plugin module, that provides the functionality required. In this particular case, the plugin is basically a wrapper over underlying ddclient facilities. We will go into a line by line explanation later on.

  • metafile.pm - This module is included in all plugin packages. This includes basic plugin information like name, description, plugin group, etc. We will go into a line by line explanation later on.

  • debian/ - This directory is present in any debian package, and contains package meta-information (name, dependencies), and build rules (like a Makefile) that builds the packages. This folder can also optionally contain post/pre install/removal scripts if required by your plugin package.

  • debian/control - This file lays out the information official package name, version, dependencies.

  • debian/changelog - This is a plain text changelog that maintains a log of what changes were made subsequent versions. An entry is to be added manually for every version of the package released. The 'dch' command makes it easy to edit this file, and maintain the syntax required.

  • debian/rules - This is the main build file. It is a Makefile that lays out the targets clean, deploy-dirs, binary-arch and binary. These respectively clean the workspace, install files in temporary directory structure, builds the binary debian package respectively.

  • debian/copyright - This file includes the licensing information about the package.

Also available in: HTML TXT