[openstack-dev] [Heat] userdata empty when using software deployment/config in Kilo
sbaker at redhat.com
Thu Oct 29 06:26:11 UTC 2015
On 29/10/15 06:12, Gabe Black wrote:
> Using my own template or the example template:
> results in the VM's /var/lib/cloud/instance/script/userdata being empty.
> The only warnings during the cloud-init boot sequence are:
> [ 14.470601] cloud-init: 2015-10-28 17:48:15,104 - util.py[WARNING]: Failed running /var/lib/cloud/instance/scripts/userdata [-]
> [ 15.051625] cloud-init: 2015-10-28 17:48:15,685 - cc_scripts_user.py[WARNING]: Failed to run module scripts-user (scripts in /var/lib/cloud/instance/scripts)
> [ 15.057189] cloud-init: 2015-10-28 17:48:15,690 - util.py[WARNING]: Running module scripts-user (<module 'cloudinit.config.cc_scripts_user' from '/usr/lib/python2.7/site-packages/cloudinit/config/cc_scripts_user.pyc'>) failed
> I believe those warnings are simply because the userdata file is empty
> I googled and searched and couldn't find why it wasn't working for me.
> The nova.api logs show the transfer of the files, no problem there. It is really sending empty userdata and it thinks it should be doing that.
> To verify I added some debug prints in heat/engine/resources/openstack/nova/server.py:612 in handle_create() method. Below is the first part of the method for reference:
> def handle_create(self):
> security_groups = self.properties.get(self.SECURITY_GROUPS)
> user_data_format = self.properties.get(self.USER_DATA_FORMAT)
> ud_content = self.properties.get(self.USER_DATA) #<---
> if self.user_data_software_config() or self.user_data_raw(): #<---
> if uuidutils.is_uuid_like(ud_content):
> # attempt to load the userdata from software config
> ud_content = self.get_software_config(ud_content) #<--- ....
> I added some debug log prints after the #<--- above to see what it was getting for user_data, and it turns out it is empty (e.g. I don't even see the third debug print I put in). Spending more time looking through the code it appears to me that the self.properties.get(self.USER_DATA) should be returning the uuid for the software config resource associated with the deployment, but I could be wrong. Either way, it is empty which I think is not right.
> Does anyone have an idea what I might be doing wrong? I've been struggling for the past couple of days on this one! Or is deployment just not stable in Kilo? Documentation seems to indicate it has been supported even before Kilo.
> Thanks in advance!
It is expected that userdata is empty, because the server resources do
not specify any script in their user_data properties.
There is other data in the initial cloud-init package which bootstraps
polling for deployment data. The actual deployment data comes from
requests to the heat metadata API, not in cloud-init userdata.
An appropriately built custom image will configure
/etc/os-collect-config.conf on boot so that it can start polling for
deployment data from heat.
Please take a look at the documentation for this:
More information about the OpenStack-dev