diff --git a/blivet/deviceaction.py b/blivet/deviceaction.py index 7f9c082..9976f40 100644 --- a/blivet/deviceaction.py +++ b/blivet/deviceaction.py @@ -628,3 +628,56 @@ class ActionResizeFormat(DeviceAction): retval = True return retval + +class ActionAddMember(DeviceAction): + type = ACTION_TYPE_ADD_MEMBER + obj = ACTION_OBJECT_DEVICE + typeDescStr = N_("add container member") + + def __init__(self, device): + DeviceAction.__init__(self, device) + + def execute(self): + self.device.container.removeMember(self.device) # TODO: pick a name + + def requires(self, action): + """ Return True if self requires action. + + container device add actions requires another action if: + + - the other action is a create or resize of this actions' device + + TODO: update other classes' requires and obsoletes + """ + rc = False + return rc + + def obsoletes(self, action): + """ Return True if self obsoletes action. + + container device add actions obsolete the following actions: + + - member remove actions with lower id w/ same member + + TODO: update other classes' requires and obsoletes + """ + rc = False + return rc + + +class ActionRemoveMember(DeviceAction): + type = ACTION_TYPE_REMOVE_MEMBER + obj = ACTION_OBJECT_DEVICE + typeDescStr = N_("remove container member") + + def obsoletes(self, action): + """ Return True if self obsoletes action. + + container member add actions obsolete the following actions: + + - member add actions with a lower id w/ same member + + TODO: update other classes' requires and obsoletes + """ + rc = False + return rc