* howto control VM from outside (shutdown...) @ 2009-01-19 20:23 Paolo Pedaletti 2009-01-19 21:40 ` David Mair 0 siblings, 1 reply; 5+ messages in thread From: Paolo Pedaletti @ 2009-01-19 20:23 UTC (permalink / raw) To: KVM List Ciao, the question was posted here: http://www.linux-kvm.com/content/daemonize-vs-monitor-commands "The original post asked about gracefully shutting down KVM guest using scripts" When I shutdown the host machine, I want to hibernate/shutdown/screendump/savevm/senkeys/system_powerdown(/migrate?) also all the VM running (without using libvirt) I could ssh to each VM and halt it, but does exist a better/cleaner solution? How can I communicate to kvm console? thank you -- /* Paolo Pedaletti, * paolo@pedaletti.it www.pedaletti.it */ ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: howto control VM from outside (shutdown...) 2009-01-19 20:23 howto control VM from outside (shutdown...) Paolo Pedaletti @ 2009-01-19 21:40 ` David Mair 2009-01-20 13:10 ` paolo pedaletti 2009-01-20 15:55 ` Alberto Treviño 0 siblings, 2 replies; 5+ messages in thread From: David Mair @ 2009-01-19 21:40 UTC (permalink / raw) To: Paolo Pedaletti; +Cc: KVM List Paolo Pedaletti wrote: > Ciao, > > the question was posted here: > http://www.linux-kvm.com/content/daemonize-vs-monitor-commands > > "The original post asked about gracefully shutting down KVM guest using > scripts" > > When I shutdown the host machine, I want to > hibernate/shutdown/screendump/savevm/senkeys/system_powerdown(/migrate?) > also all the VM running (without using libvirt) > > I could ssh to each VM and halt it, but does exist a better/cleaner > solution? > > How can I communicate to kvm console? Take a look at the qemu -monitor option. You can use it to re-direct the monitor console to a large number of character devices, including sockets. The settings are the same as for the -serial option. I've used it to access the monitor console from a telnet client. -- David. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: howto control VM from outside (shutdown...) 2009-01-19 21:40 ` David Mair @ 2009-01-20 13:10 ` paolo pedaletti 2009-01-20 15:55 ` Alberto Treviño 1 sibling, 0 replies; 5+ messages in thread From: paolo pedaletti @ 2009-01-20 13:10 UTC (permalink / raw) To: David Mair; +Cc: KVM List Ciao David, thank you for the answer > Take a look at the qemu -monitor option. You can use it to re-direct the > monitor console to a large number of character devices, including > sockets. The settings are the same as for the -serial option. I've used > it to access the monitor console from a telnet client. ok, I have found this: http://www.linux-kvm.com/content/multiplexing-your-monitor-and-serial-port http://www.linux-kvm.com/content/two-ways-access-your-virtual-machine-monitor-across-network and it works, BUT ... why this command doesn't works: echo -e "info name \n" | nc 127.0.0.1 4444 echo -e "info name \n" | nc 127.0.0.1 4445 neither: echo "info name" | nc 127.0.0.1 4444 echo "info name" | nc 127.0.0.1 4445 (output: ��\x01��\x03����QEMU 0.9.1 monitor - type 'help' for more information ) with this command line option: -monitor telnet:127.0.0.1:4444,server,nowait \ -serial mon:telnet:127.0.0.1:4445,server,nowait ? -- Paolo Pedaletti ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: howto control VM from outside (shutdown...) 2009-01-19 21:40 ` David Mair 2009-01-20 13:10 ` paolo pedaletti @ 2009-01-20 15:55 ` Alberto Treviño 2009-01-20 22:16 ` Paolo Pedaletti 1 sibling, 1 reply; 5+ messages in thread From: Alberto Treviño @ 2009-01-20 15:55 UTC (permalink / raw) To: KVM List On Monday 19 January 2009 02:40:04 pm David Mair wrote: > Take a look at the qemu -monitor option. You can use it to re-direct the > monitor console to a large number of character devices, including > sockets. The settings are the same as for the -serial option. I've used > it to access the monitor console from a telnet client. I use the the telnet option: -monitor telnet::[port],server,nowait For interactive control I use telnet: $ telnet localhost [port] and I can connect to it to run any commands I want. Just be aware that you should exit with Ctrl-C or by making sure you are at the telnet prompt when you issue quit. If you issue quit to the VM, the entire VM will shutdown very, very quickly and ungracefully. To send commands through a script, I use netcat: echo "system_powerdown" | netcat -T -c localhost [port] I also have a PHP script that opens a socket connection to the telnet port, sends the command, and parses the output for errors. I'll be happy to share it. Let me know if you want it. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: howto control VM from outside (shutdown...) 2009-01-20 15:55 ` Alberto Treviño @ 2009-01-20 22:16 ` Paolo Pedaletti 0 siblings, 0 replies; 5+ messages in thread From: Paolo Pedaletti @ 2009-01-20 22:16 UTC (permalink / raw) To: Alberto Treviño; +Cc: KVM List ciao Alberto, > -monitor telnet::[port],server,nowait ok > For interactive control I use telnet: > $ telnet localhost [port] ok, it works, thank you > To send commands through a script, I use netcat: > echo "system_powerdown" | netcat -T -c localhost [port] no, it doesn't work :-( $ while : ; do echo "info name" | netcat -T lowdelay -C \ 127.0.0.1 10101 ; sleep 1 ; done ��\x01��\x03����QEMU 0.9.1 monitor - type 'help' for more information (qemu) info name��\x01��\x03����QEMU 0.9.1 monitor - type 'help' for more information (qemu) info name��\x01��\x03����QEMU 0.9.1 monitor - type 'help' for more information (qemu) info name��\x01��\x03����QEMU 0.9.1 monitor - type 'help' for more information (qemu) info name��\x01��\x03����QEMU 0.9.1 monitor - type 'help' for more information (qemu) info name��\x01��\x03����QEMU 0.9.1 monitor - type 'help' for more information (qemu) info name��\x01��\x03����QEMU 0.9.1 monitor - type 'help' for more information (qemu) info name��\x01��\x03����QEMU 0.9.1 monitor - type 'help' for more information command line: (kvm-82, ubuntu 8.10 2.6.27-9-server x86_64) /usr/local/bin/qemu-system-x86_64 -name marco \ -vnc :10 -monitor telnet:127.0.0.1:10101,server,nowait \ -cpu qemu64 -m 512 -smp 1 -vga std \ -drive file=/dev/mapper/vm-vm_marco,if=virtio,cache=off,boot=on\ -k it -usb -usbdevice tablet -localtime -daemonize \ -net nic,vlan=1,model=e1000,macaddr=52:10:11:01:01:01 \ -net vde,vlan=1,sock=/var/run/vde2/kvm1_vde.ctl \ -net nic,vlan=2,model=virtio,macaddr=52:10:11:02:01:01 \ -net vde,vlan=2,sock=/var/run/vde2/kvm2_vde.ctl \ -pidfile /home/vm/marco/marco.pid do you know/understand why it doesn't works for me? > I also have a PHP script that opens a socket connection to the telnet port, > sends the command, and parses the output for errors. I'll be happy to share > it. Let me know if you want it. yes, thank you. -- /* Paolo Pedaletti, * paolo@pedaletti.it www.pedaletti.it */ ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-01-20 22:16 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2009-01-19 20:23 howto control VM from outside (shutdown...) Paolo Pedaletti 2009-01-19 21:40 ` David Mair 2009-01-20 13:10 ` paolo pedaletti 2009-01-20 15:55 ` Alberto Treviño 2009-01-20 22:16 ` Paolo Pedaletti
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox