Merge "Add missing force
parameter"
This commit is contained in:
@@ -461,7 +461,7 @@ class BlockStorageCloudMixin:
|
||||
:raises: OpenStackCloudException on operation error.
|
||||
"""
|
||||
kwargs = self._get_volume_kwargs(kwargs)
|
||||
payload = {'volume_id': volume_id}
|
||||
payload = {'volume_id': volume_id, 'force': force}
|
||||
payload.update(kwargs)
|
||||
snapshot = self.block_storage.create_snapshot(**payload)
|
||||
if wait:
|
||||
|
@@ -400,6 +400,7 @@ class FakeVolumeSnapshot:
|
||||
self.updated_at = None
|
||||
self.volume_id = '12345'
|
||||
self.metadata = {}
|
||||
self.is_forced = False
|
||||
|
||||
|
||||
class FakeMachine:
|
||||
|
@@ -115,6 +115,24 @@ class TestCompute(base.BaseFunctionalTest):
|
||||
self.assertTrue(vol_attachment[key]) # assert string is not empty
|
||||
self.assertIsNone(self.user_cloud.detach_volume(server, volume))
|
||||
|
||||
def test_attach_volume_create_snapshot(self):
|
||||
self.skipTest('Volume functional tests temporarily disabled')
|
||||
server_name = self.getUniqueString()
|
||||
self.addCleanup(self._cleanup_servers_and_volumes, server_name)
|
||||
server = self.user_cloud.create_server(
|
||||
name=server_name, image=self.image, flavor=self.flavor, wait=True
|
||||
)
|
||||
volume = self.user_cloud.create_volume(1)
|
||||
vol_attachment = self.user_cloud.attach_volume(server, volume)
|
||||
for key in ('device', 'serverId', 'volumeId'):
|
||||
self.assertIn(key, vol_attachment)
|
||||
self.assertTrue(vol_attachment[key]) # assert string is not empty
|
||||
snapshot = self.user_cloud.create_volume_snapshot(
|
||||
volume_id=volume.id, force=True, wait=True
|
||||
)
|
||||
self.addCleanup(self.user_cloud.delete_volume_snapshot, snapshot['id'])
|
||||
self.assertIsNotNone(snapshot)
|
||||
|
||||
def test_create_and_delete_server_with_config_drive(self):
|
||||
self.addCleanup(self._cleanup_servers_and_volumes, self.server_name)
|
||||
server = self.user_cloud.create_server(
|
||||
|
@@ -59,7 +59,11 @@ class TestCreateVolumeSnapshot(base.TestCase):
|
||||
'volumev3', 'public', append=['snapshots']
|
||||
),
|
||||
json={'snapshot': build_snapshot_dict},
|
||||
validate=dict(json={'snapshot': {'volume_id': '1234'}}),
|
||||
validate=dict(
|
||||
json={
|
||||
'snapshot': {'volume_id': '1234', 'force': False}
|
||||
}
|
||||
),
|
||||
),
|
||||
dict(
|
||||
method='GET',
|
||||
@@ -104,7 +108,11 @@ class TestCreateVolumeSnapshot(base.TestCase):
|
||||
'volumev3', 'public', append=['snapshots']
|
||||
),
|
||||
json={'snapshot': build_snapshot_dict},
|
||||
validate=dict(json={'snapshot': {'volume_id': '1234'}}),
|
||||
validate=dict(
|
||||
json={
|
||||
'snapshot': {'volume_id': '1234', 'force': False}
|
||||
}
|
||||
),
|
||||
),
|
||||
dict(
|
||||
method='GET',
|
||||
@@ -149,7 +157,11 @@ class TestCreateVolumeSnapshot(base.TestCase):
|
||||
'volumev3', 'public', append=['snapshots']
|
||||
),
|
||||
json={'snapshot': build_snapshot_dict},
|
||||
validate=dict(json={'snapshot': {'volume_id': '1234'}}),
|
||||
validate=dict(
|
||||
json={
|
||||
'snapshot': {'volume_id': '1234', 'force': False}
|
||||
}
|
||||
),
|
||||
),
|
||||
dict(
|
||||
method='GET',
|
||||
|
Reference in New Issue
Block a user