On Thu, Aug 01, 2019 at 05:25:04PM +0200, Markus Armbruster wrote: > Ning Bo <ning....@zte.com.cn> writes: > > > Report vsock running event so that the upper application can > > control boot sequence. > > see https://github.com/kata-containers/runtime/pull/1918 > > Please provide a more complete summary of the use case in the commit > message. What exactly is the problem? What is the proposed solution, > and how does it make use of the new event? > > > Signed-off-by: Ning Bo <ning....@zte.com.cn>
Also it would seem that it should be possible to detect port listen state change just by trying to connect to it. Why isn't that an option? > > --- > > hw/virtio/vhost-vsock.c | 3 +++ > > qapi/char.json | 22 ++++++++++++++++++++++ > > 2 files changed, 25 insertions(+) > > > > diff --git a/hw/virtio/vhost-vsock.c b/hw/virtio/vhost-vsock.c > > index 0371493..a5920fd 100644 > > --- a/hw/virtio/vhost-vsock.c > > +++ b/hw/virtio/vhost-vsock.c > > @@ -22,6 +22,7 @@ > > #include "qemu/iov.h" > > #include "qemu/module.h" > > #include "monitor/monitor.h" > > +#include "qapi/qapi-events-char.h" > > > > enum { > > VHOST_VSOCK_SAVEVM_VERSION = 0, > > @@ -68,6 +69,8 @@ static int vhost_vsock_set_running(VHostVSock *vsock, int > > start) > > if (ret < 0) { > > return -errno; > > } > > + qapi_event_send_vsock_running(vsock->conf.guest_cid, start != 0); > > + > > return 0; > > } > > > > diff --git a/qapi/char.json b/qapi/char.json > > index a6e81ac..7b746e3 100644 > > --- a/qapi/char.json > > +++ b/qapi/char.json > > @@ -570,3 +570,25 @@ > > { 'event': 'VSERPORT_CHANGE', > > 'data': { 'id': 'str', > > 'open': 'bool' } } > > + > > +## > > +# @VSOCK_RUNNING: > > +# > > +# Emitted when the guest changes the vsock status. > > +# > > +# @cid: guest context ID > > +# > > +# @running: true if the vsock is running > > +# > > +# Since: v4.2 > > +# > > +# Example: > > +# > > +# <- { "event": "VSOCK_RUNNING", > > +# "data": { "cid": "123456", "running": true }, > > +# "timestamp": { "seconds": 1401385907, "microseconds": 422329 } } > > +# > > +## > > +{ 'event': 'VSOCK_RUNNING', > > + 'data': { 'cid': 'uint64', > > + 'running': 'bool' } } > > Can you explain why you put this into char.json? > > The event traces successful calls of vhost_vsock_set_running(). I have > no idea what vhost_vsock_set_running() does (pardon my ignorance). Can > you point me to a specification? > > Its @start parameter is int. The event's @running is bool. Zero gets > mapped to false, non-zero to true. Are you sure all non-zero values are > equivalent, and will remain equivalent? Allowing guest to emit events at a high speed