From 6c0119947e279138b4afe20707e7a65d8aebd5ac Mon Sep 17 00:00:00 2001 From: lianghao Date: Mon, 24 Apr 2017 20:50:59 +0800 Subject: [PATCH] Create a snapshot from a in-use volume with force=False In order to test the interface of "force=False", and distinguish with "force=True". If the interface is "force=True", we can create a snapshot from a in-use volume successfully. Change-Id: I7a2002b274c8ccefc4e398c1ef362ebd7cdb1395 --- tempest/api/volume/test_volumes_snapshots.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tempest/api/volume/test_volumes_snapshots.py b/tempest/api/volume/test_volumes_snapshots.py index 8ffc99df5b..be3f1f2e5f 100644 --- a/tempest/api/volume/test_volumes_snapshots.py +++ b/tempest/api/volume/test_volumes_snapshots.py @@ -16,6 +16,7 @@ from tempest.api.volume import base from tempest import config from tempest.lib.common.utils import data_utils from tempest.lib import decorators +from tempest.lib import exceptions as lib_exc from tempest import test CONF = config.CONF @@ -42,6 +43,10 @@ class VolumesSnapshotTestJSON(base.BaseVolumeTest): server = self.create_server(wait_until='ACTIVE') self.attach_volume(server['id'], self.volume_origin['id']) + # Snapshot a volume which attached to an instance with force=False + self.assertRaises(lib_exc.BadRequest, self.create_snapshot, + self.volume_origin['id'], force=False) + # Snapshot a volume even if it's attached to an instance snapshot = self.create_snapshot(self.volume_origin['id'], force=True)