Package pyanaconda :: Package storage :: Module deviceaction :: Class DeviceAction
[hide private]
[frames] | no frames]

Class DeviceAction

source code

object --+
         |
        DeviceAction

An action that will be carried out in the future on a Device.

These classes represent actions to be performed on devices or
filesystems.

The operand Device instance will be modified according to the
action, but no changes will be made to the underlying device or
filesystem until the DeviceAction instance's execute method is
called. The DeviceAction instance's cancel method should reverse
any modifications made to the Device instance's attributes.

If the Device instance represents a pre-existing device, the
constructor should call any methods or set any attributes that the
action will eventually change. Device/DeviceFormat classes should verify
that the requested modifications are reasonable and raise an
exception if not.

Only one action of any given type/object pair can exist for any
given device at any given time. This is enforced by the
DeviceTree.

Basic usage:

    a = DeviceAction(dev)
    a.execute()

    OR

    a = DeviceAction(dev)
    a.cancel()


XXX should we back up the device with a deep copy for forcibly
    cancelling actions?

    The downside is that we lose any checking or verification that
    would get done when resetting the Device instance's attributes to
    their original values.

    The upside is that we would be guaranteed to achieve a total
    reversal. No chance of, eg: resizes ending up altering Device
    size due to rounding or other miscalculation.

Instance Methods [hide private]
 
__init__(self, device)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
execute(self, intf=None)
perform the action
source code
 
cancel(self)
cancel the action
source code
 
isDestroy(self) source code
 
isCreate(self) source code
 
isMigrate(self) source code
 
isResize(self) source code
 
isShrink(self) source code
 
isGrow(self) source code
 
isDevice(self) source code
 
isFormat(self) source code
 
format(self) source code
 
__str__(self)
str(x)
source code
 
requires(self, action)
Return True if self requires action.
source code
 
obsoletes(self, action)
Return True is self obsoletes action.
source code

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

Class Variables [hide private]
  type = 0
  obj = 0
  _id = 0
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, device)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

isDestroy(self)

source code 
Decorators:
  • @property

isCreate(self)

source code 
Decorators:
  • @property

isMigrate(self)

source code 
Decorators:
  • @property

isResize(self)

source code 
Decorators:
  • @property

isShrink(self)

source code 
Decorators:
  • @property

isGrow(self)

source code 
Decorators:
  • @property

isDevice(self)

source code 
Decorators:
  • @property

isFormat(self)

source code 
Decorators:
  • @property

format(self)

source code 
Decorators:
  • @property

__str__(self)
(Informal representation operator)

source code 

str(x)

Overrides: object.__str__
(inherited documentation)

obsoletes(self, action)

source code 

Return True is self obsoletes action.

DeviceAction instances obsolete other DeviceAction instances with lower id and same device.