Connect to running qemu instance with qemu monitor
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I'm having an instance of qemu
running on Windows 7, running without an open terminal. Now I want to shutdown the machine with the name MyMachineName or add an USB-Device to it.
I need a scriptable solution. Libvirt is not a solution, because it has other disadvantages for my system.
Im looking for a magic line like:
qemu-monitor -connect=MyMachineName command="shutdown"
How can I do it?
qemu
add a comment |Â
up vote
0
down vote
favorite
I'm having an instance of qemu
running on Windows 7, running without an open terminal. Now I want to shutdown the machine with the name MyMachineName or add an USB-Device to it.
I need a scriptable solution. Libvirt is not a solution, because it has other disadvantages for my system.
Im looking for a magic line like:
qemu-monitor -connect=MyMachineName command="shutdown"
How can I do it?
qemu
Unless you've redirected the QEMU monitor to a device you can access via the command line (e.g., via-monitor <dev>
), you can't connect to it via a script.
â dsstorefile1
Feb 26 at 19:59
So, you saying, that I can do the following:qemu-system-... -monitor "/dev/ttyMyConsol"
and thanecho "My QemuMonitorCommand" > /dev/ttyMyConsol
and it will make qemu execute the command on that machine? but the only way to control the machine is the qemu-monitor?
â Cutton Eye
Feb 27 at 13:01
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I'm having an instance of qemu
running on Windows 7, running without an open terminal. Now I want to shutdown the machine with the name MyMachineName or add an USB-Device to it.
I need a scriptable solution. Libvirt is not a solution, because it has other disadvantages for my system.
Im looking for a magic line like:
qemu-monitor -connect=MyMachineName command="shutdown"
How can I do it?
qemu
I'm having an instance of qemu
running on Windows 7, running without an open terminal. Now I want to shutdown the machine with the name MyMachineName or add an USB-Device to it.
I need a scriptable solution. Libvirt is not a solution, because it has other disadvantages for my system.
Im looking for a magic line like:
qemu-monitor -connect=MyMachineName command="shutdown"
How can I do it?
qemu
edited Feb 26 at 11:11
Stefan M
8101617
8101617
asked Feb 26 at 11:07
Cutton Eye
1106
1106
Unless you've redirected the QEMU monitor to a device you can access via the command line (e.g., via-monitor <dev>
), you can't connect to it via a script.
â dsstorefile1
Feb 26 at 19:59
So, you saying, that I can do the following:qemu-system-... -monitor "/dev/ttyMyConsol"
and thanecho "My QemuMonitorCommand" > /dev/ttyMyConsol
and it will make qemu execute the command on that machine? but the only way to control the machine is the qemu-monitor?
â Cutton Eye
Feb 27 at 13:01
add a comment |Â
Unless you've redirected the QEMU monitor to a device you can access via the command line (e.g., via-monitor <dev>
), you can't connect to it via a script.
â dsstorefile1
Feb 26 at 19:59
So, you saying, that I can do the following:qemu-system-... -monitor "/dev/ttyMyConsol"
and thanecho "My QemuMonitorCommand" > /dev/ttyMyConsol
and it will make qemu execute the command on that machine? but the only way to control the machine is the qemu-monitor?
â Cutton Eye
Feb 27 at 13:01
Unless you've redirected the QEMU monitor to a device you can access via the command line (e.g., via
-monitor <dev>
), you can't connect to it via a script.â dsstorefile1
Feb 26 at 19:59
Unless you've redirected the QEMU monitor to a device you can access via the command line (e.g., via
-monitor <dev>
), you can't connect to it via a script.â dsstorefile1
Feb 26 at 19:59
So, you saying, that I can do the following:
qemu-system-... -monitor "/dev/ttyMyConsol"
and than echo "My QemuMonitorCommand" > /dev/ttyMyConsol
and it will make qemu execute the command on that machine? but the only way to control the machine is the qemu-monitor?â Cutton Eye
Feb 27 at 13:01
So, you saying, that I can do the following:
qemu-system-... -monitor "/dev/ttyMyConsol"
and than echo "My QemuMonitorCommand" > /dev/ttyMyConsol
and it will make qemu execute the command on that machine? but the only way to control the machine is the qemu-monitor?â Cutton Eye
Feb 27 at 13:01
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
2
down vote
accepted
Someone might be able to chime in with a proper command for operating on TTYs, but I'll post a solution in the meantime involving the network.
There are a couple options for redirecting the QEMU monitor. One way is to have QEMU offer access to its monitor via telnet:
$ qemu-system-i386 -monitor telnet:127.0.0.1:55555,server,nowait;
Then, QEMU can be scripted by piping commands to telnet
. This is fine as long as the output of commands can be discarded since the telnet session will probably close too quickly for visual feedback:
$ echo system_powerdown |telnet 127.0.0.1 55555
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
Connection closed by foreign host.
$ _ # qemu sends the guest an ACPI shutdown signal
If the output of the commands executed on the monitor need to be collected, a TCP session can be used instead:
$ qemu-system-i386 -monitor tcp:127.0.0.1:55555,server,nowait;
Then, commands can be sent to the listening monitor via netcat
or a similar utility:
$ echo info kvm |nc -N 127.0.0.1 55555
QEMU 2.11.0 monitor - type 'help' for more information
(qemu) info kvm
kvm support: enabled
(qemu) $ echo system_powerdown |nc -N 127.0.0.1 55555
QEMU 2.11.0 monitor - type 'help' for more information
(qemu) system_powerdown
(qemu) $ # hit return
$ _ # qemu sends the guest an ACPI shutdown signal
Here is a link to partial documentation of QEMU monitor commands: https://en.wikibooks.org/wiki/QEMU/Monitor
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
Someone might be able to chime in with a proper command for operating on TTYs, but I'll post a solution in the meantime involving the network.
There are a couple options for redirecting the QEMU monitor. One way is to have QEMU offer access to its monitor via telnet:
$ qemu-system-i386 -monitor telnet:127.0.0.1:55555,server,nowait;
Then, QEMU can be scripted by piping commands to telnet
. This is fine as long as the output of commands can be discarded since the telnet session will probably close too quickly for visual feedback:
$ echo system_powerdown |telnet 127.0.0.1 55555
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
Connection closed by foreign host.
$ _ # qemu sends the guest an ACPI shutdown signal
If the output of the commands executed on the monitor need to be collected, a TCP session can be used instead:
$ qemu-system-i386 -monitor tcp:127.0.0.1:55555,server,nowait;
Then, commands can be sent to the listening monitor via netcat
or a similar utility:
$ echo info kvm |nc -N 127.0.0.1 55555
QEMU 2.11.0 monitor - type 'help' for more information
(qemu) info kvm
kvm support: enabled
(qemu) $ echo system_powerdown |nc -N 127.0.0.1 55555
QEMU 2.11.0 monitor - type 'help' for more information
(qemu) system_powerdown
(qemu) $ # hit return
$ _ # qemu sends the guest an ACPI shutdown signal
Here is a link to partial documentation of QEMU monitor commands: https://en.wikibooks.org/wiki/QEMU/Monitor
add a comment |Â
up vote
2
down vote
accepted
Someone might be able to chime in with a proper command for operating on TTYs, but I'll post a solution in the meantime involving the network.
There are a couple options for redirecting the QEMU monitor. One way is to have QEMU offer access to its monitor via telnet:
$ qemu-system-i386 -monitor telnet:127.0.0.1:55555,server,nowait;
Then, QEMU can be scripted by piping commands to telnet
. This is fine as long as the output of commands can be discarded since the telnet session will probably close too quickly for visual feedback:
$ echo system_powerdown |telnet 127.0.0.1 55555
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
Connection closed by foreign host.
$ _ # qemu sends the guest an ACPI shutdown signal
If the output of the commands executed on the monitor need to be collected, a TCP session can be used instead:
$ qemu-system-i386 -monitor tcp:127.0.0.1:55555,server,nowait;
Then, commands can be sent to the listening monitor via netcat
or a similar utility:
$ echo info kvm |nc -N 127.0.0.1 55555
QEMU 2.11.0 monitor - type 'help' for more information
(qemu) info kvm
kvm support: enabled
(qemu) $ echo system_powerdown |nc -N 127.0.0.1 55555
QEMU 2.11.0 monitor - type 'help' for more information
(qemu) system_powerdown
(qemu) $ # hit return
$ _ # qemu sends the guest an ACPI shutdown signal
Here is a link to partial documentation of QEMU monitor commands: https://en.wikibooks.org/wiki/QEMU/Monitor
add a comment |Â
up vote
2
down vote
accepted
up vote
2
down vote
accepted
Someone might be able to chime in with a proper command for operating on TTYs, but I'll post a solution in the meantime involving the network.
There are a couple options for redirecting the QEMU monitor. One way is to have QEMU offer access to its monitor via telnet:
$ qemu-system-i386 -monitor telnet:127.0.0.1:55555,server,nowait;
Then, QEMU can be scripted by piping commands to telnet
. This is fine as long as the output of commands can be discarded since the telnet session will probably close too quickly for visual feedback:
$ echo system_powerdown |telnet 127.0.0.1 55555
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
Connection closed by foreign host.
$ _ # qemu sends the guest an ACPI shutdown signal
If the output of the commands executed on the monitor need to be collected, a TCP session can be used instead:
$ qemu-system-i386 -monitor tcp:127.0.0.1:55555,server,nowait;
Then, commands can be sent to the listening monitor via netcat
or a similar utility:
$ echo info kvm |nc -N 127.0.0.1 55555
QEMU 2.11.0 monitor - type 'help' for more information
(qemu) info kvm
kvm support: enabled
(qemu) $ echo system_powerdown |nc -N 127.0.0.1 55555
QEMU 2.11.0 monitor - type 'help' for more information
(qemu) system_powerdown
(qemu) $ # hit return
$ _ # qemu sends the guest an ACPI shutdown signal
Here is a link to partial documentation of QEMU monitor commands: https://en.wikibooks.org/wiki/QEMU/Monitor
Someone might be able to chime in with a proper command for operating on TTYs, but I'll post a solution in the meantime involving the network.
There are a couple options for redirecting the QEMU monitor. One way is to have QEMU offer access to its monitor via telnet:
$ qemu-system-i386 -monitor telnet:127.0.0.1:55555,server,nowait;
Then, QEMU can be scripted by piping commands to telnet
. This is fine as long as the output of commands can be discarded since the telnet session will probably close too quickly for visual feedback:
$ echo system_powerdown |telnet 127.0.0.1 55555
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
Connection closed by foreign host.
$ _ # qemu sends the guest an ACPI shutdown signal
If the output of the commands executed on the monitor need to be collected, a TCP session can be used instead:
$ qemu-system-i386 -monitor tcp:127.0.0.1:55555,server,nowait;
Then, commands can be sent to the listening monitor via netcat
or a similar utility:
$ echo info kvm |nc -N 127.0.0.1 55555
QEMU 2.11.0 monitor - type 'help' for more information
(qemu) info kvm
kvm support: enabled
(qemu) $ echo system_powerdown |nc -N 127.0.0.1 55555
QEMU 2.11.0 monitor - type 'help' for more information
(qemu) system_powerdown
(qemu) $ # hit return
$ _ # qemu sends the guest an ACPI shutdown signal
Here is a link to partial documentation of QEMU monitor commands: https://en.wikibooks.org/wiki/QEMU/Monitor
edited Feb 27 at 14:39
answered Feb 27 at 14:30
dsstorefile1
1,576212
1,576212
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f426652%2fconnect-to-running-qemu-instance-with-qemu-monitor%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Unless you've redirected the QEMU monitor to a device you can access via the command line (e.g., via
-monitor <dev>
), you can't connect to it via a script.â dsstorefile1
Feb 26 at 19:59
So, you saying, that I can do the following:
qemu-system-... -monitor "/dev/ttyMyConsol"
and thanecho "My QemuMonitorCommand" > /dev/ttyMyConsol
and it will make qemu execute the command on that machine? but the only way to control the machine is the qemu-monitor?â Cutton Eye
Feb 27 at 13:01