Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FLOC-2543] Continue on volume errors #1768

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions flocker/node/agents/test/test_blockdevice.py
Original file line number Diff line number Diff line change
Expand Up @@ -3266,6 +3266,54 @@ def test_missing(self):
DatasetWithoutVolume(dataset_id=dataset_id), failure.value
)

def test_run_error(self):
"""
``AttachVolume.run``
"""
host = u"192.0.7.8"

deployer = create_blockdevicedeployer(self, hostname=host)
api = deployer.block_device_api

change1 = AttachVolume(dataset_id=uuid4())
volume1 = api.create_volume(
dataset_id=change1.dataset_id,
size=LOOPBACK_MINIMUM_ALLOCATABLE_SIZE
)

change2 = AttachVolume(dataset_id=uuid4())
volume2 = api.create_volume(
dataset_id=change2.dataset_id,
size=LOOPBACK_MINIMUM_ALLOCATABLE_SIZE
)

original_attach_volume = api.attach_volume

def fake_attach_volume(blockdevice_id, attach_to):
if blockdevice_id == volume1.blockdevice_id:
raise Exception(
'Block device cannot be attached', blockdevice_id
)
return original_attach_volume(blockdevice_id, attach_to)

self.patch(api, 'attach_volume', fake_attach_volume)
changes = in_parallel([change1, change2])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that "in_parallel" does a sort internally, so maybe disable the sorting and see if that causes breakage?


expected_volume2 = volume2.set(
attached_to=api.compute_instance_id()
)

def check_volumes(result):
self.flushLoggedErrors()
self.assertEqual(
set([volume1, expected_volume2]),
set(api.list_volumes())
)

changing = run_state_change(changes, deployer)
changing.addBoth(check_volumes)
return changing


class AllocatedSizeTypeTests(SynchronousTestCase):
"""
Expand Down