Ejemplo n.º 1
0
 def test_depublish_iscsi_do_nothing_if_tid_is_not_found(self):
     self.mox.StubOutWithMock(volume_driver, '_get_iqn')
     self.mox.StubOutWithMock(volume_driver, '_find_tid')
     volume_driver._get_iqn(self.instance['name'], self.mount_point).\
             AndReturn(self.iqn)
     volume_driver._find_tid(self.iqn).AndReturn(None)
     self.mox.ReplayAll()
     self.driver._depublish_iscsi(self.instance, self.mount_point)
Ejemplo n.º 2
0
 def test_depublish_iscsi_do_nothing_if_tid_is_not_found(self):
     self.mox.StubOutWithMock(volume_driver, '_get_iqn')
     self.mox.StubOutWithMock(volume_driver, '_find_tid')
     volume_driver._get_iqn(self.instance['name'], self.mount_point).\
             AndReturn(self.iqn)
     volume_driver._find_tid(self.iqn).AndReturn(None)
     self.mox.ReplayAll()
     self.driver._depublish_iscsi(self.instance, self.mount_point)
Ejemplo n.º 3
0
 def test_depublish_iscsi_ok(self):
     self.mox.StubOutWithMock(volume_driver, '_get_iqn')
     self.mox.StubOutWithMock(volume_driver, '_find_tid')
     self.mox.StubOutWithMock(volume_driver, '_delete_iscsi_export_tgtadm')
     volume_driver._get_iqn(self.instance['name'], self.mount_point).\
             AndReturn(self.iqn)
     volume_driver._find_tid(self.iqn).AndReturn(self.tid)
     volume_driver._delete_iscsi_export_tgtadm(self.tid)
     self.mox.ReplayAll()
     self.driver._depublish_iscsi(self.instance, self.mount_point)
Ejemplo n.º 4
0
 def test_depublish_iscsi_ok(self):
     self.mox.StubOutWithMock(volume_driver, '_get_iqn')
     self.mox.StubOutWithMock(volume_driver, '_find_tid')
     self.mox.StubOutWithMock(volume_driver, '_delete_iscsi_export_tgtadm')
     volume_driver._get_iqn(self.instance['name'], self.mount_point).\
             AndReturn(self.iqn)
     volume_driver._find_tid(self.iqn).AndReturn(self.tid)
     volume_driver._delete_iscsi_export_tgtadm(self.tid)
     self.mox.ReplayAll()
     self.driver._depublish_iscsi(self.instance, self.mount_point)
Ejemplo n.º 5
0
 def test_detach_volume(self):
     self.mox.StubOutWithMock(volume_driver, '_get_iqn')
     self.mox.StubOutWithMock(volume_driver, '_find_tid')
     self.mox.StubOutWithMock(volume_driver, '_delete_iscsi_export_tgtadm')
     self.mox.StubOutWithMock(self.driver, '_disconnect_volume')
     volume_driver._get_iqn(self.instance['name'], self.mount_point).\
             AndReturn(self.iqn)
     volume_driver._find_tid(self.iqn).AndReturn(self.tid)
     volume_driver._delete_iscsi_export_tgtadm(self.tid)
     self.driver._disconnect_volume(self.connection_info, self.mount_device)
     self.mox.ReplayAll()
     self.driver.detach_volume(self.connection_info, self.instance,
                               self.mount_point)
Ejemplo n.º 6
0
 def test_detach_volume(self):
     self.mox.StubOutWithMock(volume_driver, '_get_iqn')
     self.mox.StubOutWithMock(volume_driver, '_find_tid')
     self.mox.StubOutWithMock(volume_driver, '_delete_iscsi_export_tgtadm')
     self.mox.StubOutWithMock(self.driver, '_disconnect_volume')
     volume_driver._get_iqn(self.instance['name'], self.mount_point).\
             AndReturn(self.iqn)
     volume_driver._find_tid(self.iqn).AndReturn(self.tid)
     volume_driver._delete_iscsi_export_tgtadm(self.tid)
     self.driver._disconnect_volume(self.connection_info,
                                    self.mount_device)
     self.mox.ReplayAll()
     self.driver.detach_volume(self.connection_info,
                               self.instance,
                               self.mount_point)
Ejemplo n.º 7
0
 def test_find_tid_not_found(self):
     tid = volume_driver._find_tid(
         'iqn.2010-10.org.openstack.baremetal:1000002-dev.vdc')
     self.assertTrue(tid is None)
Ejemplo n.º 8
0
 def test_find_tid_found(self):
     tid = volume_driver._find_tid(
         'iqn.2010-10.org.openstack.baremetal:1000001-dev.vdc')
     self.assertEqual(1000001, tid)
Ejemplo n.º 9
0
 def test_find_tid_not_found(self):
     tid = volume_driver._find_tid("iqn.2010-10.org.openstack.baremetal:1000002-dev.vdc")
     self.assertTrue(tid is None)
Ejemplo n.º 10
0
 def test_find_tid_found(self):
     tid = volume_driver._find_tid("iqn.2010-10.org.openstack.baremetal:1000001-dev.vdc")
     self.assertEqual(1000001, tid)