Re: [PATCH 1/2] qemu: Get the media status of removable block device

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

 



于 2011年08月12日 21:11, Daniel P. Berrange 写道:
On Fri, Aug 12, 2011 at 09:34:41PM +0800, Osier Yang wrote:
Intorduce new monitor functions to get the media status (ejected
or inserted) of removable block device via qemu monitor command
"info block".

QEMU upstream will expose the the media status like:
  cd: type=cdrom removable=1 locked=0 ejected=0

The related patch:
http://lists.gnu.org/archive/html/qemu-devel/2011-08/msg00408.html
Hmm, that patch isn't merged upstream yet. We ought to wait for
it to be merged, since historically discussions about this kind
of thing on QEMU-devel have been quiet unpredictable.

Yes, this is just for early reviewing, we need to wait qemu patch is pushed
even these patches are ok. I don't known it's quite unpredictable yet. :)

Although it's unlikely to expose other information of removable
block device in future via the new function, returned the info
in argument "*ejected" just in case of there is new requirement
to expose other info.
---
  src/qemu/qemu_monitor.c      |   20 ++++++++
  src/qemu/qemu_monitor.h      |    3 +
  src/qemu/qemu_monitor_json.c |   14 ++++++
  src/qemu/qemu_monitor_json.h |    4 +-
  src/qemu/qemu_monitor_text.c |  105 ++++++++++++++++++++++++++++++++++++++++++
  src/qemu/qemu_monitor_text.h |    3 +
  6 files changed, 148 insertions(+), 1 deletions(-)

diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index db6107c..7a41e8f 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -1227,6 +1227,26 @@ int qemuMonitorGetBlockStatsInfo(qemuMonitorPtr mon,
      return ret;
  }

+int qemuMonitorGetRemovableBlockMediaStatus(qemuMonitorPtr mon,
+                                            const char *devname,
+                                            unsigned int *ejected)
The last arg should really be 'bool *ejected'


diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 2a9a078..f59489d 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -1519,6 +1519,20 @@ cleanup:
      return ret;
  }

+int qemuMonitorJSONGetRemovableBlockMediaStatus(qemuMonitorPtr mon,
+                                                const char *devname,
+                                                unsigned int *ejected)
+{
+    /* XXX: No QMP command like "info block" which can get the
+     * block device information yet.
+     */
This is not correct, it is simply called 'query-block'

Ah, yes, will update.
Regards,
Daniel

--
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]