Customization script not effective/harmful

Asked by Jason Parraga

I am trying to run a simple bash script using the post creation option while deploying an instance in openstack icehouse dashboard. using RHEL image and the instance gets deployed fine and is up and running. But the mentioned script is not reflected in the instance at all.

The script is below

#!/bin/bash
mkdir /root/sampledir

Colud you kindly asssist to solve this issue.. i verified all the logs but could not trace out.

Question information

Language:
English Edit question
Status:
Solved
For:
OpenStack Dashboard (Horizon) Edit question
Assignee:
No assignee Edit question
Solved by:
Lin Hua Cheng
Solved:
Last query:
Last reply:
Revision history for this message
Lin Hua Cheng (lin-hua-cheng) said :
#1

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.

Revision history for this message
Jason Parraga (jason-parraga) said :
#2

"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

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

Revision history for this message
Lin Hua Cheng (lin-hua-cheng) said :
#3

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.

Revision history for this message
Jason Parraga (jason-parraga) said :
#4

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.

Revision history for this message
Best Lin Hua Cheng (lin-hua-cheng) said :
#5

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.

Revision history for this message
Jason Parraga (jason-parraga) said :
#6

Thanks Lin Hua Cheng, that solved my question.

Revision history for this message
Jason Parraga (jason-parraga) said :
#7

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.

Revision history for this message
RaviRajan (ravirajangs) said :
#8

Hi,I am having the same pbm as Jason Parraga mentioned.But i couldnt understand the solution given.Could anyone suggest how to enable debugging in horizon.

Thanks in advance.

Revision history for this message
Matthias Runge (mrunge) said :
#9

To enable debugging in horizon:

edit /etc/openstack-dashboard/local_settings and set DEBUG = True
systemctl restart httpd

Not really sure, of that helps you to debug your issue at all.

Revision history for this message
RaviRajan (ravirajangs) said :
#10

Thank you. I ll try this.