bootstrap-vz/common/tasks/partitioning.py
Anders Ingemann 0092e1c2c2 Don't instantiate tasks
In practice they are just typed functions with attributes, having a reference to an object is just confusing.
So: Task.run() is now a classmethod
2014-01-06 22:58:21 +01:00

35 lines
798 B
Python

from base import Task
from common import phases
import filesystem
import volume
class PartitionVolume(Task):
description = 'Partitioning the volume'
phase = phases.volume_preparation
@classmethod
def run(cls, info):
info.volume.partition_map.create(info.volume)
class MapPartitions(Task):
description = 'Mapping volume partitions'
phase = phases.volume_preparation
predecessors = [PartitionVolume]
successors = [filesystem.Format]
@classmethod
def run(cls, info):
info.volume.partition_map.map(info.volume)
class UnmapPartitions(Task):
description = 'Removing volume partitions mapping'
phase = phases.volume_unmounting
predecessors = [filesystem.UnmountRoot]
successors = [volume.Detach]
@classmethod
def run(cls, info):
info.volume.partition_map.unmap(info.volume)