def test_mount_state_attach_to_other(self, mock_create_mp, mock_do_mount):
fd, fake_devpath = tempfile.mkstemp()
fake_link_path = fake_devpath
fake_mountpoint = 'fake-mount-point/'
with mock.patch.object(FakeCinderConnector, 'get_device_path',
return_value=fake_link_path):
with mock.patch.object(cinder.Cinder, '_get_mountpoint',
return_value=fake_mountpoint):
fake_c_vol = fake_object.FakeCinderVolume(multiattach=True)
with mock.patch.object(cinder.Cinder, '_get_docker_volume',
return_value=(fake_c_vol,
consts.ATTACH_TO_OTHER)):
self.assertEqual(fake_mountpoint,
self.cinderprovider.mount('fake-vol'))
fake_c_vol = fake_object.FakeCinderVolume(multiattach=False)
with mock.patch.object(cinder.Cinder, '_get_docker_volume',
return_value=(fake_c_vol,
consts.ATTACH_TO_OTHER)):
self.assertRaises(exceptions.FuxiException,
self.cinderprovider.mount, 'fake-vol')
评论列表
文章目录