[PATCH] Fix issues with QEMU monitor interface.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxx>
---
 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

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]