Skip to content

Commit 1d1e036

Browse files
committed
Add shared_sr + log type of SR
Add a fixture `shared_sr` to get a shared SR Also modify local_sr_* function to log the SR type Signed-off-by: Damien Thenot <[email protected]>
1 parent 0d957e7 commit 1d1e036

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

conftest.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,14 +304,21 @@ def host_no_ipv6(host):
304304
if is_ipv6(host.hostname_or_ip):
305305
pytest.skip(f"This test requires an IPv4 XCP-ng")
306306

307+
@pytest.fixture(scope="session")
308+
def shared_sr(host):
309+
sr = host.pool.first_shared_sr()
310+
assert sr, "No shared SR available on hosts"
311+
logging.info(">> Shared SR on host present: {} of type {}".format(sr.uuid, sr.get_type()))
312+
yield sr
313+
307314
@pytest.fixture(scope='session')
308315
def local_sr_on_hostA1(hostA1):
309316
""" A local SR on the pool's master. """
310317
srs = hostA1.local_vm_srs()
311318
assert len(srs) > 0, "a local SR is required on the pool's master"
312319
# use the first local SR found
313320
sr = srs[0]
314-
logging.info(">> local SR on hostA1 present : %s" % sr.uuid)
321+
logging.info(">> local SR on hostA1 present: {} of type {}".format(sr.uuid, sr.get_type()))
315322
yield sr
316323

317324
@pytest.fixture(scope='session')
@@ -321,7 +328,7 @@ def local_sr_on_hostA2(hostA2):
321328
assert len(srs) > 0, "a local SR is required on the pool's second host"
322329
# use the first local SR found
323330
sr = srs[0]
324-
logging.info(">> local SR on hostA2 present : %s" % sr.uuid)
331+
logging.info(">> local SR on hostA2 present: {} of type {}".format(sr.uuid, sr.get_type()))
325332
yield sr
326333

327334
@pytest.fixture(scope='session')
@@ -331,7 +338,7 @@ def local_sr_on_hostB1(hostB1):
331338
assert len(srs) > 0, "a local SR is required on the second pool's master"
332339
# use the first local SR found
333340
sr = srs[0]
334-
logging.info(">> local SR on hostB1 present : %s" % sr.uuid)
341+
logging.info(">> local SR on hostB1 present: {} of type {}".format(sr.uuid, sr.get_type()))
335342
yield sr
336343

337344
@pytest.fixture(scope='session')

0 commit comments

Comments
 (0)