Resource handler model
A resource handler holds the connection to a cloud or hypervisor and pairs it with the Python class that makes the API calls
2 minute read
CMP is a Django application, and its data is stored in a PostgreSQL database via Django’s object-relational mapper. Change objects through the ORM rather than in SQL: CMP’s business logic runs on create and change, and a direct UPDATE skips it.
CMP ships with the graph_models management command, which renders an entity-relationship diagram for one or more Django apps. The CMP schema is too large to fit in a single image; generate one app at a time.
Rendering to an image needs Graphviz and PyDotPlus. Install them as the root user on the CMP appliance.
sudo su -
yum install -y graphviz
pip install pydotplus
Start by determining which app owns your target model. An app label is the name of the model’s package: Server lives in infrastructure, ResourceHandler in resourcehandlers, OSBuild in externalcontent. In Shell Plus, Server._meta.app_label returns the label for any model.
Then generate the file. The output format follows the file extension you give --output. This example writes the infrastructure app’s schema to infrastructure.pdf in the current directory. Copy the file from the appliance with scp or a similar tool to view it.
/opt/cloudbolt/manage.py graph_models -t original --output infrastructure.pdf infrastructure
Pass several app labels to draw them on one diagram.
A resource handler holds the connection to a cloud or hypervisor and pairs it with the Python class that makes the API calls
An environment is the target into which a server or resource is provisioned, and the model that ties a resource handler to the groups, images, and parameters associated with it
An OS build names an operating system once, then maps that name to the image or template each resource handler needs
An order is what a user submits; a job is what the job engine runs to fulfill one item of it