LVM support #6
|
@ -60,20 +60,8 @@ void LvmDevice::initPartitions()
|
||||||
pTable->append(p);
|
pTable->append(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Manually insert unallocated space as Partition.
|
pTable->updateUnallocated(*this);
|
||||||
// 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())
|
|
||||||
);
|
|
||||||
}
|
|
||||||
setPartitionTable(pTable);
|
setPartitionTable(pTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "core/partition.h"
|
#include "core/partition.h"
|
||||||
#include "core/device.h"
|
#include "core/device.h"
|
||||||
#include "core/diskdevice.h"
|
#include "core/diskdevice.h"
|
||||||
|
#include "core/lvmdevice.h"
|
||||||
#include "core/partitionalignment.h"
|
#include "core/partitionalignment.h"
|
||||||
#include "fs/filesystem.h"
|
#include "fs/filesystem.h"
|
||||||
#include "fs/filesystemfactory.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)
|
bool PartitionTable::getUnallocatedRange(const Device& d, PartitionNode& parent, qint64& start, qint64& end)
|
||||||
{
|
{
|
||||||
//TODO: alignment for LVM device
|
|
||||||
if (d.type() == Device::Disk_Device) {
|
if (d.type() == Device::Disk_Device) {
|
||||||
const DiskDevice& device = dynamic_cast<const DiskDevice&>(d);
|
const DiskDevice& device = dynamic_cast<const DiskDevice&>(d);
|
||||||
if (!parent.isRoot()) {
|
if (!parent.isRoot()) {
|
||||||
|
@ -265,8 +265,13 @@ bool PartitionTable::getUnallocatedRange(const Device& d, PartitionNode& parent,
|
||||||
|
|
||||||
return end - start + 1 >= PartitionAlignment::sectorAlignment(device);
|
return end - start + 1 >= PartitionAlignment::sectorAlignment(device);
|
||||||
} else if (d.type() == Device::LVM_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;
|
return false;
|
||||||
//TODO: return range from last LE to last allocated LE
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,6 +75,7 @@ bool CreatePartitionJob::run(Report& parent)
|
||||||
} else
|
} else
|
||||||
report->line() << xi18nc("@info:progress", "Could not open device <filename>%1</filename> to create new partition <filename>%2</filename>.", device().deviceNode(), partition().deviceNode());
|
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) {
|
} else if (device().type() == Device::LVM_Device) {
|
||||||
|
//TODO: take lvname from createDialog
|
||||||
LvmDevice& dev = dynamic_cast<LvmDevice&>(device());
|
LvmDevice& dev = dynamic_cast<LvmDevice&>(device());
|
||||||
rval = LvmDevice::createLV(*report, dev, partition(), QStringLiteral("randomLV"));
|
rval = LvmDevice::createLV(*report, dev, partition(), QStringLiteral("randomLV"));
|
||||||
partition().setPartitionPath(dev.deviceNode() + QStringLiteral("/randomLV"));
|
partition().setPartitionPath(dev.deviceNode() + QStringLiteral("/randomLV"));
|
||||||
|
|
Loading…
Reference in New Issue