]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu_monitor: Fix tray-open attribute in query-block
authorMichal Privoznik <mprivozn@redhat.com>
Fri, 25 Jan 2013 11:56:48 +0000 (12:56 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 25 Jan 2013 13:39:48 +0000 (14:39 +0100)
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
src/qemu/qemu_monitor_text.c

index de5f1155e8743b51e05a0715532f88fc937f33a8..2d2a5d045054debe4ddf854f443498862476e5a2 100644 (file)
@@ -1585,10 +1585,10 @@ int qemuMonitorJSONGetBlockInfo(qemuMonitorPtr mon,
             goto cleanup;
         }
 
-        /* Don't check for success here, because 'tray-open' is presented iff
+        /* 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 */
index 6506f9da1b437128659222ce1955d7da06d45388..bc0a11dc4d7961b88c3883620073681c6dc2577f 100644 (file)
@@ -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=")) {