Ask Your Question
0

Customization script not effective/harmful

asked 2013-04-30 06:22:49 -0500

jason-parraga gravatar image

I am trying to run a simple bash script using the customization code/user data. I am getting some really funky problems. Sometimes the instance launches fine but the script was never run. Other times I can't even ssh into the instance because I'm getting a read from socket failed error. I am provisioning instances with the ubuntu precise cloudimg.

This launches but never makes a folder #!/bin/bash mkdir /home/ubuntu/test

This launches and gives me an ssh error mkdir /home/ubuntu/test

This (what I'm ultimately trying to do) results in an ssh error as well #!/bin/bash echo nameserver 8.8.4.4 | sudo tee -a /etc/resolvconf/resolv.conf.d/base sudo resolvconf -u sudo ip route add default via 10.0.0.2

I have been unable to find any detailed info on the horizon side of the user data. I have read the guides mentioning using the nova cli but it is important that this is as simple as possible. What am I doing wrong here?

edit retag flag offensive close merge delete

7 answers

Sort by ยป oldest newest most voted
0

answered 2013-04-30 17:08:44 -0500

lin-hua-cheng gravatar image

You can do this from the Project Dashboard => Instances Panel. On Launch Instance, there is tab for Post-Creation. You can put the customization script here that gets executed after instance is created.

Hope this helps.

edit flag offensive delete link more
0

answered 2013-04-30 06:34:21 -0500

lin-hua-cheng gravatar image

It is unclear what do you mean by customization code/user data.. are you referring to extension and having additional attributes on existing entities?

Horizon does not expose data from extensions. It is a customization you need to implement on top of horizon.

edit flag offensive delete link more
0

answered 2013-04-30 14:17:18 -0500

jason-parraga gravatar image

"You can customize your instance after it's launched using the options available here.

The "Customization Script" field is analogous to "User Data" in other systems."

http://docs.openstack.org/trunk/openstack-compute/admin/content/user-data.html (http://docs.openstack.org/trunk/opens...)

I am trying to run a shell script on boot, which is specifically defined in the docs.

edit flag offensive delete link more
0

answered 2013-04-30 17:23:43 -0500

jason-parraga gravatar image

That's exactly what I'm already doing. I'm trying to say that it does not work. The scripts that I entered above and resulted in the errors the I described. Either the scripts are never executed or the instance closes SSH connections. Do you understand what I'm talking about now?

ie. #!/bin/bash mkdir /home/ubuntu/test

is what I enter into the box and it does nothing.

edit flag offensive delete link more
0

answered 2013-04-30 18:27:45 -0500

lin-hua-cheng gravatar image

I understood now.

When instance is created, Horizon calls the novaclient.servers.create() - same method used in Nova cli. And passes the "custom script" you provided in the form as the userdata argument. The issue is probably in nova.

Have you tried executing the same command using nova cli?

You can enable the debugging in Horizon, to see what the request looks like being sent to Nova. From there you can at least test the same data when you invoke nova cli directly.

edit flag offensive delete link more
0

answered 2013-04-30 18:34:27 -0500

jason-parraga gravatar image

Thanks Lin Hua Cheng, that solved my question.

edit flag offensive delete link more
0

answered 2013-04-30 18:35:32 -0500

jason-parraga gravatar image

I was having trouble booting the instance from the nova cli due to some network issues, currently running with a quantum plugin. I will look at the debugging info thanks.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2013-04-30 06:22:49 -0500

Seen: 1,726 times

Last updated: Apr 30 '13