Storage.remove() catch IO/OSError and log it

This commit is contained in:
Bahtiar `kalkin-` Gadimov 2016-05-05 19:16:33 +02:00
parent c5810758c5
commit 116ba64e51
No known key found for this signature in database
GPG Key ID: 96ED3C3BA19C3DEE

View File

@ -190,8 +190,15 @@ class Storage(object):
'VM directory does not exist: {}'.format(self.vm.dir_path)) 'VM directory does not exist: {}'.format(self.vm.dir_path))
def remove(self): def remove(self):
''' Remove all the volumes.
Errors on removal are catched and logged.
'''
for name, volume in self.vm.volumes.items(): for name, volume in self.vm.volumes.items():
try:
self.get_pool(volume).remove(volume) self.get_pool(volume).remove(volume)
except (IOError, OSError) as e:
self.vm.log.exception("Failed to remove volume %s", name, e)
def start(self): def start(self):
''' Execute the start method on each pool ''' ''' Execute the start method on each pool '''