LVM support #6

Closed
andrius wants to merge 109 commits from (deleted):lvm-support-rebase into master
3 changed files with 10 additions and 16 deletions
Showing only changes of commit 430f56e416 - Show all commits

View File

@ -60,20 +60,8 @@ void LvmDevice::initPartitions()
pTable->append(p);
}
// Manually insert unallocated space as Partition.
// TODO: PartitionTable's updateUnallocated seem not to works.
if (freePE()) {
qint64 startUnallocated = lastusable - freePE() + 1;
qint64 endUnallocated = lastusable;
pTable->append(new Partition(pTable,
*this,
PartitionRole(PartitionRole::Unallocated),
FileSystemFactory::create(FileSystem::Unknown,startUnallocated, endUnallocated),
startUnallocated,
endUnallocated,
QString())
);
}
pTable->updateUnallocated(*this);
setPartitionTable(pTable);
}

View File

@ -24,6 +24,7 @@
#include "core/partition.h"
#include "core/device.h"
#include "core/diskdevice.h"
#include "core/lvmdevice.h"
#include "core/partitionalignment.h"
#include "fs/filesystem.h"
#include "fs/filesystemfactory.h"
@ -242,7 +243,6 @@ QStringList PartitionTable::flagNames(Flags flags)
bool PartitionTable::getUnallocatedRange(const Device& d, PartitionNode& parent, qint64& start, qint64& end)
{
//TODO: alignment for LVM device
if (d.type() == Device::Disk_Device) {
const DiskDevice& device = dynamic_cast<const DiskDevice&>(d);
if (!parent.isRoot()) {
@ -265,8 +265,13 @@ bool PartitionTable::getUnallocatedRange(const Device& d, PartitionNode& parent,
return end - start + 1 >= PartitionAlignment::sectorAlignment(device);
} else if (d.type() == Device::LVM_Device) {
const LvmDevice& lvm = dynamic_cast<const LvmDevice&>(d);
if (lvm.freePE() && start >= lvm.allocatedPE()) {
start = lvm.allocatedPE();
end = lvm.totalPE() - 1;
return true;
}
return false;
//TODO: return range from last LE to last allocated LE
}
return false;
}

View File

@ -75,6 +75,7 @@ bool CreatePartitionJob::run(Report& parent)
} else
report->line() << xi18nc("@info:progress", "Could not open device <filename>%1</filename> to create new partition <filename>%2</filename>.", device().deviceNode(), partition().deviceNode());
} else if (device().type() == Device::LVM_Device) {
//TODO: take lvname from createDialog
LvmDevice& dev = dynamic_cast<LvmDevice&>(device());
rval = LvmDevice::createLV(*report, dev, partition(), QStringLiteral("randomLV"));
partition().setPartitionPath(dev.deviceNode() + QStringLiteral("/randomLV"));