Bug report on execute service with multiple commands at reservation time

21 views
Skip to first unread message

Zhe Wang

unread,
Jul 14, 2014, 11:26:55 AM7/14/14
to geni-...@googlegroups.com
Hi,

I'm reporting a bug (or at least it doesn't make any sense to me). I'm attaching my rspec (in a simplified version).

When I tried to create sliver, with following service on a node,

<services>
<execute command="sudo bash /tmp/anti-ddos-setup/switch-setup 10.10.13.1 10.10.12.2; sudo route add -net 10.10.10.0 netmask 255.255.255.0 gw 10.10.12.1; sudo route add -net 10.10.11.0 netmask 255.255.255.0 gw 10.10.12.1; sudo route add -net 10.10.14.0 netmask 255.255.255.0 gw 10.10.13.2" shell="bash"/>
</services>

I got following error message:

Failed CreateSliver for slice urn:publicid:IDN+ch.geni.net:GPOInterns2014+slice+ddos at nysernet-ig. Error from Aggregate: code 1. protogeni AM code: 1: Invalid startup command

Changing "bash" to "sh" doesn't fix the problem. (I will talk about this later)

If I remove the arguments for the first command, that resolves the error and resources get reserved correctly:
<services>
<execute command="sudo bash /tmp/anti-ddos-setup/switch-setup; sudo route add -net 10.10.10.0 netmask 255.255.255.0 gw 10.10.12.1; sudo route add -net 10.10.11.0 netmask 255.255.255.0 gw 10.10.12.1; sudo route add -net 10.10.14.0 netmask 255.255.255.0 gw 10.10.13.2" shell="bash"/>
</services>
However, this is not an acceptable solution as I do need to pass arguments to my script.

You may ask: why do you put all commands in one execute tag? That's because of another bug(?) I had.
So if I have multiple execute tags,

<services>
<execute command="sudo bash /tmp/anti-ddos-setup/switch-setup" shell="bash"/>
<execute command="sudo route add -net 10.10.10.0 netmask 255.255.255.0 gw 10.10.12.1" shell="bash"/>
<execute command="sudo route add -net 10.10.11.0 netmask 255.255.255.0 gw 10.10.12.1" shell="bash"/>
<execute command="sudo route add -net 10.10.14.0 netmask 255.255.255.0 gw 10.10.13.2" shell="bash"/>
</services>

I got following error message:
 
Failed CreateSliver for slice urn:publicid:IDN+ch.geni.net:GPOInterns2014+slice+ddos at https://instageni.ku.gpeni.net:12369/protogeni/xmlrpc/am/2.0. Error from Aggregate: code 2. protogeni AM code: 2: Invalid shell in execute

This was fixed by combining all commands in one execute tag like I showed previously, though I don't know why......


However, when Sarah told me to change "bash" to "sh", the error was resolved:
<services>
<execute command="sudo bash /tmp/anti-ddos-setup/switch-setup" shell="sh"/>
<execute command="sudo route add -net 10.10.10.0 netmask 255.255.255.0 gw 10.10.12.1" shell="sh"/>
<execute command="sudo route add -net 10.10.11.0 netmask 255.255.255.0 gw 10.10.12.1" shell="sh"/>
<execute command="sudo route add -net 10.10.14.0 netmask 255.255.255.0 gw 10.10.13.2" shell="sh"/>
</services>
This kind of make sense to the error message "Invalid shell in execute". But it doesn't explain why putting all commands in one execute tag and using shell="bash" can also work.

Equally surprisingly (to me), now I can pass arguments:
<services>
<execute command="sudo bash /tmp/anti-ddos-setup/switch-setup 10.10.13.1 10.10.12.2" shell="sh"/>
<execute command="sudo route add -net 10.10.10.0 netmask 255.255.255.0 gw 10.10.12.1" shell="sh"/>
<execute command="sudo route add -net 10.10.11.0 netmask 255.255.255.0 gw 10.10.12.1" shell="sh"/>
<execute command="sudo route add -net 10.10.14.0 netmask 255.255.255.0 gw 10.10.13.2" shell="sh"/>
</services>

Then I don't understand why I can pass arguments in separate executes but cannot in one execute tag. And what is more confusing is: I have arguments in other commands ( sudo route add -net 10.10.10.0 netmask 255.255.255.0 gw 10.10.12.1 ) and that works all the time.

So I really appreciate if anyone can explain the reason of the error and tell what is the correct way to write my rspec.

Thank you for your time



Zhe (Joe) Wang
bug.rspec

Leigh Stoller

unread,
Jul 15, 2014, 1:23:48 PM7/15/14
to geni-...@googlegroups.com
> Then I don't understand why I can pass arguments in separate executes but
> cannot in one execute tag. And what is more confusing is: I have
> arguments in other commands ( sudo route add -net 10.10.10.0 netmask
> 255.255.255.0 gw 10.10.12.1 ) and that works all the time.
>
> So I really appreciate if anyone can explain the reason of the error and
> tell what is the correct way to write my rspec.

So I think most of the confusion stems from a bad error diagnostic. The
initial problem is that when you had one long command, its length was
longer then the maximum allowed, but the error statement does not tell you
that. I have fixed that error statment, and it will push out to all racks
this Friday.

So, when you removed the arguments, its length went below 256 characters,
and it was okay.

And as you learned, bash is not an acceptable shell for this, mostly cause
it is not installed on every image.

What we generally encourage is that people write a single wrapper shell
script, and put into a tarball, that is installed in the services section
before the execute element.

Leigh




Zhe Wang

unread,
Jul 15, 2014, 1:43:37 PM7/15/14
to geni-...@googlegroups.com
Hi Leigh,

Thank you for your help.

Your explanation resolves most of my confusion.

I will try to use one shell script, though I only want to put the hard coded part in rspec. So the route entries differ according to it's ip and its location in the topo. I don't want to create a script for each node. If I have one sentence in the shell script and have to pass arguments into it, I don't see why I shouldn't write the command directly.

The only thing I don't understand is why I didn't get "Invalid shell in execute" when I have "<execute command="sudo bash /tmp/anti-ddos-setup/switch-setup; sudo route add -net 10.10.10.0 netmask 255.255.255.0 gw 10.10.12.1; sudo route add -net 10.10.11.0 netmask 255.255.255.0 gw 10.10.12.1; sudo route add -net 10.10.14.0 netmask 255.255.255.0 gw 10.10.13.2" shell="bash"/>"  

Thank you for your time


Joe

Leigh Stoller

unread,
Jul 15, 2014, 1:49:53 PM7/15/14
to geni-...@googlegroups.com
> I will try to use one shell script, though I only want to put the hard
> coded part in rspec. So the route entries differ according to it's ip and
> its location in the topo. I don't want to create a script for each
> node.

You can pass arguments to a shell script you write and install, so you only
need one script that takes some arguments; the entire command line for that
script has to be less then 256 characters.

> If I have one sentence in the shell script and have to pass arguments
> into it, I don't see why I shouldn't write the command directly.

Sure, as long as its less then 256 characters.

> The only thing I don't understand is why I didn't get "Invalid shell in
> execute" when I have ""

That is a different error, which will need to be fixed at some point too.

Leigh

Zhe Wang

unread,
Jul 15, 2014, 1:55:23 PM7/15/14
to geni-...@googlegroups.com
Thank you. That's good to know.
Reply all
Reply to author
Forward
0 new messages