On 09/24/2015 12:18 PM, Chris Friesen wrote:


I think what happened is that we took the SIGTERM after the open() call in
create_iscsi_target(), but before writing anything to the file.

         f = open(volume_path, 'w+')
         f.write(volume_conf)
         f.close()

The 'w+' causes the file to be immediately truncated on opening, leading to an
empty file.

To work around this, I think we need to do the classic "write to a temporary
file and then rename it to the desired filename" trick.  The atomicity of the
rename ensures that either the old contents or the new contents are present.

I'm pretty sure that upstream code is still susceptible to zeroing out the file in the above scenario. However, it doesn't take an exception--that's due to a local change on our part that attempted to fix the below issue.

The stable/kilo code *does* have a problem in that when it regenerates the file it's missing the CHAP authentication line (beginning with "incominguser").

Chris

__________________________________________________________________________
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev

Reply via email to