Forums

Home / Forums

You need to log in to create posts and topics. Login · Register

node_manage_disks.py

Used the command line to add some disks to the pool in a newly built 3.0.1 cluster and python is reporting a warning on the script

node_manage_disks.py:222 SyntaxWarning: "is not" with a literal. did you mean "!="?

if journal_partition is not "no_journal":

the script appears to be working beyond that (was adding disks that didnt have journals so not sure if that warning breaks journal creation)

What's the syntax to add an osd from the cli?

Thanks

Not sure if these have changed recently or not, when I wrote our internal KB article on the process the options were as follows. The script has some limited level of "help" if you run it without any inputs, reading through the script also helped to figure some of it out.

The scripts are in the folder: /opt/petasan/scripts/admin

You have to run the scripts on the node that the disk is physically in, you cant run the scripts on say node#1 and try to add disks to the pool that are in node#3. In the scripts where its asking for [DiskName] the name of the disk is as it appears in the /dev folder, for example if a drive is "/dev/sda" you would use "sda"

Set disk as a journal:

  • Command: node_manage_disks.py add-journal -disk_name [DiskName]
  • Example: node_manage_disks.py add-journal -disk_name nvme0n1

Remove disk as a journal:

  • Command: node_manage_disks.py delete-journal -disk_name [DiskName]
  • Example: node_manage_disks.py delete-journal -disk_name nvme0n1
  • Notes: This command will only work if all OSDs being backed by this journal have been deleted first

Set disk as a cache:

  • Command: node_manage_disks.py add-cache -disk_name [DiskName] -partitions #
  • Example: node_manage_disks.py add-cache -disk_name nvme0n1 -partitions 4
  • Notes: The partition count is the max number of OSDs that can be cached by the device, the max recommended value for an SSD is 4, the max recommended for an NVME is 8

Remove disk as a cache:

  • Command: node_manage_disks.py delete-cache -disk_name [DiskName]
  • Example: node_manage_disks.py delete-cache -disk_name nvme0n1
  • Notes: This command will only work if all OSDs being backed by this cache have been deleted first

Add a disk as an OSD:

  • Command: node_manage_disks.py add-osd -disk_name [DiskName]
  • Example: node_manage_disks.py add-osd -disk_name sda
  • Notes: Command has extra options to enable journal, caching, or both on the disk, you can combine the cache and journal flags on the same command line to implement both cache and journaling, you will need to setup the cache and journal disks before attempting to add the OSD
    • Journaling:
      • Command Switches: -journal [DiskName or auto]
      • Example: -journal nvme0n1
      • Example: -journal auto
      • Note: If using the auto flag instead of a specific journal disk it will attempt to find a journal that has available space and use it first, if you use a specific disk name it will force it to use that journal and adding the OSD will fail if there is not sufficient space
    • Caching:
      • Command Switches: -cache [DiskName or auto] -cache_type writecache
      • Example: -cache nvme0n1 -cache_type writecache
      • Example: -cache auto -cache_type writecache
      • Note: if using the auto flag instead of a specific cache disk it will attempt to find a cache disk that has available space and use it first, if you use a specific disk name it will force it to use that cache and adding the OSD will fail if there is not sufficient partitions available

Delete an OSD disk:

  • Command: node_manage_disks.py delete-osd -disk_name [DiskName] -id [OSD#]
  • Example: node_manage_disks.py delete-osd -disk_name sda -id 2