| 17 | 17 |
|
| 18 | 18 |
from oslo_serialization import jsonutils as json
|
| 19 | 19 |
from six.moves import http_client
|
| 20 | |
from tempest import exceptions
|
| 21 | 20 |
from tempest.lib.common import rest_client
|
| 22 | 21 |
from tempest.lib import exceptions as lib_exc
|
|
22 |
|
|
23 |
from cinder_tempest_plugin import exceptions as volume_exc
|
| 23 | 24 |
|
| 24 | 25 |
|
| 25 | 26 |
class ConsistencyGroupsClient(rest_client.RestClient):
|
|
| 136 | 137 |
body = self.show_consistencygroup(cg_id)['consistencygroup']
|
| 137 | 138 |
cg_status = body['status']
|
| 138 | 139 |
if cg_status == 'error':
|
| 139 | |
raise exceptions.ConsistencyGroupException(cg_id=cg_id)
|
|
140 |
raise volume_exc.ConsistencyGroupException(cg_id=cg_id)
|
| 140 | 141 |
|
| 141 | 142 |
if int(time.time()) - start >= self.build_timeout:
|
| 142 | 143 |
message = ('Consistency group %s failed to reach %s status '
|
| 143 | 144 |
'(current %s) within the required time (%s s).' %
|
| 144 | 145 |
(cg_id, status, cg_status,
|
| 145 | 146 |
self.build_timeout))
|
| 146 | |
raise exceptions.TimeoutException(message)
|
|
147 |
raise lib_exc.TimeoutException(message)
|
| 147 | 148 |
|
| 148 | 149 |
def wait_for_consistencygroup_deletion(self, cg_id):
|
| 149 | 150 |
"""Waits for consistency group deletion"""
|
|
| 154 | 155 |
except lib_exc.NotFound:
|
| 155 | 156 |
return
|
| 156 | 157 |
if int(time.time()) - start_time >= self.build_timeout:
|
| 157 | |
raise exceptions.TimeoutException
|
|
158 |
raise lib_exc.TimeoutException
|
| 158 | 159 |
time.sleep(self.build_interval)
|
| 159 | 160 |
|
| 160 | 161 |
def wait_for_cgsnapshot_status(self, cgsnapshot_id, status):
|
|
| 168 | 169 |
body = self.show_cgsnapshot(cgsnapshot_id)['cgsnapshot']
|
| 169 | 170 |
cgsnapshot_status = body['status']
|
| 170 | 171 |
if cgsnapshot_status == 'error':
|
| 171 | |
raise exceptions.ConsistencyGroupSnapshotException(
|
|
172 |
raise volume_exc.ConsistencyGroupSnapshotException(
|
| 172 | 173 |
cgsnapshot_id=cgsnapshot_id)
|
| 173 | 174 |
|
| 174 | 175 |
if int(time.time()) - start >= self.build_timeout:
|
|
| 177 | 178 |
'(%s s).' %
|
| 178 | 179 |
(cgsnapshot_id, status, cgsnapshot_status,
|
| 179 | 180 |
self.build_timeout))
|
| 180 | |
raise exceptions.TimeoutException(message)
|
|
181 |
raise lib_exc.TimeoutException(message)
|
| 181 | 182 |
|
| 182 | 183 |
def wait_for_cgsnapshot_deletion(self, cgsnapshot_id):
|
| 183 | 184 |
"""Waits for consistency group snapshot deletion"""
|
|
| 188 | 189 |
except lib_exc.NotFound:
|
| 189 | 190 |
return
|
| 190 | 191 |
if int(time.time()) - start_time >= self.build_timeout:
|
| 191 | |
raise exceptions.TimeoutException
|
|
192 |
raise lib_exc.TimeoutException
|
| 192 | 193 |
time.sleep(self.build_interval)
|