diff --git a/lib/host.py b/lib/host.py index 3a15e564f..a5b5a21bd 100644 --- a/lib/host.py +++ b/lib/host.py @@ -665,8 +665,12 @@ def main_sr_uuid(self): self.xe('sr-list', {'host': hostname, 'content-type': 'user', 'minimal': 'true'}), ',' ) - assert local_sr_uuids, f"DEFAULT_SR=='local' so there must be a local SR on host {self}" - sr_uuid = local_sr_uuids[0] + # We don't want a SR added by the test, so choose one that already existed + pre_existing_local_sr_uuids = sorted(set(self.pool.pre_existing_sr_uuids) & set(local_sr_uuids)) + assert pre_existing_local_sr_uuids, ( + f"DEFAULT_SR=='local' so there must be a pre-existing local SR on host {self}" + ) + sr_uuid = pre_existing_local_sr_uuids[0] elif DEFAULT_SR == 'default': sr_uuid = self.pool.param_get('default-SR') assert sr_uuid, f"DEFAULT_SR='default' so there must be a default SR on the pool of host {self}" diff --git a/lib/pool.py b/lib/pool.py index 63da0956a..da0febeb2 100644 --- a/lib/pool.py +++ b/lib/pool.py @@ -35,6 +35,7 @@ def __init__(self, master_hostname_or_ip: HostAddress) -> None: self.hosts.append(host) self.uuid = self.master.xe('pool-list', minimal=True) self.saved_uefi_certs: Optional[Dict[str, Any]] = None + self.pre_existing_sr_uuids = safe_split(self.master.xe('sr-list', {'minimal': 'true'}), ',') def param_get(self, param_name, key=None, accept_unknown_key=False): return _param_get(self.master, Pool.xe_prefix, self.uuid, param_name, key, accept_unknown_key)