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

upmap-remapped.py : Issues with python 3 #29

Open
gillarda opened this issue Jun 8, 2020 · 0 comments
Open

upmap-remapped.py : Issues with python 3 #29

gillarda opened this issue Jun 8, 2020 · 0 comments

Comments

@gillarda
Copy link

gillarda commented Jun 8, 2020

Hello,
First of all, thank you for this script !
I had a few issues running the script with python 3 on Centos 7.

$ python3 -V
Python 3.6.8
  1. Error loading remapped pgs
$ python3 scripts/upmap-remapped.py
Error loading remapped pgs

The output of subprocess.check_output is of type byte, so it needs to be decoded before being able to use split:

for line in subprocess.check_output(['ceph', 'osd', 'pool', 'ls', 'detail']).split('\n'):
  1. OSDS is not a list
    For the same reason, OSDS is byte and not list :
OSDS = subprocess.check_output(['ceph', 'osd', 'ls', '-f', 'json'])
  1. Harmful cast in valid_osds
    Casting osds to str is useless and breaks the lookup in :
def valid_osds(osds):
  valid = []
  for osd in osds:
    if str (osd) in OSDS:
      valid.append(osd)
  return valid

I'll submit a PR with the various fixes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant