Manager: Fix machine status showing as "Running"...
instead of "Paused/Waiting" when opening settings for a stopped machine by establishing a minimal manager socket connection
This commit is contained in:
@@ -676,6 +676,11 @@ main(int argc, char *argv[])
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (settings_only) {
|
if (settings_only) {
|
||||||
|
VMManagerClientSocket manager_socket;
|
||||||
|
if (qgetenv("VMM_86BOX_SOCKET").size()) {
|
||||||
|
manager_socket.IPCConnect(qgetenv("VMM_86BOX_SOCKET"));
|
||||||
|
manager_socket.clientRunningStateChanged(VMManagerProtocol::RunningState::PausedWaiting);
|
||||||
|
}
|
||||||
Settings settings;
|
Settings settings;
|
||||||
if (settings.exec() == QDialog::Accepted) {
|
if (settings.exec() == QDialog::Accepted) {
|
||||||
settings.save();
|
settings.save();
|
||||||
|
|||||||
@@ -182,19 +182,6 @@ VMManagerMain::settingsButtonPressed() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
selected_sysconfig->launchSettings();
|
selected_sysconfig->launchSettings();
|
||||||
// If the process is already running, the system will be instructed to open its settings window.
|
|
||||||
// Otherwise the process will be launched and will need to be tracked here.
|
|
||||||
if (!selected_sysconfig->isProcessRunning()) {
|
|
||||||
connect(selected_sysconfig->process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished),
|
|
||||||
[=](const int exitCode, const QProcess::ExitStatus exitStatus){
|
|
||||||
if (exitCode != 0 || exitStatus != QProcess::NormalExit) {
|
|
||||||
qInfo().nospace().noquote() << "Abnormal program termination while launching settings: exit code " << exitCode << ", exit status " << exitStatus;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
selected_sysconfig->reloadConfig();
|
|
||||||
vm_details->updateData(selected_sysconfig);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -418,6 +418,14 @@ VMManagerSystem::launchMainProcess() {
|
|||||||
qDebug() << Q_FUNC_INFO << " Full Command:" << process->program() << " " << process->arguments();
|
qDebug() << Q_FUNC_INFO << " Full Command:" << process->program() << " " << process->arguments();
|
||||||
process->start();
|
process->start();
|
||||||
updateTimestamp();
|
updateTimestamp();
|
||||||
|
|
||||||
|
connect(process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished),
|
||||||
|
[=](const int exitCode, const QProcess::ExitStatus exitStatus){
|
||||||
|
if (exitCode != 0 || exitStatus != QProcess::NormalExit) {
|
||||||
|
qInfo().nospace().noquote() << "Abnormal program termination while launching main process: exit code " << exitCode << ", exit status " << exitStatus;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -432,6 +440,15 @@ VMManagerSystem::launchSettings() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// start the server first to get the socket name
|
||||||
|
if (!serverIsRunning) {
|
||||||
|
if(!startServer()) {
|
||||||
|
// FIXME: Better error handling
|
||||||
|
qInfo("Failed to start VM Manager server");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If the system is already running, instruct it to show settings
|
// If the system is already running, instruct it to show settings
|
||||||
if (process->processId() != 0) {
|
if (process->processId() != 0) {
|
||||||
#ifdef Q_OS_WINDOWS
|
#ifdef Q_OS_WINDOWS
|
||||||
@@ -454,6 +471,14 @@ VMManagerSystem::launchSettings() {
|
|||||||
process->setArguments(args);
|
process->setArguments(args);
|
||||||
qDebug() << Q_FUNC_INFO << " Full Command:" << process->program() << " " << process->arguments();
|
qDebug() << Q_FUNC_INFO << " Full Command:" << process->program() << " " << process->arguments();
|
||||||
process->start();
|
process->start();
|
||||||
|
|
||||||
|
connect(process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished),
|
||||||
|
[=](const int exitCode, const QProcess::ExitStatus exitStatus){
|
||||||
|
if (exitCode != 0 || exitStatus != QProcess::NormalExit) {
|
||||||
|
qInfo().nospace().noquote() << "Abnormal program termination while launching settings: exit code " << exitCode << ", exit status " << exitStatus;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
Reference in New Issue
Block a user