I''m trying to read from xenstore inside of domU in python. In this example my domid is 4. I can read from inside domU just fine from the command line but not using the xs API from python even with correct permissions. root@xen1:~# xenstore-read /local/domain/4/name xen1.numnum.net root@xen1:~# python test.py Traceback (most recent call last): File "test.py", line 6, in <module> xs = xshandle() File "/usr/lib/python2.5/site-packages/xen/xend/xenstore/xsutil.py", line 18, in xshandle xs_handle = xen.lowlevel.xs.xs() xen.lowlevel.xs.Error: (2, ''No such file or directory'') test.py is: #!/usr/bin/env python from xen.xend.xenstore.xstransact import * from xen.xend.xenstore.xsutil import * xs = xshandle() th = xs.transaction_start() print xs.read(th, "/local/domain/4/name") xs.transaction_end(th) #xstransact.Read("/local/domain/4/name") This code works fine in dom0. I''ve found that if i do xenstore-read -s it will give me the same No such file or directory error. The -s parameter forces xenstore-read to call xs_daemon_open() instead of xs_domain_open(). The python lowlevel xs file always calls xs_daemon_open(). Is this the issue? What is the difference between daemon and domain_open? Also just to test, I tried to run xend inside domU. Xend fails with an operation not permitted error, but then when I run test.py after that I get a Connection Refused error instead of No such file or directory. Not sure what is going on. I''m using Ubuntu 7.10 with Xen 3.1.0 from their prebuilt packages. Thanks Kareem _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Hi Kareem, On Feb 19, 2008 4:00 PM, Kareem Dana <kareem.dana@gmail.com> wrote:> This code works fine in dom0. I''ve found that if i do xenstore-read -s > it will give me the same No such file or directory error. The -s > parameter forces xenstore-read to call xs_daemon_open() instead of > xs_domain_open(). The python lowlevel xs file always calls > xs_daemon_open(). Is this the issue? What is the difference between > daemon and domain_open?I expect that this is the issue. xs_daemon_open() uses a UNIX domain socket for communication with the xenstore daemon, which is a process running in Dom0. xs_domain_open() uses a kernel module and the xenbus to talk to xenstore. Therefore, only xs_domain_open() will work in a DomU. You could probably add a function to lowlevel/xs.c to do this so that you can use the Python functions in your DomU script.> Also just to test, I tried to run xend inside domU. Xend fails with an > operation not permitted error, but then when I run test.py after that > I get a Connection Refused error instead of No such file or directory. > Not sure what is going on. I''m using Ubuntu 7.10 with Xen 3.1.0 from > their prebuilt packages.A rough guess here would be that starting xend also starts xenstored in your DomU, which initialises the relevant sockets. Your program would then be attempting to connect to the xenstore running in your DomU, which is being refused for some reason. Regards, Derek. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel