[problem help] 登录老是提示虚拟机影响性能
Tofloor
poster avatar
打击越
deepin
2023-10-21 17:19
Author

可是我系统是在实体机上的,不知道怎么去掉这个提示

截图_20231021091627.png

Reply Favorite View the author
All Replies
👀偷偷观察
deepin
2023-10-21 18:01
#1

把壁纸留下 你可以走了。

https://github.com/linuxdeepin/dde-session/blob/8afee6b899db229f45c77571831046aa96ce3779/src/dde-session/othersmanager.cpp#L83

bool OthersManager::inVM()
{
QProcess p;
p.start("systemd-detect-virt", QStringList() << "-v" << "-q");
p.waitForFinished();
return p.exitCode() != 0;
}

搜到了这段代码,不知道把这个脚本输出改一下,可能就可以。

如果你解决了,希望你反馈一下解决方法

Reply View the author
打击越
deepin
2023-10-21 18:05
#2
👀偷偷观察

把壁纸留下 你可以走了。

https://github.com/linuxdeepin/dde-session/blob/8afee6b899db229f45c77571831046aa96ce3779/src/dde-session/othersmanager.cpp#L83

bool OthersManager::inVM()
{
QProcess p;
p.start("systemd-detect-virt", QStringList() << "-v" << "-q");
p.waitForFinished();
return p.exitCode() != 0;
}

搜到了这段代码,不知道把这个脚本输出改一下,可能就可以。

如果你解决了,希望你反馈一下解决方法

没有找到高清的

055133ckczlitg7oy7rllg.jpg

Reply View the author
Eutopia
deepin
2023-10-21 18:06
#3
打击越

没有找到高清的

055133ckczlitg7oy7rllg.jpg

可以,这个劲大

Reply View the author
打击越
deepin
2023-10-21 18:50
#4
👀偷偷观察

把壁纸留下 你可以走了。

https://github.com/linuxdeepin/dde-session/blob/8afee6b899db229f45c77571831046aa96ce3779/src/dde-session/othersmanager.cpp#L83

bool OthersManager::inVM()
{
QProcess p;
p.start("systemd-detect-virt", QStringList() << "-v" << "-q");
p.waitForFinished();
return p.exitCode() != 0;
}

搜到了这段代码,不知道把这个脚本输出改一下,可能就可以。

如果你解决了,希望你反馈一下解决方法

rhett@rhett-PC:~/Desktop$ systemd-detect-virt -v -q
rhett@rhett-PC:~/Desktop$ echo $?
0
rhett@rhett-PC:~/Desktop$ systemd-detect-virt -v
kvm

上面是虚拟机里面运行的结果

下面是实体机运行的结果

rhett@rhett-PC:~$ systemd-detect-virt -v -q
rhett@rhett-PC:~$ echo $?
1
rhett@rhett-PC:~$ systemd-detect-virt -v
none
systemd-detect-virt 说明:
​
If a virtualization technology is detected, 0 is returned, a non-zero code otherwise.
bool OthersManager::inVM()
{
    QProcess p;
    p.start("systemd-detect-virt", QStringList() << "-v" << "-q");
    p.waitForFinished();

    return  p.exitCode() != 0;
}

里面的判断可能应该用 =

Reply View the author
👀偷偷观察
deepin
2023-10-21 19:20
#5
打击越
rhett@rhett-PC:~/Desktop$ systemd-detect-virt -v -q
rhett@rhett-PC:~/Desktop$ echo $?
0
rhett@rhett-PC:~/Desktop$ systemd-detect-virt -v
kvm

上面是虚拟机里面运行的结果

下面是实体机运行的结果

rhett@rhett-PC:~$ systemd-detect-virt -v -q
rhett@rhett-PC:~$ echo $?
1
rhett@rhett-PC:~$ systemd-detect-virt -v
none
systemd-detect-virt 说明:
​
If a virtualization technology is detected, 0 is returned, a non-zero code otherwise.
bool OthersManager::inVM()
{
    QProcess p;
    p.start("systemd-detect-virt", QStringList() << "-v" << "-q");
    p.waitForFinished();

    return  p.exitCode() != 0;
}

里面的判断可能应该用 =

调用的时候取非了。

Reply View the author