Friday, January 15, 2010

taskfs : executing commands on remote host

The first working version of taskfs is complete. This version allows user to execute host command on host which is running remote inferno instance. And these commands are executed using filesystem interface. Revision 49060921b4 of inferno-rtasks implement these modifications.

Here are the steps about how to run and test it.

Firstly, you will need to run one remote instance of inferno with devcmd2 support. ericvh-brasil has this support. here are the commands used for this remote instance.

$ pwd
/home/pravin/projects/inferno/ericvh/ericvh-brasil/
$ ./Linux/386/bin/emu -r `pwd`
; styxlisten -A tcp!*!6666 export /cmd2


Now, following are the commands used with inferno-rtasks.


$ pwd
/usr/share/lxr/source/inferno/inferno-rtasks/
$ ./Linux/386/bin/emu -r `pwd`
; cd /task/remote
; cat clone
cat: cannot open clone: '/remote/local' does not exist
; mount -A tcp!127.0.0.1!6666 /remote
; cat clone
0;
; cd 0
; ls
args
ctl
env
ns
status
stderr
stdin
stdio
stdout
wait
; echo exec pwd > ctl
; cat stdio
/home/pravin/projects/inferno/ericvh/ericvh-brasil
; cat status
cmd/0 3 Done /home/pravin/projects/inferno/ericvh//ericvh-brasil/ pwd


You can see in the output above that command was executed by ericvh-brasil, which is remote inferno instance and not by inferno-rtasks.

Now, few comments about implementation.
The read call on /taskfs/remote/clone is modified to first perform a read on /remote/local/clone and save the path of reserved resource in REMOTE_RESOURCE_PATH string.

Also, the write call on /taskfs/remote/n/ctl are captured and then written to /remote/local/r/ctl. Similarly, the read on stdio,stderr and status are pulled from their same remote counterpart at /remote/local/r/.

One major flow in this implementation is the way handle to remote resource is stored. In this implementation, this handle is stored in REMOTE_RESOURCE_PATH string which contain absolute path. With help of namec function from emu/port/chan.c, Channel is created separately with each above mentioned remote files.

Correct way to implement this would be to store the handle to the Channel pointing to the /remote/local/r/, and use it to locate all the files without depending on absolute paths. Next version of taskfs will attempt to do this.

No comments:

Post a Comment