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

[libvirt] [PATCH 1/2] qemu_monitor: Fix tray-open attribute in query-block



With our code, we fail to query for tray-open attribute currently.
That's because in HMP it is 'tray-open' and in QMP it's 'tray_open'.
It always has been. However, we got it exactly the opposite.
---
 src/qemu/qemu_monitor_json.c | 2 +-
 src/qemu/qemu_monitor_text.c | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index de5f115..0aa3bcb 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -1588,7 +1588,7 @@ int qemuMonitorJSONGetBlockInfo(qemuMonitorPtr mon,
         /* Don't check for success here, because 'tray-open' is presented iff
          * medium is ejected.
          */
-        ignore_value(virJSONValueObjectGetBoolean(dev, "tray-open",
+        ignore_value(virJSONValueObjectGetBoolean(dev, "tray_open",
                                                   &info->tray_open));
 
         /* Missing io-status indicates no error */
diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c
index 6506f9d..bc0a11d 100644
--- a/src/qemu/qemu_monitor_text.c
+++ b/src/qemu/qemu_monitor_text.c
@@ -809,10 +809,10 @@ int qemuMonitorTextGetBlockInfo(qemuMonitorPtr mon,
                         VIR_DEBUG("error reading locked: %s", p);
                     else
                         info->locked = (tmp != 0);
-                } else if (STRPREFIX(p, "tray_open=")) {
-                    p += strlen("tray_open=");
+                } else if (STRPREFIX(p, "tray-open=")) {
+                    p += strlen("tray-open=");
                     if (virStrToLong_i(p, &dummy, 10, &tmp) == -1)
-                        VIR_DEBUG("error reading tray_open: %s", p);
+                        VIR_DEBUG("error reading tray-open: %s", p);
                     else
                         info->tray_open = (tmp != 0);
                 } else if (STRPREFIX(p, "io-status=")) {
-- 
1.8.0.2


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