Anyway to avoid filling zero when deleting a volume?

Asked by Lingfeng Xiong

Hi all,
I found when I deleting a volume, cinder will fill the whole volume with zero. This may cause two problem:
1. it waste a lot of time
2. it often failed in my servers

I don't know why but it always failed in my server, even with a brand new hard driver. When it failed, my volume will be leave at a "Error_Deleting" state and I cannot delete it completely.
I know this is good for security, but I really think I don't need it.
Anyway to turn it of?
Thanks in advanced.

Question information

Language:
English Edit question
Status:
Answered
For:
Cinder Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:

This question was reopened

Revision history for this message
Lingfeng Xiong (xionglingfeng) said :
#1

Ok... since no one give me a hand, I will answer this question by myself...

For some server, like mine, always crash when deleting a volume because it executed some operations like
dd if=/dev/zero of=XXXX

This operating could took a long time and make server load extremely high, furthermore, it may crash some servers like ours. And when this operation failed, the volume will leave at 'Error_deleting' status, neither can be deleted nor be restored to 'Available' status.

To zero out a volume before deleting it is a good strategy for security. However, for some secure insensitive private cloud system like ours, this is unnecessary. So here's the solution to avoid zeroing out a volume before deleting it:
Use a editor to open /usr/lib/python2.7/dist-packages/cinder/volume/driver.py
Go to line 160 (I have patched cinder to support O_DIRECT on virtual driver, so the line number in vanilla Folsom cinder package should be a bit smaller than this.)
This line should be
self._copy_volume('/dev/zero', self.local_path(volume), size_in_g)
the first line of function _delete_volume()
Just comment that line out.

Revision history for this message
Avishay Traeger (avishay-il) said :
#2

That will indeed fix it, but a better way is to set the "secure_delete" flag to False.

Revision history for this message
Lingfeng Xiong (xionglingfeng) said :
#3

Hi Avishay,
Could you explain a bit more future? Where to set that flag?

Revision history for this message
Avishay Traeger (avishay-il) said :
#4

In cinder.conf, add the following line:
secure_delete = False

Can you help with this problem?

Provide an answer of your own, or ask Lingfeng Xiong for more information if necessary.

To post a message you must log in.