Class QemuMonitor
java.lang.Object
org.jgrapes.core.internal.ComponentVertex
org.jgrapes.core.Component
org.jdrupes.vmoperator.runner.qemu.QemuMonitor
- All Implemented Interfaces:
Iterable<ComponentType>
,Channel
,ComponentType
,Eligible
,Manager
A component that handles the communication over the Qemu monitor
socket.
If the log level for this class is set to fine, the messages exchanged on the monitor socket are logged.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.jgrapes.core.Channel
Channel.Default
-
Field Summary
-
Constructor Summary
ConstructorDescriptionQemuMonitor
(Channel componentChannel, Path configDir) Instantiates a new qemu monitor. -
Method Summary
Modifier and TypeMethodDescription(package private) void
As the initial configuration of this component depends on the configuration of theRunner
, it doesn’t have a handler for theConfigurationUpdate
event.void
onClientConnected
(ClientConnected event, SocketIOChannel channel) Check if this is from opening the monitor socket and if true, save the socket in the context and associate the channel with the context.void
onClosed
(Closed<?> event, SocketIOChannel channel) On closed.void
onConfigureQemu
(ConfigureQemu event) On configure qemu.void
onConnectError
(ConnectError event, SocketIOChannel channel) Called when a connection attempt fails.void
onExecQmpCommand
(MonitorCommand event) On monitor command.void
onFileChanged
(FileChanged event) Watch for the creation of the swtpm socket and start the qemu process if it has been created.void
onInput
(Input<?> event, SocketIOChannel channel) Handle data from qemu monitor connection.void
onPowerdownEvent
(PowerdownEvent event) On powerdown event.void
Handle the start event.void
Shutdown the VM.Methods inherited from class org.jgrapes.core.Component
channel, component, defaultCriterion, isEligibleFor, setName
Methods inherited from class org.jgrapes.core.internal.ComponentVertex
activeEventPipeline, addHandler, attach, channelReplacements, children, componentPath, componentVertex, detach, fire, initComponentsHandlers, iterator, name, newEventPipeline, newEventPipeline, parent, registerAsGenerator, root, toString, unregisterAsGenerator
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
QemuMonitor
Instantiates a new qemu monitor.- Parameters:
componentChannel
- the component channelconfigDir
- the config dir- Throws:
IOException
- Signals that an I/O exception has occurred.
-
-
Method Details
-
configure
As the initial configuration of this component depends on the configuration of theRunner
, it doesn’t have a handler for theConfigurationUpdate
event.The values are forwarded from the
Runner
instead.- Parameters:
socketPath
- the socket pathpowerdownTimeout
-
-
onStart
Handle the start event.- Parameters:
event
- the event- Throws:
IOException
- Signals that an I/O exception has occurred.
-
onFileChanged
Watch for the creation of the swtpm socket and start the qemu process if it has been created.- Parameters:
event
- the event
-
onClientConnected
Check if this is from opening the monitor socket and if true, save the socket in the context and associate the channel with the context.Then send the initial message to the socket.
- Parameters:
event
- the eventchannel
- the channel
-
onConnectError
Called when a connection attempt fails.- Parameters:
event
- the eventchannel
- the channel
-
onInput
Handle data from qemu monitor connection.- Parameters:
event
- the eventchannel
- the channel
-
onClosed
On closed.- Parameters:
event
- the event
-
onExecQmpCommand
On monitor command.- Parameters:
event
- the event
-
onStop
Shutdown the VM.- Parameters:
event
- the event
-
onPowerdownEvent
On powerdown event.- Parameters:
event
- the event
-
onConfigureQemu
On configure qemu.- Parameters:
event
- the event
-