Home > openstack, zero-VM > Running ZeroVM with ZeroCloud Middleware.

Running ZeroVM with ZeroCloud Middleware.

Running ZeroVM App with ZeroCloud Middleware:

I have used both swift and Curl commands. I have used temp_auth module for authentication ( instead of Keystone / SWauth / related things). In my swift admin account (swift account name: AUTH_admin) I have uploaded a input file (named input.data which is not being used by my app) and a output file (output.data) where output will be written.

My executable file is (sizeof.nexe) which prints size of different zerovm supported data types. Corresponding C program is available here [1]

My job description file is named (sizeof.json) which has the following content:

   [

  2         {

  3             “name”:“sizeof”,

  4             “exec”:{“path”:“swift://AUTH_admin/zerovm/sizeof.nexe”},

  5             “file_list”:[

  6                 {“device”:“stdin”,“path”:“swift://AUTH_admin/zerovm/input.data”},

  7                 {“device”:“stdout”,“path”:“swift://AUTH_admin/zerovm/output.data”},

  8                 {“device”:“stderr”}

  9             ],

 10             “args”:“1048576”

 11         }

 12     ]

Put attention how the path for executable and files look like. If you do not specify path in right syntax it won’t work.

Here is the command I have used to upload input, output and executable files and then run the executable with Job description files.

#Creating container :

 ‘zerovm’ container is the place where all my files are uploaded:

swift  -A http://localhost/auth/v1.0/ -U admin:admin -K admin post zerovm

#Upload input, output and executable files:

my both input and output  files are empty .

swift  -A http://localhost/auth/v1.0/ -U admin:admin -K admin upload zerovm output.data

swift  -A http://localhost/auth/v1.0/ -U admin:admin -K admin upload zerovm input.data

swift  -A http://localhost/auth/v1.0/ -U admin:admin -K admin upload zerovm  sizeof.nexe

# Give read/ write permission to the container:

I am using Curl command for the next command. So, I need to generate a token for further curl command. I use tempauth to get token & Storage URL

curl -v -H  X-Auth-User:admin:admin -H  X-Auth-Key:admin  http://localhost/auth/v1.0/

#copy and paste STRORAGE URL & TOKEN from the output of last command

export STORAGE_URL=http://localhost/v1/AUTH_admin

export TOKEN=AUTH_tkc20cf42128854625bf2a46a6dae47af6

The token won’t be same for your case. So you have to get yourself a valid token for you.

giving world permission to the container which is giving the over permission. For for the time being it is okay.

curl -i -XPOST -H “X-Auth-Token:$TOKEN” -H “X-Container-Read:*.*” \

    http://localhost/v1/AUTH_admin/zerovm

 curl -i -XPOST -H “X-Auth-Token:$TOKEN” -H “X-Container-write:*.*” \

    http://localhost/v1/AUTH_admin/zerovm

# Uploading & Executing Job files:

curl -X POST -i -H “X-Auth-Token: $TOKEN” -H “X-Zerovm-Execute: 1.0″ -H “Content-Type:application/json” T sizeof.json $STORAGE_URL/zerovm/sizeof.json

Seeing the result:

In my case , I have written the output to the file output.data in which case I see the following responses by  executing the job file.

HTTP/1.1 200 OK

Date: Sun, 13 Apr 2014 18:17:40 GMT

X-Nexe-Retcode: 0

X-Nexe-System: sizeof

X-Nexe-Cdr-Line: 0.052, 0.024, 0.00 0.00 1 921 36 1047 0 0 0 0

X-Nexe-Validation: 0

X-Nexe-Etag: /dev/stderr d41d8cd98f00b204e9800998ecf8427e

Etag: fa0833ba7d5be12b11dd565d8074de30

X-Nexe-Status: ok

Content-Type: text/html; charset=UTF-8

Content-Length: 0

Via: 1.1 127.0.1.1

Vary: Accept-Encoding

Boom!! Now my  (hopefully yours too)  Zerovm app is running through zero cloud middleware.

References:

[1]. https://github.com/zerovm/zerovm-2.0/blob/master/tests/functional/demo/sizeof/sizeof.c

[2]. https://github.com/zerovm/zerocloud/tree/icehouse/doc

Advertisements
Categories: openstack, zero-VM
  1. David Gao
    April 16, 2014 at 1:56 am

    Hi, I fellow your steps, everything is right except last step! When I post the job to swift, I just get 404 error, How do you think this?

    ubuntu@ip-10-132-171-179:~$ curl -X POST -i -H ‘X-Auth-Token: TEMPAUTH_tk2c99aed3fc944c018cd8b6cc622b4e30’ -H ‘X-Zerovm-Execute: 1.0’ -H ‘Content-Type:application/json’ -d'[{“name”:”sizeof”,”exec”:{“path”:”swift://TEMPAUTH_admin/david/sizeof.nexe”},”file_list”:[{“device”:”stdin”,”path”:”swift://TEMPAUTH_admin/david/input.data”},{“device”:”stdout”,”path”:”swift://TEMPAUTH_admin/david/output.data”},{“device”:”stderr”}],”args”:”1048576″}]’ ‘http://10.132.171.179:8080/v1/TEMPAUTH_admin/david/sizeof.json’
    HTTP/1.1 404 Not Found
    Content-Length: 70
    Content-Type: text/html; charset=UTF-8
    X-Trans-Id: tx2896d3cce15341618a53e-00534e36fd
    Date: Wed, 16 Apr 2014 07:53:33 GMT

    Not FoundThe resource could not be found.

    • Prosunjit Biswas
      April 16, 2014 at 7:33 am

      It seems, the error says, the swift url ‘swift://TEMPAUTH_admin’ is not a valid one.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: