Delay QEMU configuration until QMP is configured. (#6)
Some checks failed
Java CI with Gradle / build (push) Has been cancelled
Some checks failed
Java CI with Gradle / build (push) Has been cancelled
Fixes #4.
This commit is contained in:
commit
666c8a34cc
3 changed files with 48 additions and 4 deletions
|
|
@ -52,7 +52,7 @@ import org.apache.commons.cli.Option;
|
||||||
import org.apache.commons.cli.Options;
|
import org.apache.commons.cli.Options;
|
||||||
import org.jdrupes.vmoperator.runner.qemu.commands.QmpCont;
|
import org.jdrupes.vmoperator.runner.qemu.commands.QmpCont;
|
||||||
import org.jdrupes.vmoperator.runner.qemu.events.MonitorCommand;
|
import org.jdrupes.vmoperator.runner.qemu.events.MonitorCommand;
|
||||||
import org.jdrupes.vmoperator.runner.qemu.events.MonitorReady;
|
import org.jdrupes.vmoperator.runner.qemu.events.QmpConfigured;
|
||||||
import org.jdrupes.vmoperator.runner.qemu.events.RunnerConfigurationUpdate;
|
import org.jdrupes.vmoperator.runner.qemu.events.RunnerConfigurationUpdate;
|
||||||
import org.jdrupes.vmoperator.runner.qemu.events.RunnerStateChange;
|
import org.jdrupes.vmoperator.runner.qemu.events.RunnerStateChange;
|
||||||
import org.jdrupes.vmoperator.runner.qemu.events.RunnerStateChange.State;
|
import org.jdrupes.vmoperator.runner.qemu.events.RunnerStateChange.State;
|
||||||
|
|
@ -111,7 +111,8 @@ import org.jgrapes.util.events.WatchFile;
|
||||||
* state "Start swtpm" as swtpm
|
* state "Start swtpm" as swtpm
|
||||||
* state "Start qemu" as qemu
|
* state "Start qemu" as qemu
|
||||||
* state "Open monitor" as monitor
|
* state "Open monitor" as monitor
|
||||||
* state "Configure" as configure
|
* state "Configure QMP" as waitForConfigured
|
||||||
|
* state "Configure QEMU" as configure
|
||||||
* state success <<exitPoint>>
|
* state success <<exitPoint>>
|
||||||
* state error <<exitPoint>>
|
* state error <<exitPoint>>
|
||||||
*
|
*
|
||||||
|
|
@ -125,9 +126,12 @@ import org.jgrapes.util.events.WatchFile;
|
||||||
* qemu --> monitor : FileChanged[monitor socket created]
|
* qemu --> monitor : FileChanged[monitor socket created]
|
||||||
*
|
*
|
||||||
* monitor: entry/fire OpenSocketConnection
|
* monitor: entry/fire OpenSocketConnection
|
||||||
* monitor --> configure: ClientConnected[for monitor]
|
* monitor --> waitForConfigured: ClientConnected[for monitor]
|
||||||
* monitor -> error: ConnectError[for monitor]
|
* monitor -> error: ConnectError[for monitor]
|
||||||
*
|
*
|
||||||
|
* waitForConfigured: entry/fire QmpCapabilities
|
||||||
|
* waitForConfigured --> configure: QmpConfigured
|
||||||
|
*
|
||||||
* configure: entry/fire RunnerConfigurationUpdate
|
* configure: entry/fire RunnerConfigurationUpdate
|
||||||
* configure --> success: RunnerConfigurationUpdate (last handler)/fire cont command
|
* configure --> success: RunnerConfigurationUpdate (last handler)/fire cont command
|
||||||
* }
|
* }
|
||||||
|
|
@ -511,7 +515,7 @@ public class Runner extends Component {
|
||||||
* @param event the event
|
* @param event the event
|
||||||
*/
|
*/
|
||||||
@Handler
|
@Handler
|
||||||
public void onMonitorReady(MonitorReady event) {
|
public void onQmpConfigured(QmpConfigured event) {
|
||||||
rep.fire(new RunnerConfigurationUpdate(config, state));
|
rep.fire(new RunnerConfigurationUpdate(config, state));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ package org.jdrupes.vmoperator.runner.qemu.events;
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import org.jdrupes.vmoperator.runner.qemu.commands.QmpAddCpu;
|
import org.jdrupes.vmoperator.runner.qemu.commands.QmpAddCpu;
|
||||||
|
import org.jdrupes.vmoperator.runner.qemu.commands.QmpCapabilities;
|
||||||
import org.jdrupes.vmoperator.runner.qemu.commands.QmpCommand;
|
import org.jdrupes.vmoperator.runner.qemu.commands.QmpCommand;
|
||||||
import org.jdrupes.vmoperator.runner.qemu.commands.QmpDelCpu;
|
import org.jdrupes.vmoperator.runner.qemu.commands.QmpDelCpu;
|
||||||
import org.jdrupes.vmoperator.runner.qemu.commands.QmpQueryHotpluggableCpus;
|
import org.jdrupes.vmoperator.runner.qemu.commands.QmpQueryHotpluggableCpus;
|
||||||
|
|
@ -44,6 +45,9 @@ public class MonitorResult extends Event<Void> {
|
||||||
* @return the monitor result
|
* @return the monitor result
|
||||||
*/
|
*/
|
||||||
public static MonitorResult from(QmpCommand command, JsonNode response) {
|
public static MonitorResult from(QmpCommand command, JsonNode response) {
|
||||||
|
if (command instanceof QmpCapabilities) {
|
||||||
|
return new QmpConfigured(command, response);
|
||||||
|
}
|
||||||
if (command instanceof QmpQueryHotpluggableCpus) {
|
if (command instanceof QmpQueryHotpluggableCpus) {
|
||||||
return new HotpluggableCpuStatus(command, response);
|
return new HotpluggableCpuStatus(command, response);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
/*
|
||||||
|
* VM-Operator
|
||||||
|
* Copyright (C) 2023 Michael N. Lipp
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jdrupes.vmoperator.runner.qemu.events;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
|
import org.jdrupes.vmoperator.runner.qemu.commands.QmpCommand;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Signals that the QMP capabilities have been enabled.
|
||||||
|
*/
|
||||||
|
public class QmpConfigured extends MonitorResult {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new monitor ready.
|
||||||
|
*/
|
||||||
|
public QmpConfigured(QmpCommand command, JsonNode response) {
|
||||||
|
super(command, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue