[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH v1 04/26] char-socket: add 'reconnecting' property
From: |
Adalbert Lazăr |
Subject: |
[RFC PATCH v1 04/26] char-socket: add 'reconnecting' property |
Date: |
Wed, 15 Apr 2020 03:59:16 +0300 |
This is used by the VM introspection object to check if the connection
will be reestablished in case it disconnects from some reason.
The closing of the socket is used by any of the three parties involved,
KVM, the introspection tool and QEMU (eg. on force-reset), to signal
the other parties that the session is over. As such, it is very important
that the socket will reconnect.
CC: "Marc-André Lureau" <address@hidden>
CC: Paolo Bonzini <address@hidden>
Signed-off-by: Adalbert Lazăr <address@hidden>
---
chardev/char-socket.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/chardev/char-socket.c b/chardev/char-socket.c
index fd0106ab85..22ab242748 100644
--- a/chardev/char-socket.c
+++ b/chardev/char-socket.c
@@ -1492,6 +1492,13 @@ char_socket_get_connected(Object *obj, Error **errp)
return s->state == TCP_CHARDEV_STATE_CONNECTED;
}
+static bool char_socket_get_reconnecting(Object *obj, Error **errp)
+{
+ SocketChardev *s = SOCKET_CHARDEV(obj);
+
+ return s->reconnect_time > 0;
+}
+
static int tcp_chr_reconnect_time(Chardev *chr, int secs)
{
SocketChardev *s = SOCKET_CHARDEV(chr);
@@ -1528,6 +1535,10 @@ static void char_socket_class_init(ObjectClass *oc, void
*data)
object_class_property_add_bool(oc, "connected", char_socket_get_connected,
NULL, &error_abort);
+
+ object_class_property_add_bool(oc, "reconnecting",
+ char_socket_get_reconnecting,
+ NULL, &error_abort);
}
static const TypeInfo char_socket_type_info = {
[RFC PATCH v1 08/26] kvm: add VM introspection usage documentation, Adalbert Lazăr, 2020/04/14
[RFC PATCH v1 04/26] char-socket: add 'reconnecting' property,
Adalbert Lazăr <=
[RFC PATCH v1 06/26] E820: extend the table access interface, Adalbert Lazăr, 2020/04/14
[RFC PATCH v1 07/26] linux-headers: update with VM introspection interface, Adalbert Lazăr, 2020/04/14
[RFC PATCH v1 05/26] char-socket: add 'fd' property, Adalbert Lazăr, 2020/04/14
[RFC PATCH v1 13/26] kvm: vmi: block the object destruction if the chardev is connected, Adalbert Lazăr, 2020/04/14
[RFC PATCH v1 09/26] kvm: introduce the VM introspection object, Adalbert Lazăr, 2020/04/14
[RFC PATCH v1 02/26] char-socket: allow vsock parameters (cid, port), Adalbert Lazăr, 2020/04/14