added an fallocate pass to avoid vm crash after resizing
authorPaul Tonelli <paul.tonelli@logilab.fr>
Fri, 08 Mar 2013 12:12:59 +0100
changeset 50 7e6fad327f58
parent 49 f5de218cf9d2
child 51 555bcf9abc33
added an fallocate pass to avoid vm crash after resizing
_states/tmp_state.py
--- a/_states/tmp_state.py	Fri Mar 08 12:06:50 2013 +0100
+++ b/_states/tmp_state.py	Fri Mar 08 12:12:59 2013 +0100
@@ -140,6 +140,9 @@
         ret['result'] = False
         ret['comment'] = 'Error while resizing {0}: {1}'.format(name, info['stderr'])
         return ret
+    if additionnal_flags:
+        info = __salt__['cmd.run_all']('fallocate -l ' + str(new_size /
+            block_size) + ' ' + name )
     ret['changes']['resized'] = True
     ret['comment'] = 'Resized filesystem {0} from {1} to {2}'.format(name, str(current_size * block_size), str(max(new_size, minimum_size)))
     return ret