Including LVM VG device scan in scanDevice in SfdiskBackend and LibPartedBackend. It was scanning only for DiskDevices.
This commit is contained in:
parent
7497d509f4
commit
358957641b
|
@ -384,12 +384,28 @@ void LibPartedBackend::scanDevicePartitions(Device& d, PedDisk* pedDisk)
|
|||
@param deviceNode the device node (e.g. "/dev/sda")
|
||||
@return the created Device object. callers need to free this.
|
||||
*/
|
||||
DiskDevice* LibPartedBackend::scanDevice(const QString& deviceNode)
|
||||
Device* LibPartedBackend::scanDevice(const QString& deviceNode)
|
||||
{
|
||||
PedDevice* pedDevice = ped_device_get(deviceNode.toLocal8Bit().constData());
|
||||
|
||||
if (pedDevice == nullptr) {
|
||||
Log(Log::warning) << xi18nc("@info:status", "Could not access device <filename>%1</filename>", deviceNode);
|
||||
Log(Log::warning) << xi18nc("@info:status", "Checking if this device is LVM VG");
|
||||
|
||||
// Look if this device is a LVM VG
|
||||
ExternalCommand checkVG(QStringLiteral("lvm"), { QStringLiteral("vgdisplay"), deviceNode });
|
||||
|
||||
if (checkVG.run(-1) && checkVG.exitCode() == 0)
|
||||
{
|
||||
QList<Device *> availableDevices = scanDevices();
|
||||
|
||||
LvmDevice::scanSystemLVM(availableDevices);
|
||||
|
||||
for (Device *device : qAsConst(availableDevices))
|
||||
if (device->deviceNode() == deviceNode)
|
||||
return device;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ public:
|
|||
CoreBackendDevice* openDevice(const Device& d) override;
|
||||
CoreBackendDevice* openDeviceExclusive(const Device& d) override;
|
||||
bool closeDevice(CoreBackendDevice* core_device) override;
|
||||
DiskDevice* scanDevice(const QString& deviceNode) override;
|
||||
Device* scanDevice(const QString& deviceNode) override;
|
||||
QList<Device*> scanDevices(bool excludeReadOnly = false) override;
|
||||
FileSystem::Type detectFileSystem(const QString& partitionPath) override;
|
||||
QString readLabel(const QString& deviceNode) const override;
|
||||
|
|
|
@ -182,6 +182,23 @@ Device* SfdiskBackend::scanDevice(const QString& deviceNode)
|
|||
scanDevicePartitions(*d, partitionTable[QLatin1String("partitions")].toArray());
|
||||
return d;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Look if this device is a LVM VG
|
||||
ExternalCommand checkVG(QStringLiteral("lvm"), { QStringLiteral("vgdisplay"), deviceNode });
|
||||
|
||||
if (checkVG.run(-1) && checkVG.exitCode() == 0)
|
||||
{
|
||||
qDebug() << "Trying to find LVM VG";
|
||||
QList<Device *> availableDevices = scanDevices();
|
||||
|
||||
LvmDevice::scanSystemLVM(availableDevices);
|
||||
|
||||
for (Device *device : qAsConst(availableDevices))
|
||||
if (device->deviceNode() == deviceNode)
|
||||
return device;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue