Fixes cinder volume delete on Windows
Because of the fact that an iSCSI target is not created anymore at volume creation time, not all volumes will have a corresponding target. For this reason, when removing an iSCSI target we must first check if the target actually exists. Change-Id: I8e571397df6d9a2eeb05e883b7da8494d4bfa1ad Closes-Bug: #1299124
This commit is contained in:
parent
6b3d177695
commit
601d54c9ef
|
@ -235,7 +235,12 @@ class WindowsUtils(object):
|
|||
def remove_iscsi_target(self, target_name):
|
||||
"""Removes ISCSI target."""
|
||||
try:
|
||||
wt_host = self._conn_wmi.WT_Host(HostName=target_name)[0]
|
||||
host = self._conn_wmi.WT_Host(HostName=target_name)
|
||||
if not host:
|
||||
LOG.debug(_('Skipping removing target %s as it does not '
|
||||
'exist.') % target_name)
|
||||
return
|
||||
wt_host = host[0]
|
||||
wt_host.RemoveAllWTDisks()
|
||||
wt_host.Delete_()
|
||||
except wmi.x_wmi as exc:
|
||||
|
|
Loading…
Reference in New Issue