Skip to content

Improve LinstorSR.py to handle thick SR creation #85

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: 3.2.3-8.3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion drivers/LinstorSR.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ def create(self, uuid, size) -> None:
opterr='LINSTOR SR must be unique in a pool'
)

online_hosts = util.get_online_hosts(self.session)
online_hosts = util.get_enabled_hosts(self.session)
if len(online_hosts) < len(host_adresses):
raise xs_errors.XenError(
'LinstorSRCreate',
Expand Down
10 changes: 10 additions & 0 deletions drivers/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,16 @@ def get_slaves_attached_on(session, vdi_uuids):
master_ref = get_this_host_ref(session)
return [x for x in host_refs if x != master_ref]

def get_enabled_hosts(session):
"""
Returns a list of host refs that are enabled in the pool.
"""
enabled_hosts = []
hosts = session.xenapi.host.get_all_records()
for host_ref, host_rec in hosts.items():
if host_rec.get("enabled", True):
enabled_hosts.append(host_ref)
return enabled_hosts

def get_online_hosts(session):
online_hosts = []
Expand Down
Loading