Filesystem handling¶
Volume¶
-
class
bootstrapvz.base.fs.volume.
Volume
(partition_map)[source]¶ Represents an abstract volume. This class is a finite state machine and represents the state of the real volume.
-
_before_link_dm_node
(e)[source]¶ Links the volume using the device mapper This allows us to create a ‘window’ into the volume that acts like a volume in itself. Mainly it is used to fool grub into thinking that it is working with a real volume, rather than a loopback device or a network block device.
Parameters: e (_e_obj) – Event object containing arguments to create() Keyword arguments to link_dm_node() are:
Parameters: - logical_start_sector (int) – The sector the volume should start at in the new volume
- start_sector (int) – The offset at which the volume should begin to be mapped in the new volume
- sectors (int) – The number of sectors that should be mapped
Read more at: http://manpages.debian.org/cgi-bin/man.cgi?query=dmsetup&apropos=0&sektion=0&manpath=Debian+7.0+wheezy&format=html&locale=en
Raises: VolumeError – When a free block device cannot be found.
-
_check_blocking
(e)[source]¶ Checks whether the volume is blocked
Raises: VolumeError – When the volume is blocked from being detached
-
Partitionmaps¶
Abstract Partitionmap¶
-
class
bootstrapvz.base.fs.partitionmaps.abstract.
AbstractPartitionMap
(bootloader)[source]¶ Abstract representation of a partiton map This class is a finite state machine and represents the state of the real partition map
-
_before_map
(event)[source]¶ Raises: PartitionError – In case a partition could not be mapped.
-
_before_unmap
(event)[source]¶ Raises: PartitionError – If the a partition cannot be unmapped
-
create
(volume)[source]¶ Creates the partition map
Parameters: volume (Volume) – The volume to create the partition map on
-
get_total_size
()[source]¶ Returns the total size the partitions occupy
Returns: The size of all partitions Return type: Sectors
-
is_blocking
()[source]¶ Returns whether the partition map is blocking volume detach operations
Return type: bool
-
GPT Partitionmap¶
MS-DOS Partitionmap¶
No Partitionmap¶
-
class
bootstrapvz.base.fs.partitionmaps.none.
NoPartitions
(data, sector_size, bootloader)[source]¶ Represents a virtual ‘NoPartitions’ partitionmap. This virtual partition map exists because it is easier for tasks to simply always deal with partition maps and then let the base abstract that away.
Partitions¶
Abstract partition¶
-
class
bootstrapvz.base.fs.partitions.abstract.
AbstractPartition
(size, filesystem, format_command, mountopts)[source]¶ Abstract representation of a partiton This class is a finite state machine and represents the state of the real partition
-
add_mount
(source, destination, opts=[])[source]¶ Associate a mount with this partition Automatically mounts it
Parameters: - source (str,AbstractPartition) – The source of the mount
- destination (str) – The path to the mountpoint
- opts (list) – Any options that should be passed to the mount command
-
get_end
()[source]¶ Gets the end of the partition
Returns: The end of the partition Return type: Sectors
-
Base partition¶
-
class
bootstrapvz.base.fs.partitions.base.
BasePartition
(size, filesystem, format_command, mountopts, previous)[source]¶ Represents a partition that is actually a partition (and not a virtual one like ‘Single’)
-
create
(volume)[source]¶ Creates the partition
Parameters: volume (Volume) – The volume to create the partition on
-
get_index
()[source]¶ Gets the index of this partition in the partition map
Returns: The index of the partition in the partition map Return type: int
-