Set volume dev_path to None when detaching

This commit is contained in:
Anders Ingemann 2014-04-07 21:52:01 +02:00
parent 2c20b593b4
commit b67b8b7260
3 changed files with 4 additions and 2 deletions

View file

@ -21,7 +21,7 @@ class LoopbackVolume(Volume):
def _before_detach(self, e):
log_check_call(['losetup', '--detach', self.loop_device_path])
del self.loop_device_path
del self.device_path
self.device_path = None
def _before_delete(self, e):
from os import remove

View file

@ -46,7 +46,7 @@ class QEMUVolume(LoopbackVolume):
def _before_detach(self, e):
log_check_call(['qemu-nbd', '--disconnect', self.loop_device_path])
del self.loop_device_path
del self.device_path
self.device_path = None
def _module_loaded(self, module):
import re

View file

@ -44,6 +44,8 @@ class EBSVolume(Volume):
while self.volume.attachment_state() is not None:
time.sleep(2)
self.volume.update()
del self.ec2_device_path
self.device_path = None
def _before_delete(self, e):
self.volume.delete()