Package pyanaconda :: Package storage :: Module devices :: Class PartitionDevice
[hide private]
[frames] | no frames]

Class PartitionDevice

source code

object --+        
         |        
    Device --+    
             |    
 StorageDevice --+
                 |
                PartitionDevice

A disk partition.

On types and flags...

We don't need to deal with numerical partition types at all. The only type we are concerned with is primary/logical/extended. Usage specification is accomplished through the use of flags, which we will set according to the partition's format.

Instance Methods [hide private]
 
__init__(self, name, format=None, size=None, grow=False, maxsize=None, major=None, minor=None, bootable=None, sysfsPath='', parents=None, exists=None, partType=None, primary=False, weight=0)
Create a PartitionDevice instance.
source code
 
__repr__(self)
repr(x)
source code
 
dict(self) source code
 
writeKS(self, f, preexisting=False, noformat=False, s=None) source code
 
_setTargetSize(self, newsize) source code
 
path(self)
Device node representing this device.
source code
 
partType(self)
Get the partition's type (as parted constant).
source code
 
isExtended(self) source code
 
isLogical(self) source code
 
isPrimary(self) source code
 
isProtected(self) source code
 
fstabSpec(self) source code
 
_getPartedPartition(self) source code
 
_setPartedPartition(self, partition)
Set this PartitionDevice's parted Partition instance.
source code
 
preCommitFixup(self, *args, **kwargs)
Re-get self.partedPartition from the original disklabel.
source code
 
_getWeight(self) source code
 
_setWeight(self, weight) source code
 
updateSysfsPath(self)
Update this device's sysfs path.
source code
 
updateName(self) source code
 
dependsOn(self, dep)
Return True if this device depends on dep.
source code
 
_setFormat(self, format)
Set the Device's format.
source code
 
_setBootable(self, bootable)
Set the bootable flag for this partition.
source code
 
_getBootable(self) source code
 
flagAvailable(self, flag) source code
 
getFlag(self, flag) source code
 
setFlag(self, flag) source code
 
unsetFlag(self, flag) source code
 
probe(self)
Probe for any missing information about this device.
source code
 
_create(self, w)
Create the device.
source code
 
_postCreate(self)
Perform post-create operations.
source code
 
_computeResize(self, partition) source code
 
resize(self, intf=None)
Resize the device.
source code
 
_preDestroy(self)
Preparation and precondition checking for device destruction.
source code
 
_destroy(self)
Destroy the device.
source code
 
deactivate(self)
This is never called.
source code
 
_getSize(self)
Get the device's size.
source code
 
_setSize(self, newsize)
Set the device's size (for resize, not creation).
source code
 
_getDisk(self)
The disk that contains this partition.
source code
 
_setDisk(self, disk)
Change the parent.
source code
 
maxSize(self)
The maximum size this partition can be.
source code
 
currentSize(self)
The device's actual size.
source code
 
resizable(self)
Can this type of device be resized?
source code
 
checkSize(self)
Check to make sure the size of the device is allowed by the format used.
source code

Inherited from StorageDevice: __str__, create, destroy, disks, encrypted, formatArgs, growable, isDisk, minSize, model, notifyKernel, packages, partedDevice, partitionable, partitioned, removable, serial, services, setup, setupParents, status, teardown, vendor

Inherited from Device: __deepcopy__, addChild, dracutSetupArgs, isleaf, mediaPresent, name, removeChild, teardownParents, type, typeDescription

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __subclasshook__

Class Variables [hide private]
  _type = "partition"
  _resizable = True
  defaultSize = 500
  partedPartition = property(lambda d: d._getPartedPartition(), ...
  weight = property(lambda d: d._getWeight(), lambda d, w: d._se...
  bootable = property(_getBootable, _setBootable)
  disk = property(lambda p: p._getDisk(), lambda p, d: p._setDis...

Inherited from StorageDevice: format, size, sysfsBlockDir, targetSize

Inherited from StorageDevice (private): _devDir, _isDisk, _partitionable

Inherited from Device (private): _id, _packages, _services

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, name, format=None, size=None, grow=False, maxsize=None, major=None, minor=None, bootable=None, sysfsPath='', parents=None, exists=None, partType=None, primary=False, weight=0)
(Constructor)

source code 
Create a PartitionDevice instance.

Arguments:

    name -- the device name (generally a device node's basename)

Keyword Arguments:

    exists -- indicates whether this is an existing device
    format -- the device's format (DeviceFormat instance)

    For existing partitions:

        parents -- the disk that contains this partition
        major -- the device major
        minor -- the device minor
        sysfsPath -- sysfs device path

    For new partitions:

        partType -- primary,extended,&c (as parted constant)
        grow -- whether or not to grow the partition
        maxsize -- max size for growable partitions (in MB)
        size -- the device's size (in MB)
        bootable -- whether the partition is bootable
        parents -- a list of potential containing disks
        weight -- an initial sorting weight to assign

Overrides: object.__init__

__repr__(self)
(Representation operator)

source code 

repr(x)

Overrides: object.__repr__
(inherited documentation)

dict(self)

source code 
Decorators:
  • @property
Overrides: Device.dict

writeKS(self, f, preexisting=False, noformat=False, s=None)

source code 
Overrides: Device.writeKS

_setTargetSize(self, newsize)

source code 
Overrides: StorageDevice._setTargetSize

path(self)

source code 

Device node representing this device.

Decorators:
  • @property
Overrides: StorageDevice.path
(inherited documentation)

partType(self)

source code 

Get the partition's type (as parted constant).

Decorators:
  • @property

isExtended(self)

source code 
Decorators:
  • @property

isLogical(self)

source code 
Decorators:
  • @property

isPrimary(self)

source code 
Decorators:
  • @property

isProtected(self)

source code 
Decorators:
  • @property

fstabSpec(self)

source code 
Decorators:
  • @property
Overrides: StorageDevice.fstabSpec

preCommitFixup(self, *args, **kwargs)

source code 

Re-get self.partedPartition from the original disklabel.

Overrides: StorageDevice.preCommitFixup

updateSysfsPath(self)

source code 

Update this device's sysfs path.

Overrides: StorageDevice.updateSysfsPath

dependsOn(self, dep)

source code 

Return True if this device depends on dep.

Overrides: Device.dependsOn

_setFormat(self, format)

source code 

Set the Device's format.

Overrides: StorageDevice._setFormat

probe(self)

source code 

Probe for any missing information about this device.

size, partition type, flags

_create(self, w)

source code 

Create the device.

Overrides: StorageDevice._create

_postCreate(self)

source code 

Perform post-create operations.

Overrides: StorageDevice._postCreate
(inherited documentation)

resize(self, intf=None)

source code 

Resize the device.

self.targetSize must be set to the new size.

Overrides: StorageDevice.resize

_preDestroy(self)

source code 

Preparation and precondition checking for device destruction.

Overrides: StorageDevice._preDestroy
(inherited documentation)

_destroy(self)

source code 

Destroy the device.

Overrides: StorageDevice._destroy

deactivate(self)

source code 

This is never called. For instructional purposes only.

We do not want multipath partitions disappearing upon their teardown().

_getSize(self)

source code 

Get the device's size.

Overrides: StorageDevice._getSize

_setSize(self, newsize)

source code 
Set the device's size (for resize, not creation).

Arguments:

    newsize -- the new size (in MB)

Overrides: StorageDevice._setSize

_setDisk(self, disk)

source code 

Change the parent.

Setting up a disk is not trivial. It has the potential to change the underlying object. If necessary we must also change this object.

maxSize(self)

source code 

The maximum size this partition can be.

Decorators:
  • @property
Overrides: StorageDevice.maxSize

currentSize(self)

source code 

The device's actual size.

Decorators:
  • @property
Overrides: StorageDevice.currentSize

resizable(self)

source code 

Can this type of device be resized?

Decorators:
  • @property
Overrides: StorageDevice.resizable

checkSize(self)

source code 

Check to make sure the size of the device is allowed by the format used.

Returns: 0 - ok 1 - Too large -1 - Too small

Overrides: StorageDevice.checkSize

Class Variable Details [hide private]

partedPartition

Value:
property(lambda d: d._getPartedPartition(), lambda d, p: d._setPartedP\
artition(p))

weight

Value:
property(lambda d: d._getWeight(), lambda d, w: d._setWeight(w))

disk

Value:
property(lambda p: p._getDisk(), lambda p, d: p._setDisk(d))