def read_xenstore():
    recon()
    xs_handle = pyxenstore.Handle()

    try:
        hostname = xs_handle.read(XENSTORE_HOSTNAME_PATH)
        print('hostname: %r (from xenstore)\n' % hostname)
    except pyxenstore.NotFoundError:
        hostname = DEFAULT_HOSTNAME
        print('hostname: %r (DEFAULT)\n' % hostname)

    interfaces = []

    try:
        entries = xs_handle.entries(XENSTORE_INTERFACE_PATH)
    except pyxenstore.NotFoundError:
        entries = []

    for entry in entries:
        data = xs_handle.read(XENSTORE_INTERFACE_PATH + '/' + entry)
        data = anyjson.deserialize(data)
        interfaces.append(data)
        print('interface %s: %r\n' % (entry, data))

    del xs_handle
dataset/ETHPy150Open rackerlabs/openstack-guest-agents-unix/tools/readxen.py/read_xenstore/original