Remove device's partitionTable when deactivated.
This commit is contained in:
parent
8a3c11774c
commit
fabde86139
|
@ -32,7 +32,8 @@ DeactivateVolumeGroupOperation::DeactivateVolumeGroupOperation(VolumeManagerDevi
|
|||
Operation(),
|
||||
m_DeactivateVolumeGroupJob(new DeactivateVolumeGroupJob(d)),
|
||||
m_DeactivateLogicalVolumeJob(new DeactivateLogicalVolumeJob(d)),
|
||||
m_Device(d)
|
||||
m_Device(d),
|
||||
m_PartitionTable(d.partitionTable())
|
||||
{
|
||||
addJob(deactivateLogicalVolumeJob());
|
||||
addJob(deactivateVolumeGroupJob());
|
||||
|
@ -45,8 +46,14 @@ QString DeactivateVolumeGroupOperation::description() const
|
|||
|
||||
void DeactivateVolumeGroupOperation::preview()
|
||||
{
|
||||
device().setPartitionTable(new PartitionTable(PartitionTable::vmd, 0, device().totalLogical() - 1));
|
||||
}
|
||||
|
||||
void DeactivateVolumeGroupOperation::undo()
|
||||
{
|
||||
PartitionTable* tmp = device().partitionTable();
|
||||
if (tmp != partitionTable()) {
|
||||
device().setPartitionTable(partitionTable());
|
||||
delete tmp;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ class DeactivateLogicalVolumeJob;
|
|||
class DeactivateVolumeGroupJob;
|
||||
class VolumeManagerDevice;
|
||||
class OperationStack;
|
||||
class PartitionTable;
|
||||
|
||||
class LIBKPMCORE_EXPORT DeactivateVolumeGroupOperation : public Operation
|
||||
{
|
||||
|
@ -70,10 +71,15 @@ protected:
|
|||
return m_Device;
|
||||
}
|
||||
|
||||
PartitionTable* partitionTable() {
|
||||
return m_PartitionTable;
|
||||
}
|
||||
|
||||
private:
|
||||
DeactivateVolumeGroupJob* m_DeactivateVolumeGroupJob;
|
||||
DeactivateLogicalVolumeJob* m_DeactivateLogicalVolumeJob;
|
||||
VolumeManagerDevice& m_Device;
|
||||
PartitionTable* m_PartitionTable;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue