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

[Xen-users] Xen4.4, xenstored and WATCH requests



Hello list,

Iâm working on a Python client library for XenStore [1]. The library implements
two ways to access XenStore: via a Unix socket and via /proc.  The /proc 
interface
turned out to be a bit problematic, because it ignores the req_id field for
WATCH requests.

The spec [2] requires all responses (except WATCH_EVENT) to copy req_id from
the request. So I wonder if itâs possible that the behaviour I observe is in 
fact
a bug in xenstored?

Below is a Python script demonstrating the issue:

    import os
    import struct

    WATCH = 4
    WRITE = 11

    def send_packet(fd, op, rq_id, tx_id, payload):
        data = struct.pack(b"IIII", op, rq_id, tx_id, len(payload)) + payload
        os.write(fd, data)


    def print_reply(fd):
        op, rq_id, tx_id, size = struct.unpack(b"IIII", os.read(fd, 16))
        payload = os.read(fd, size) if size else b""
        print(op, rq_id, tx_id, payload)


    fd = os.open("/proc/xen/xenbus", os.O_RDWR)
    try:
        send_packet(fd, WRITE, 24, 0, b"/foo\x00bar\x00")
        print_reply(fd)  # Responds with rq_id = 24.
        send_packet(fd, WATCH, 42, 0, b"/foo\x00token\x00")
        print_reply(fd)  # Spurious (?) WATCH_EVENT
        print_reply(fd)  # ACK for WATCH with rq_id = 0.
    finally:
        os.close(fd)

Iâm running Xen 4.4 on Ubuntu 14.04 inside VirtualBox.

$ uname -a
Linux xen-devel 3.19.0-25-generic #26~14.04.1-Ubuntu SMP Fri Jul 24 21:16:20 
UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

Regards,
Sergei

[1]: http://github.com/selectel/pyxs
[2]: http://xenbits.xen.org/docs/4.4-testing/misc/xenstore.txt


_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxx
http://lists.xen.org/xen-users

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.