Skip to content

Commit 8782ae4

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 c37c64a commit 8782ae4

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
@@ -309,14 +309,21 @@ def host_no_ipv6(host):
309309
if is_ipv6(host.hostname_or_ip):
310310
pytest.skip(f"This test requires an IPv4 XCP-ng")
311311

312+
@pytest.fixture(scope="session")
313+
def shared_sr(host):
314+
sr = host.pool.first_shared_sr()
315+
assert sr, "No shared SR available on hosts"
316+
logging.info(">> Shared SR on host present: {} of type {}".format(sr.uuid, sr.get_type()))
317+
yield sr
318+
312319
@pytest.fixture(scope='session')
313320
def local_sr_on_hostA1(hostA1):
314321
""" A local SR on the pool's master. """
315322
srs = hostA1.local_vm_srs()
316323
assert len(srs) > 0, "a local SR is required on the pool's master"
317324
# use the first local SR found
318325
sr = srs[0]
319-
logging.info(">> local SR on hostA1 present : %s" % sr.uuid)
326+
logging.info(">> local SR on hostA1 present: {} of type {}".format(sr.uuid, sr.get_type()))
320327
yield sr
321328

322329
@pytest.fixture(scope='session')
@@ -326,7 +333,7 @@ def local_sr_on_hostA2(hostA2):
326333
assert len(srs) > 0, "a local SR is required on the pool's second host"
327334
# use the first local SR found
328335
sr = srs[0]
329-
logging.info(">> local SR on hostA2 present : %s" % sr.uuid)
336+
logging.info(">> local SR on hostA2 present: {} of type {}".format(sr.uuid, sr.get_type()))
330337
yield sr
331338

332339
@pytest.fixture(scope='session')
@@ -336,7 +343,7 @@ def local_sr_on_hostB1(hostB1):
336343
assert len(srs) > 0, "a local SR is required on the second pool's master"
337344
# use the first local SR found
338345
sr = srs[0]
339-
logging.info(">> local SR on hostB1 present : %s" % sr.uuid)
346+
logging.info(">> local SR on hostB1 present: {} of type {}".format(sr.uuid, sr.get_type()))
340347
yield sr
341348

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

0 commit comments

Comments
 (0)