[Libvir] [PATCH] Fix issues with QEMU monitor interface.

Jim Paris jim at jtan.com
Mon Aug 13 18:17:04 UTC 2007


Due to the TTY layer, sending "\n" to the qemu monitor translates
into "\r\n" when received.  This triggers a bug in older versions of
QEMU (KVM <= 33) because the same command is executed twice, and
still has problems with fixed QEMU because the "(qemu)" prompt is
printed twice.  Switch all monitor commands to end with "\r" which
avoids both issues.

Signed-off-by: Jim Paris <jim at jtan.com>
---
 src/qemu_driver.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/qemu_driver.c b/src/qemu_driver.c
index b05c3f6..e13e6a3 100644
--- a/src/qemu_driver.c
+++ b/src/qemu_driver.c
@@ -1755,7 +1755,7 @@ static int qemudDomainSuspend(virDomainPtr dom) {
     if (vm->state == VIR_DOMAIN_PAUSED)
         return 0;
 
-    if (qemudMonitorCommand(driver, vm, "stop\n", &info) < 0) {
+    if (qemudMonitorCommand(driver, vm, "stop\r", &info) < 0) {
         qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED, "suspend operation failed");
         return -1;
     }
@@ -1780,7 +1780,7 @@ static int qemudDomainResume(virDomainPtr dom) {
     }
     if (vm->state == VIR_DOMAIN_RUNNING)
         return 0;
-    if (qemudMonitorCommand(driver, vm, "cont\n", &info) < 0) {
+    if (qemudMonitorCommand(driver, vm, "cont\r", &info) < 0) {
         qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED, "resume operation failed");
         return -1;
     }
-- 
1.5.3.rc4




More information about the libvir-list mailing list