Skip to content

How to source control xCAT Cluster configuration with "xcat inventory"?

yangsbj edited this page Dec 28, 2018 · 1 revision

How to source control xCAT Cluster configuration with "xcat-inventory"?

Overview

For a xCAT cluster, xCAT manage the cluster through the manipulation of cluster inventory(consisting of objects and cluster configuration) in xCAT DB. xcat-inventory provides the native capability to manage the xCAT cluster inventory under source control, thus Admins can persistent, rollback and versioning the cluster inventory, and collaborate across the team.

The source control feature requires a source control system, like "Git", installed as the Backend. Like the typical source control workflow, xcat-inventory provides the interfaces to manage the inventory in xCAT DB directly, while the backend source control system and repository are transparent to the Admin. Unlike the typical source control system, xcat-inventory simplifies the source control operations based on the understanding of configuragtion source control practices. For the experienced Admins with expertise on "Git", they can directly perform source control on the Local Repo with "Git" and interact with xCAT DB with import and export.

Concepts

Backend: the source control system, currently only "Git" is supported

Local Repo: the local Git repo

Remote Repo: the remote Git repo on Github or other central Git repository. This is optional unless Admins need to collaborate on the inventory in a central repository

Workspace: Like "branch" in Git, an independent line to trace the evolution of cluster inventory. When you need to share the same cluster with others for different purpose, or you need to collaboration with you team members in 1 cluster, "workspace" is for you.

Revision: the identity of a inventory version in the workspace, i.e, the state of cluster inventory, like "tag" or "commit" in Git except that Revision is bound to the workspace

Configuration

There are 2 kinds of configuration files, global configuration file(/etc/xcat/inventory.cfg) and local configuration file(~/.xcatinv/inventory.cfg, for each user). If local configuration file does not exist, the global configuration file will be used.

The configuration file is to specify the backend options, it is a self-explanation file, please refer to the description(or comments) to specify the options.

Workflow

  1. initialize backend with xcat-inventory init if the backend is not initialized or the configuration file /etc/xcat/inventory.cfg is modified. The Local Repo will be configured with the options in configuration file, the remote repository will be cloned if not cloned before, the initial workspace in the configuration file will be checkout(not imported to xCAT DB by default, run xcat-inventory checkout to checkout the current workspace to xCAT DB). Nothing will be done if configuration file has been already applied.

  2. switch to the workspace you want to work on with xcat-inventory workspace-checkout <workspace>. To list all the existing workspaces, run xcat-inventory workspace-list. If "" has not been created, create it with xcat-inventory workspace-new <workspace> based on the current workspace you are on. To find out which workspace you are currently on, run xcat-inventory whereami. To drop a workspace "", run xcat-inventory workspace-delete

  3. if you want to check the difference between current inventory in xCAT DB and the current Revision in current workspace, run xcat-inventory diff to get an object based view

  4. if you want to create a new revision "" to save the current cluster inventory, run xcat-inventory commit <Rev1> -m <comment>. To list all the Revisions in current workspace, run xcat-inventory revlist. To display the detail of specific Revision "", run xcat-inventory revlist <Rev1>. If you want to rollback the a revision "", run xcat-inventory checkout <Rev1>.

  5. if you have configured the "[remote_repo]" in configuration file and want to manage the cluster inventory in a central repolistory, you can run xcat-inventory push to push all the local Revisions in current workspace to remote repositry. You can also run xcat-inventory pull to pull all the remote revisions on current workspace down to local repository. If you want to scan the remote repository and detect all the available workspaces and Revisions on the remote repository, run xcat-inventory radar