Bases: diskimage_builder.block_device.plugin.NodeBase
Cleanup actions
Actions to taken when dib-block-device cleanup
is called.
This is the cleanup path in the success case. The nodes are
called in the reverse order to create()
None
Main creation driver
This is the main driver function. After the graph is
linearised, each node has it’s create()
function called.
Exception – A failure should raise an exception. This
will initiate a rollback. See Nodebase.add_rollback()
.
None
Return the dependencies/edges for this node
This function will be called after all nodes are created (this is because some plugins need to know the global state of all nodes to decide their dependencies).
This function returns a tuple with two lists
edges_from
: a list of node names that point to us
edges_to
: a list of node names we point to
In most cases, node creation will have saved a single parent
that was given in the base
parameter of the configuration.
A usual return might look like:
def get_edges(self):
return ( [self.base], [] )
Some nodes (level0
) don’t have a base, however
Bases: diskimage_builder.block_device.plugin.NodeBase
Main creation driver
This is the main driver function. After the graph is
linearised, each node has it’s create()
function called.
Exception – A failure should raise an exception. This
will initiate a rollback. See Nodebase.add_rollback()
.
None
Return the dependencies/edges for this node
This function will be called after all nodes are created (this is because some plugins need to know the global state of all nodes to decide their dependencies).
This function returns a tuple with two lists
edges_from
: a list of node names that point to us
edges_to
: a list of node names we point to
In most cases, node creation will have saved a single parent
that was given in the base
parameter of the configuration.
A usual return might look like:
def get_edges(self):
return ( [self.base], [] )
Some nodes (level0
) don’t have a base, however
Bases: diskimage_builder.block_device.plugin.NodeBase
Main creation driver
This is the main driver function. After the graph is
linearised, each node has it’s create()
function called.
Exception – A failure should raise an exception. This
will initiate a rollback. See Nodebase.add_rollback()
.
None
Return the dependencies/edges for this node
This function will be called after all nodes are created (this is because some plugins need to know the global state of all nodes to decide their dependencies).
This function returns a tuple with two lists
edges_from
: a list of node names that point to us
edges_to
: a list of node names we point to
In most cases, node creation will have saved a single parent
that was given in the base
parameter of the configuration.
A usual return might look like:
def get_edges(self):
return ( [self.base], [] )
Some nodes (level0
) don’t have a base, however
Bases: diskimage_builder.block_device.plugin.NodeBase
Main creation driver
This is the main driver function. After the graph is
linearised, each node has it’s create()
function called.
Exception – A failure should raise an exception. This
will initiate a rollback. See Nodebase.add_rollback()
.
None
Return the dependencies/edges for this node
This function will be called after all nodes are created (this is because some plugins need to know the global state of all nodes to decide their dependencies).
This function returns a tuple with two lists
edges_from
: a list of node names that point to us
edges_to
: a list of node names we point to
In most cases, node creation will have saved a single parent
that was given in the base
parameter of the configuration.
A usual return might look like:
def get_edges(self):
return ( [self.base], [] )
Some nodes (level0
) don’t have a base, however
Bases: object
MBR Disk / Partition Table Layout
Primary partitions are created first - and must also be passed in first.
The extended partition layout is done in the way, that there is one entry in the MBR (the last) that uses the whole disk. EBR (extended boot records) are used to describe the partitions themselves. This has the advantage, that the same procedure can be used for all partitions and arbitrarily many partitions can be created in the same way (the EBR is placed as block 0 in each partition itself).
In conjunction with a fixed and ‘fits all’ partition alignment the major design focus is maximum performance for the installed image (vs. minimal size).
Because of the chosen default alignment of 1MiB there will be (1MiB - 512B) unused disk space for the MBR and also the same size unused in every partition.
Assuming that 512 byte blocks are used, the resulting layout for extended partitions looks like (blocks offset in extended partition given):
Offset |
Description |
---|---|
0 |
MBR - 2047 blocks unused |
2048 |
EBR for partition 1 - 2047 blocks unused |
4096 |
Start of data for partition 1 |
… |
… |
X |
EBR for partition N - 2047 blocks unused |
X+2048 |
Start of data for partition N |
Direct (native) writing of MBR, EBR (partition table) is implemented - no other partitioning library or tools is used - to be sure to get the correct CHS and alignment for a wide range of host systems.
Adds a partition with the given type and size
Align the blockno to next alignment count
Encodes a CHS triple into disk format
Returns the free (not yet partitioned) size
Converts a LBA block number to CHS
If the LBA block number is bigger than the max (1023, 63, 254) the maximum is returned.
Write MBR
This method writes the MBR to disk. It creates a random disk id as well that it creates the extended partition (as first partition) which uses the whole disk.
Writes the MBR/EBR signature to a block
The signature consists of a 0xAA55 in the last two bytes of the block.
Writes a partition entry
The entries are always the same and contain 16 bytes. The MBR and also the EBR use the same format.
Bases: diskimage_builder.block_device.plugin.NodeBase
Cleanup actions
Actions to taken when dib-block-device cleanup
is called.
This is the cleanup path in the success case. The nodes are
called in the reverse order to create()
None
Main creation driver
This is the main driver function. After the graph is
linearised, each node has it’s create()
function called.
Exception – A failure should raise an exception. This
will initiate a rollback. See Nodebase.add_rollback()
.
None
Return the dependencies/edges for this node
This function will be called after all nodes are created (this is because some plugins need to know the global state of all nodes to decide their dependencies).
This function returns a tuple with two lists
edges_from
: a list of node names that point to us
edges_to
: a list of node names we point to
In most cases, node creation will have saved a single parent
that was given in the base
parameter of the configuration.
A usual return might look like:
def get_edges(self):
return ( [self.base], [] )
Some nodes (level0
) don’t have a base, however
Bases: diskimage_builder.block_device.plugin.PluginBase
Return nodes created by the plugin
a list of NodeBase
objects for insertion
into the graph
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.