[libvirt] [RFC PATCHv2 5/8] threshold: add qemu capability bit

Eric Blake eblake at redhat.com
Fri Jun 12 19:29:29 UTC 2015


Track whether qemu is new enough to do block thresholds on the
active layer.  The plan is that even if qemu is too old, the
event handler can still be registered, but will never fire (since
it is useful to bulk-install handlers); while the request to set
a threshold will honor the capability bit and fail up front if it
is not possible.

FIXME:
Note that qemu requires that libvirt use a node name and not a
device name to actually use the feature.  What's more, a single
qcow2 host resource results in two separate qemu nodes (one node
for the guest view served by qcow2 protocol, the other node
for the underlying host file access), so I'm working on a patch
to qemu to automatically name all nodes (rather than having to
hack up libvirt to supply two separate node names for a much
more complex command line), at which point I'll need code in
libvirt to probe the node name that got assigned by qemu.  So
I may still need another capability bit for whether qemu is new
enough to have the patch to auto-name all nodes.

* src/qemu/qemu_capabilities.h (QEMU_CAPS_BLOCK_WRITE_THRESHOLD):
New bit.
* src/qemu/qemu_capabilities.c (virQEMUCapsCommands): Enable it.

Signed-off-by: Eric Blake <eblake at redhat.com>
---
 src/qemu/qemu_capabilities.c | 4 +++-
 src/qemu/qemu_capabilities.h | 3 ++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 8a64422..81c63088 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -1,7 +1,7 @@
 /*
  * qemu_capabilities.c: QEMU capabilities generation
  *
- * Copyright (C) 2006-2014 Red Hat, Inc.
+ * Copyright (C) 2006-2015 Red Hat, Inc.
  * Copyright (C) 2006 Daniel P. Berrange
  *
  * This library is free software; you can redistribute it and/or
@@ -287,6 +287,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
               "aarch64-off",

               "vhost-user-multiq", /* 190 */
+              "block-write-threshold",
     );


@@ -1495,6 +1496,7 @@ struct virQEMUCapsStringFlags virQEMUCapsCommands[] = {
     { "nbd-server-start", QEMU_CAPS_NBD_SERVER },
     { "change-backing-file", QEMU_CAPS_CHANGE_BACKING_FILE },
     { "rtc-reset-reinjection", QEMU_CAPS_RTC_RESET_REINJECTION },
+    { "block-set-write-threshold", QEMU_CAPS_BLOCK_WRITE_THRESHOLD },
 };

 struct virQEMUCapsStringFlags virQEMUCapsMigration[] = {
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 3c166b6..e018043 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -1,7 +1,7 @@
 /*
  * qemu_capabilities.h: QEMU capabilities generation
  *
- * Copyright (C) 2006-2014 Red Hat, Inc.
+ * Copyright (C) 2006-2015 Red Hat, Inc.
  * Copyright (C) 2006 Daniel P. Berrange
  *
  * This library is free software; you can redistribute it and/or
@@ -230,6 +230,7 @@ typedef enum {
     QEMU_CAPS_DEVICE_PCI_SERIAL  = 188, /* -device pci-serial */
     QEMU_CAPS_CPU_AARCH64_OFF    = 189, /* -cpu ...,aarch64=off */
     QEMU_CAPS_VHOSTUSER_MULTIQ   = 190, /* vhost-user with -netdev queues= */
+    QEMU_CAPS_BLOCK_WRITE_THRESHOLD = 191, /* block-set-write-threshold */

     QEMU_CAPS_LAST,                   /* this must always be the last item */
 } virQEMUCapsFlags;
-- 
2.4.2




More information about the libvir-list mailing list