ubicloud/rhizome/host/bin/setup-spdk
Hadi Moshayedi 45d4f3d742 Allow configurable cpu count for SPDK in rhizome.
Previously we always used 2 cpus for SPDK. In larger machines we may
want to use more cpus, so we need to make this configurable.
2024-03-28 11:05:33 -07:00

37 lines
818 B
Ruby
Executable file

#!/bin/env ruby
# frozen_string_literal: true
require_relative "../../common/lib/util"
require_relative "../lib/spdk_path"
require_relative "../lib/spdk_setup"
require "fileutils"
unless (verb = ARGV.shift)
puts "expected verb as argument"
exit 1
end
unless (version = ARGV.shift)
puts "expected version as argument"
exit 1
end
spdk_setup = SpdkSetup.new(version)
case verb
when "install"
# use a default of 2 for backward compatibility
cpu_count = ARGV.shift || 2
spdk_setup.install_package
spdk_setup.create_hugepages_mount
spdk_setup.create_conf
spdk_setup.create_service(cpu_count: cpu_count.to_i)
spdk_setup.enable_services
when "start"
spdk_setup.start_services
when "verify"
spdk_setup.verify_spdk
when "remove"
spdk_setup.stop_and_remove_services
spdk_setup.remove_paths
end