From ff3b994f12edf28d187bb1987aa7094b7897b015 Mon Sep 17 00:00:00 2001 From: Dan Prince Date: Fri, 7 Sep 2012 11:52:03 -0400 Subject: Handle missing 'provider_location' in rm_export. Updates the remove_export function in the ISCSIDriver so that it handles the case where provider_location isn't set on a volume. This can occur if a volume is created but not exported. This was a regression from a previous commit (66f6a9edce3ccd624aba5d2a6bf3362901ed57f7) which changed the way iscsi targets are created/deleted. With this commit the Nova Smoke Test volume tests should once again pass. Fixes LP Bug #1046484. Change-Id: I4539d73691a058d8fdc6c864dee06c0d4e4813f7 --- nova/volume/driver.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'nova/volume') diff --git a/nova/volume/driver.py b/nova/volume/driver.py index d03ad7cdc..3e974a915 100644 --- a/nova/volume/driver.py +++ b/nova/volume/driver.py @@ -347,12 +347,6 @@ class ISCSIDriver(VolumeDriver): def remove_export(self, context, volume): """Removes an export for a logical volume.""" - #BOOKMARK jdg - location = volume['provider_location'].split(' ') - iqn = location[1] - if 'iqn' not in iqn: - LOG.warning(_("Jacked... didn't get an iqn")) - return # NOTE(jdg): tgtadm doesn't use the iscsi_targets table # TODO(jdg): In the future move all of the dependent stuff into the @@ -369,6 +363,12 @@ class ISCSIDriver(VolumeDriver): iscsi_target = 0 try: + + # NOTE: provider_location may be unset if the volume hasn't + # been exported + location = volume['provider_location'].split(' ') + iqn = location[1] + # ietadm show will exit with an error # this export has already been removed self.tgtadm.show_target(iscsi_target, iqn=iqn) -- cgit