[PATCH 3/4] qemu: passt: Use 'reconnect-ms' instead of 'reconnect' with new qemus

Peter Krempa posted 4 patches 2 weeks ago
[PATCH 3/4] qemu: passt: Use 'reconnect-ms' instead of 'reconnect' with new qemus
Posted by Peter Krempa 2 weeks ago
The 'reconnect' field of 'stream' network backend type is about to be
deprecated so libvirt will need to start using 'reconnect-ms'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
 src/qemu/qemu_passt.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/qemu/qemu_passt.c b/src/qemu/qemu_passt.c
index 70a12c825e..dd4a8bb997 100644
--- a/src/qemu/qemu_passt.c
+++ b/src/qemu/qemu_passt.c
@@ -104,12 +104,14 @@ qemuPasstAddNetProps(virDomainObj *vm,
         return -1;
     }

-    /* a narrow range of QEMU releases support -netdev stream, but
-     * don't support its "reconnect" option
-     */
-    if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NETDEV_STREAM_RECONNECT) &&
-        virJSONValueObjectAdd(netprops, "u:reconnect", 5, NULL) < 0) {
-        return -1;
+    if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NETDEV_STREAM_RECONNECT)) {
+        if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NETDEV_STREAM_RECONNECT_MILISECONDS)) {
+            if (virJSONValueObjectAdd(netprops, "u:reconnect-ms", 5000, NULL) < 0)
+                return -1;
+        } else {
+            if (virJSONValueObjectAdd(netprops, "u:reconnect", 5, NULL) < 0)
+                return -1;
+        }
     }

     return 0;
-- 
2.47.0