Skip to content

Commit

Permalink
chore: [disk] support multis lvm /dev/mapper
Browse files Browse the repository at this point in the history
support multis lvm /dev/mapper

Log:  support multis lvm /dev/mapper

Bug: https://pms.uniontech.com/bug-view-289313.html
  • Loading branch information
shuaijie authored and deepin-bot[bot] committed Dec 6, 2024
1 parent a1e82b7 commit 97219de
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
14 changes: 12 additions & 2 deletions deepin-devicemanager/src/DeviceManager/DeviceManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
#include "DeviceInput.h"
#include "MacroDefinition.h"

#include <algorithm> // for std::sort

using namespace DDLog;

DeviceManager *DeviceManager::sInstance = nullptr;
Expand Down Expand Up @@ -735,6 +737,7 @@ void DeviceManager::setStorageInfoFromSmartctl(const QString &name, const QMap<Q

void DeviceManager::mergeDisk()
{
QList<int> m_ListStorageIndex;
QMap<QString, QList<int> > allSerialIDs;
for (int i = 0; i < m_ListDeviceStorage.size(); ++i) {
DeviceStorage *device = dynamic_cast<DeviceStorage *>(m_ListDeviceStorage[i]);
Expand All @@ -749,10 +752,17 @@ void DeviceManager::mergeDisk()
for (int i = serialIDs.size() - 1; i > 0; --i) {
DeviceStorage *curDevice = dynamic_cast<DeviceStorage *>(m_ListDeviceStorage[serialIDs[i] ]);
fDevice->appendDisk(curDevice);
m_ListDeviceStorage.removeAt(serialIDs[i]);
delete curDevice;
m_ListStorageIndex.append(serialIDs[i]);
}
}

std::sort(m_ListStorageIndex.begin(), m_ListStorageIndex.end(), std::greater<int>());
for(auto index : m_ListStorageIndex) {
DeviceStorage *curDevice = dynamic_cast<DeviceStorage *>(m_ListDeviceStorage[index]);
m_ListDeviceStorage.removeAt(index);
delete curDevice;
}

for (int i = 0; i < m_ListDeviceStorage.size(); ++i) {
DeviceStorage *device = dynamic_cast<DeviceStorage *>(m_ListDeviceStorage[i]);
device->unitConvertByDecimal();
Expand Down
10 changes: 9 additions & 1 deletion deepin-devicemanager/src/GenerateDevice/DBusInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <QDBusInterface>
#include <QDBusReply>
#include <QLoggingCategory>
#include <QProcess>

using namespace DDLog;

Expand All @@ -36,7 +37,14 @@ bool DBusInterface::getInfo(const QString &key, QString &info)
info = reply.value();
return true;
} else {
qCInfo(appLog) << "Error in getting info from getInfo .......................................";
qCInfo(appLog) << "unsucess in getting info from getInfo :" << key;
QProcess process;
QString command = "gdbus call --system --dest org.deepin.DeviceInfo --object-path /org/deepin/DeviceInfo --method org.deepin.DeviceInfo.getInfo hwinfo";
process.start(command);
process.waitForFinished();
QByteArray output = process.readAllStandardOutput();
QString outputStr = QString::fromLocal8Bit(output);
qCInfo(appLog) << "getInfo gdbus out:" << outputStr.left(10); //debug detect service work is really unstable
return false;
}
}
Expand Down

0 comments on commit 97219de

Please sign in to comment.