sbc-mgr library and command line utility
Data model
In memory
The Node class holds the current state of all Nodes the system is managing. The goal is to efficiently be able to manipulate them. Parents hold dict MAC:Node of children as a child has no meaninful name. If image=True its an image, else its a child.
Sanity checks:
- If not an image, must exist in someones children list. If not, is an orphan which requires cleaning up
- If an image it must not be in someones children's dict. If it is, then it requires fixing
On disk
In the system each Node is a folder in a single directory. Each folder contains:
config.json
- A json dump of the Node in this directoryroot.img
- A sparse file to be mounted as rootboot/
- A boot directory containing the boot.scr and assoc files to boot the system
Commands
- root create: Create an root
- No MAC assigned yet, so no DHCP or NBD link yet
- allocate a disk image file of size X
- create a boot folder
- root allocate: Allocate a MAC to an image
- Assign an IP from the name
- Assign MAC
- Setup DHCP / TFTP
- Setup NBD
- root deallocate: Remove a MAC from an image
- Remove IP
- Remove MAC
- Remove DHCP /TFTP
- Remove NBD
- Send reboot to node (if there even is one)
- root clone: Copy an image (live or not) to create an unallocated root
- root delete: Delete an image if its not allocated and has no children
- root export/import: Create a tar of node content/import a tar of root content to a new name
- Update config.json on input to new paths and name, create one if it does not exist or is broken
- leaf create: Given an existing, deallocated root create leaf nodes for each MAC supplied
- leaf delete: Given an existing root with children delete all leaf nodes