2013-09-15 13:19:45 +02:00
|
|
|
from base import Task
|
|
|
|
from common import phases
|
|
|
|
import filesystem
|
|
|
|
import volume
|
|
|
|
|
|
|
|
|
|
|
|
class PartitionVolume(Task):
|
|
|
|
description = 'Partitioning the volume'
|
|
|
|
phase = phases.volume_preparation
|
|
|
|
|
2014-01-05 15:57:11 +01:00
|
|
|
@classmethod
|
|
|
|
def run(cls, info):
|
2013-10-05 20:41:05 +02:00
|
|
|
info.volume.partition_map.create(info.volume)
|
2013-09-15 13:19:45 +02:00
|
|
|
|
|
|
|
|
|
|
|
class MapPartitions(Task):
|
|
|
|
description = 'Mapping volume partitions'
|
|
|
|
phase = phases.volume_preparation
|
2013-11-21 15:54:42 +01:00
|
|
|
predecessors = [PartitionVolume]
|
|
|
|
successors = [filesystem.Format]
|
2013-09-15 13:19:45 +02:00
|
|
|
|
2014-01-05 15:57:11 +01:00
|
|
|
@classmethod
|
|
|
|
def run(cls, info):
|
2013-10-05 20:41:05 +02:00
|
|
|
info.volume.partition_map.map(info.volume)
|
2013-09-15 13:19:45 +02:00
|
|
|
|
|
|
|
|
|
|
|
class UnmapPartitions(Task):
|
|
|
|
description = 'Removing volume partitions mapping'
|
|
|
|
phase = phases.volume_unmounting
|
2013-11-21 15:54:42 +01:00
|
|
|
predecessors = [filesystem.UnmountRoot]
|
|
|
|
successors = [volume.Detach]
|
2013-09-15 13:19:45 +02:00
|
|
|
|
2014-01-05 15:57:11 +01:00
|
|
|
@classmethod
|
|
|
|
def run(cls, info):
|
2013-10-05 20:41:05 +02:00
|
|
|
info.volume.partition_map.unmap(info.volume)
|