Skip to content
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

Fixed osds_out/osds_down count + ceph iscsi GW reboot #2

Open
wants to merge 1 commit into
base: master
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
12 changes: 6 additions & 6 deletions stress_test_ceph_vmware/cephops.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,21 @@ def unset_noup(self):

def get_down_osds(self):
data, _ = self.client.run_cmd('ceph osd tree -f json')
down_osds = []
self.down_osds = []
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not neccessary. See L20: if this file

The constructor of this class is calling

       self.down_osds = self.get_down_osds()
       self.out_osds = self.get_out_osds()

which makes the assignment of self.down_osds redundant.

If you encountered that down_osds is not populated you might the root cause in this function.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the issue that I saw was that the self.out_osds was populated initially through the constructor but when the script is marking some disk out it doesn't get updated and that causes removing disks ignoring the threshold which in the end breaks the ceph cluster. I first checked the get_out_osds() function and it looks good.

for node_osd in ast.literal_eval(data)['nodes']:
if node_osd.get('type') == 'osd' and 'osd' in node_osd.get('name'):
if node_osd.get('status') == 'down':
down_osds.append(node_osd.get('id'))
return down_osds
self.down_osds.append(node_osd.get('id'))
return self.down_osds

def get_out_osds(self):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here.

data, _ = self.client.run_cmd('ceph osd tree -f json')
out_osds = []
self.out_osds = []
for node_osd in ast.literal_eval(data)['nodes']:
if node_osd.get('type') == 'osd' and 'osd' in node_osd.get('name'):
if node_osd.get('reweight') != 1.0:
out_osds.append(node_osd.get('id'))
return out_osds
self.out_osds.append(node_osd.get('id'))
return self.out_osds

@property
def max_down_osds(self):
Expand Down
5 changes: 2 additions & 3 deletions stress_test_ceph_vmware/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ def __init__(self):
self.vmwareops = VMwareOps()
self.ops.get_vm_list()

if len(self.gateways) < 2:
self.reboot_allowed = False
if len(self.gateways) >= 2:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reverted logic makes more sense here. Good catch

self.reboot_allowed = True
if self.force_reboot:
self.reboot_allowed = True

Expand Down Expand Up @@ -103,7 +103,6 @@ def check_thresholds(self):
while len(self.ops.vms) > self.max_vms:
log.info(Fore.YELLOW + "VM count rose over the configured threshold. Removing VMs")
self.destroy_vms(count=1)

if self.cephops.osd_out_count > self.cephops.max_down_osds:
log.info(Fore.YELLOW + "Down OSDs count dropped below the configured thereshold. Adding back in.")
for osd_id in self.cephops.out_osds:
Expand Down