Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@harshavardhana
Created January 14, 2020 00:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save harshavardhana/41f6329ac999ab4e11acf79131523aad to your computer and use it in GitHub Desktop.
Save harshavardhana/41f6329ac999ab4e11acf79131523aad to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
import argparse
# initiate the parser
parser = argparse.ArgumentParser()
parser.add_argument("-V", "--version", help="0.0.1", action="store_true")
parser.add_argument("--total_disks", "-t", type=int, help="set total disks in a MinIO deployment")
parser.add_argument("--storage-parity", "-p", type=int, help="set total partity per sets")
# read arguments from the command line
args = parser.parse_args()
# check for --version or -V
if args.version:
print("this is myprogram version 0.1")
if args.total_disks:
total_disks = args.total_disks
ec = None
if total_disks % 16 == 0:
ec = 16
elif total_disks % 14 == 0:
ec = 14
elif total_disks % 12 == 0:
ec = 12
elif total_disks % 10 == 0:
ec = 10
elif total_disks % 8 == 0:
ec = 8
elif total_disks % 6 == 0:
ec = 6
elif total_disks % 4 == 0:
ec = 4
else:
raise Exception("invalid number of total disks")
print("Number of sets %s", total_disks/ec)
print("Drives per set %s", ec)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment