diskimage_builder.block_device.blockdevice Module¶diskimage_builder.block_device.blockdevice.BlockDevice(params)¶Bases: object
Handles block devices.
This class handles the complete setup and deletion of all aspects of the block device level.
A typical call sequence:
cmd_writefstab: creates the (complete) fstab for the system.
In a script this should be called in the following way:
dib-block-device init … # From that point the database can be queried, like ROOT_LABEL=$(dib-block-device getval root-label)
Please note that currently the dib-block-device executable can only be used outside the chroot.
dib-block-device create … trap “dib-block-device delete …” EXIT # copy / install files dib-block-device umount … # convert image(s) dib-block-device cleanup … trap - EXIT
cmd_cleanup()¶Cleanup all remaining relicts - in good case
cmd_create()¶Creates the block device
cmd_delete()¶Cleanup all remaining relicts - in case of an error
cmd_getval(symbol)¶Retrieve value from block device level
The value of SYMBOL is printed to stdout. This is intended to be captured into bash-variables for backward compatibility (non python) access to internal configuration.
Arguments: :param symbol: the symbol to get
cmd_init()¶Initialize block device setup
This initializes the block device setup layer. One major task is to parse and check the configuration, write it down for later examiniation and execution.
cmd_umount()¶Unmounts the blockdevice and cleanup resources
cmd_writefstab()¶Creates the fstab
diskimage_builder.block_device.blockdevice.BlockDeviceState(filename=None)¶Bases: _abcoll.MutableMapping
The global state singleton
An reference to an instance of this object is saved into nodes as a global repository. It wraps a single dictionary “state” and provides a few helper functions.
The state ends up used in two contexts:
- The node list (including this state) is pickled and dumped between cmd_create() and later cmd_* calls that need to call the nodes.
- Some other cmd_* calls, such as cmd_writefstab, only need access to values inside the state and not the whole node list, and load it from the json dump created after cmd_create()
debug_dump()¶Log state to debug
save_state(filename)¶Persist the state to disk
| Parameters: | filename – The file to persist state to |
|---|
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.