]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Fixes a Windows volume driver bug on disk export
authorAlessandro Pilotti <ap@pilotti.it>
Wed, 12 Dec 2012 20:10:35 +0000 (22:10 +0200)
committerAlessandro Pilotti <ap@pilotti.it>
Wed, 19 Dec 2012 15:36:44 +0000 (17:36 +0200)
Fixes Bug #1089168

When a VHD created by Cinder using the iSCSI Target Server is deleted
manually, at the next startup the cinder-volume service terminates with an
exception.
This fix adds a check to verify if the disk exists.

Change-Id: I830cb8332dcef845591bd88cccef1e0e9781ffcc

21 files changed:
cinder/tests/test_windows.py
cinder/tests/windows/stubs/test_windows.TestWindowsDriver.test_check_for_setup_errors_wmi.p.gz
cinder/tests/windows/stubs/test_windows.TestWindowsDriver.test_create_export_os.p.gz
cinder/tests/windows/stubs/test_windows.TestWindowsDriver.test_create_export_wmi.p.gz
cinder/tests/windows/stubs/test_windows.TestWindowsDriver.test_create_snapshot_os.p.gz
cinder/tests/windows/stubs/test_windows.TestWindowsDriver.test_create_snapshot_wmi.p.gz
cinder/tests/windows/stubs/test_windows.TestWindowsDriver.test_create_volume_from_snapshot_os.p.gz
cinder/tests/windows/stubs/test_windows.TestWindowsDriver.test_create_volume_from_snapshot_wmi.p.gz
cinder/tests/windows/stubs/test_windows.TestWindowsDriver.test_create_volume_os.p.gz
cinder/tests/windows/stubs/test_windows.TestWindowsDriver.test_create_volume_wmi.p.gz
cinder/tests/windows/stubs/test_windows.TestWindowsDriver.test_delete_snapshot_os.p.gz
cinder/tests/windows/stubs/test_windows.TestWindowsDriver.test_delete_snapshot_wmi.p.gz
cinder/tests/windows/stubs/test_windows.TestWindowsDriver.test_delete_volume_os.p.gz
cinder/tests/windows/stubs/test_windows.TestWindowsDriver.test_delete_volume_wmi.p.gz
cinder/tests/windows/stubs/test_windows.TestWindowsDriver.test_ensure_export_os.p.gz
cinder/tests/windows/stubs/test_windows.TestWindowsDriver.test_ensure_export_wmi.p.gz
cinder/tests/windows/stubs/test_windows.TestWindowsDriver.test_initialize_connection_os.p.gz
cinder/tests/windows/stubs/test_windows.TestWindowsDriver.test_initialize_connection_wmi.p.gz
cinder/tests/windows/stubs/test_windows.TestWindowsDriver.test_remove_export_os.p.gz
cinder/tests/windows/stubs/test_windows.TestWindowsDriver.test_remove_export_wmi.p.gz
cinder/volume/drivers/windows.py

index 430eb40f4b6512495bc9e98081d330e5e92033b2..2ee09b73db52753c996c32a9da9eae7d96ee431b 100644 (file)
@@ -37,7 +37,7 @@ class TestWindowsDriver(basetestcase.BaseTestCase):
     def setUp(self):
         super(TestWindowsDriver, self).setUp()
         self.flags(
-            windows_iscsi_lun_path='D:\iSCSIVirtualDisks',
+            windows_iscsi_lun_path='C:\iSCSIVirtualDisks',
         )
         self._volume_data = None
         self._volume_data_2 = None
index 32a00b3d1ae8a8228e77cb4868467b90e82ff8e2..dada5e65488544313a26c2cdbef0d70915191d59 100644 (file)
Binary files a/cinder/tests/windows/stubs/test_windows.TestWindowsDriver.test_check_for_setup_errors_wmi.p.gz and b/cinder/tests/windows/stubs/test_windows.TestWindowsDriver.test_check_for_setup_errors_wmi.p.gz differ
index a511d37bf886af6fe966e84ceb6c24a47d768ae8..c425615b9262a82c16d4bf2ba89881c9a38818f3 100644 (file)
Binary files a/cinder/tests/windows/stubs/test_windows.TestWindowsDriver.test_create_export_os.p.gz and b/cinder/tests/windows/stubs/test_windows.TestWindowsDriver.test_create_export_os.p.gz differ
index a12005af17cf230e4d80b7de1d958f901b2efc22..2f6ea72b5957df2d37964e9587e884ba97f79ff2 100644 (file)
Binary files a/cinder/tests/windows/stubs/test_windows.TestWindowsDriver.test_create_export_wmi.p.gz and b/cinder/tests/windows/stubs/test_windows.TestWindowsDriver.test_create_export_wmi.p.gz differ
index a8b094f0c24ffc41447c6f43ef434bb0f24a5077..5e55a96f30d141bbd10e3fce92051ca47da1b7bd 100644 (file)
Binary files a/cinder/tests/windows/stubs/test_windows.TestWindowsDriver.test_create_snapshot_os.p.gz and b/cinder/tests/windows/stubs/test_windows.TestWindowsDriver.test_create_snapshot_os.p.gz differ
index a862e77f848061c33598f7cd98382eb009fc4f2e..4e5879f678a3144027df965ee71d1bb87090af56 100644 (file)
Binary files a/cinder/tests/windows/stubs/test_windows.TestWindowsDriver.test_create_snapshot_wmi.p.gz and b/cinder/tests/windows/stubs/test_windows.TestWindowsDriver.test_create_snapshot_wmi.p.gz differ
index f8e07369169b9cee5cc1b6f3b5ccd6c6101f8388..5de824a7ca8fdd6c202d5935910a55b31cc10bd9 100644 (file)
Binary files a/cinder/tests/windows/stubs/test_windows.TestWindowsDriver.test_create_volume_from_snapshot_os.p.gz and b/cinder/tests/windows/stubs/test_windows.TestWindowsDriver.test_create_volume_from_snapshot_os.p.gz differ
index 3cd1f0add2bd9dcb9b2c06cfee6cd04a7049b52f..8b9ead48f5aa0a8bee816708897e8e0802b6a218 100644 (file)
Binary files a/cinder/tests/windows/stubs/test_windows.TestWindowsDriver.test_create_volume_from_snapshot_wmi.p.gz and b/cinder/tests/windows/stubs/test_windows.TestWindowsDriver.test_create_volume_from_snapshot_wmi.p.gz differ
index f3f75ab7bfff404c649cbde29973e17626d41747..fc8eee072dee3c8906d245c49ab5803c79ab5f3a 100644 (file)
Binary files a/cinder/tests/windows/stubs/test_windows.TestWindowsDriver.test_create_volume_os.p.gz and b/cinder/tests/windows/stubs/test_windows.TestWindowsDriver.test_create_volume_os.p.gz differ
index 3fe0c038f74ac355b13045d01eb9c4bd189999c6..dad1f85205094bb8d3292c07d6f6e7b43687c8f2 100644 (file)
Binary files a/cinder/tests/windows/stubs/test_windows.TestWindowsDriver.test_create_volume_wmi.p.gz and b/cinder/tests/windows/stubs/test_windows.TestWindowsDriver.test_create_volume_wmi.p.gz differ
index 50522d795339377094bd297adbc667aee25032ed..69184224ff2ce2279a364b4f13c361f6176e8f5f 100644 (file)
Binary files a/cinder/tests/windows/stubs/test_windows.TestWindowsDriver.test_delete_snapshot_os.p.gz and b/cinder/tests/windows/stubs/test_windows.TestWindowsDriver.test_delete_snapshot_os.p.gz differ
index 6013757f213890e0f0958d1d57bee14997087f69..26de5bdaccd098826162bbe5fdb86449041b5636 100644 (file)
Binary files a/cinder/tests/windows/stubs/test_windows.TestWindowsDriver.test_delete_snapshot_wmi.p.gz and b/cinder/tests/windows/stubs/test_windows.TestWindowsDriver.test_delete_snapshot_wmi.p.gz differ
index b4494a8454bdf8744b1141083203c59a0f7b1c97..5ec5429411f55ab401b3535361276da36d7a593a 100644 (file)
Binary files a/cinder/tests/windows/stubs/test_windows.TestWindowsDriver.test_delete_volume_os.p.gz and b/cinder/tests/windows/stubs/test_windows.TestWindowsDriver.test_delete_volume_os.p.gz differ
index 48df24bc2efc125e78f4be0f401886e079d24f26..11fed29bbe4d2126ff82260fe87eda48f3fa5a4d 100644 (file)
Binary files a/cinder/tests/windows/stubs/test_windows.TestWindowsDriver.test_delete_volume_wmi.p.gz and b/cinder/tests/windows/stubs/test_windows.TestWindowsDriver.test_delete_volume_wmi.p.gz differ
index 36e30e6ec918da149e8a706398ff5509571a5591..3c5813515bdf20fde809d40b20e5c0679ed5859e 100644 (file)
Binary files a/cinder/tests/windows/stubs/test_windows.TestWindowsDriver.test_ensure_export_os.p.gz and b/cinder/tests/windows/stubs/test_windows.TestWindowsDriver.test_ensure_export_os.p.gz differ
index d561a318afc7a8bff679f480375b60c2437c8a6d..a0b4f4fd3573bf10ba82b6c99da882a292f5c6c8 100644 (file)
Binary files a/cinder/tests/windows/stubs/test_windows.TestWindowsDriver.test_ensure_export_wmi.p.gz and b/cinder/tests/windows/stubs/test_windows.TestWindowsDriver.test_ensure_export_wmi.p.gz differ
index 0bc36f2545504da5b2e625c7d88e622cc7423460..5373f017858dfcaecb59434d75df5e3e508f6938 100644 (file)
Binary files a/cinder/tests/windows/stubs/test_windows.TestWindowsDriver.test_initialize_connection_os.p.gz and b/cinder/tests/windows/stubs/test_windows.TestWindowsDriver.test_initialize_connection_os.p.gz differ
index 273068866047d89c1d5aa1f6555355b7b3ca05c6..b2af2519fbcbf23bec6a0ada2d0fcf708bb068fc 100644 (file)
Binary files a/cinder/tests/windows/stubs/test_windows.TestWindowsDriver.test_initialize_connection_wmi.p.gz and b/cinder/tests/windows/stubs/test_windows.TestWindowsDriver.test_initialize_connection_wmi.p.gz differ
index d1d4eda1be0cdb2f91f000ddc835e749ec93ea4d..64fdc6bef4f16c901c05ca5186677a35d3bb2bc3 100644 (file)
Binary files a/cinder/tests/windows/stubs/test_windows.TestWindowsDriver.test_remove_export_os.p.gz and b/cinder/tests/windows/stubs/test_windows.TestWindowsDriver.test_remove_export_os.p.gz differ
index 008d530f488d6cb9007210ffa60b32ae1d10beb7..9a8fe70b4fb6d2801b6cca862eed0a0f529f136f 100644 (file)
Binary files a/cinder/tests/windows/stubs/test_windows.TestWindowsDriver.test_remove_export_wmi.p.gz and b/cinder/tests/windows/stubs/test_windows.TestWindowsDriver.test_remove_export_wmi.p.gz differ
index 037737440fccdfd2c555597ce3a234111dd751df..e664427c2ff4157f0da4d368ab8ce39c60d08894 100644 (file)
@@ -206,7 +206,11 @@ class WindowsDriver(driver.ISCSIDriver):
                            ' while ensuring export'), exc)
         #Get the disk to add
         vol_name = volume['name']
-        wt_disk = self._conn_wmi.WT_Disk(Description=vol_name)[0]
+        q = self._conn_wmi.WT_Disk(Description=vol_name)
+        if not len(q):
+            LOG.debug(_('Disk not found: %s'), vol_name)
+            return None
+        wt_disk = q[0]
         wt_host = self._conn_wmi.WT_Host(HostName=target_name)[0]
         wt_host.AddWTDisk(wt_disk.WTD)