def test_create_from_volume_id_with_unexpected_status_2(self):
fake_server_id = 'fake_server_123'
fake_host_name = 'attached_to_other'
fake_volume_name = 'fake_vol'
fake_volume_args = {'volume_id': DEFAULT_VOLUME_ID,
'status': 'in-use',
'multiattach': False,
'attachments': [{'server_id': fake_server_id,
'host_name': fake_host_name}]}
fake_cinder_volume = fake_object.FakeCinderVolume(**fake_volume_args)
self.cinderprovider._get_docker_volume = mock.MagicMock()
self.cinderprovider._get_docker_volume.return_value \
= (fake_cinder_volume,
consts.UNKNOWN)
self.cinderprovider.cinderclient.volumes.get = mock.MagicMock()
self.cinderprovider.cinderclient.volumes.get.return_value = \
fake_cinder_volume
self.assertRaises(exceptions.FuxiException,
self.cinderprovider.create,
fake_volume_name,
{'volume_id': DEFAULT_VOLUME_ID})
评论列表
文章目录