Skip to content

Commit

Permalink
Address review comments 1
Browse files Browse the repository at this point in the history
Signed-off-by: Shree Vatsa N <[email protected]>
  • Loading branch information
vatsa287 committed Jan 17, 2023
1 parent 26e40b8 commit 079bc7e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 32 deletions.
31 changes: 1 addition & 30 deletions mgr/src/server/plugins/volume_utils.cr
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def restart_shd_service_and_manage_rebalance_services(services, action = "start"
if svc.name == "shdservice"
svc.restart
elsif svc.name == "fixlayoutservice" || svc.name == "migratedataservice"
status_file_path = "/var/lib/kadalu/#{svc.id.gsub("/", "%2F")}.json"
status_file_path = "/var/lib/kadalu/#{svc.id}.json"
FileUtils.rm(status_file_path) if File.exists?(status_file_path)
if action == "start"
svc.start
Expand Down Expand Up @@ -549,32 +549,3 @@ def add_migrate_data_service(services, pool_name, volume_name, node, storage_uni

services
end

def handle_volume_rebalance_start_stop(data, action)
services, volfiles, _ = VolumeRequestToNode.from_json(data)

if action == "start" && !volfiles[GlobalConfig.local_node.id]?.nil?
Dir.mkdir_p(Path.new(GlobalConfig.workdir, "volfiles"))
volfiles[GlobalConfig.local_node.id].each do |volfile|
File.write(Path.new(GlobalConfig.workdir, "volfiles", "#{volfile.name}.vol"), volfile.content)
end
end

unless services[GlobalConfig.local_node.id]?.nil?
# TODO: Hard coded path change?
Dir.mkdir_p("/var/log/kadalu")
Dir.mkdir_p("/run/kadalu")
services[GlobalConfig.local_node.id].each do |service|
svc = Service.from_json(service.to_json)
if svc.name == "migratedataservice"
if action == "start"
svc.start
else
svc.stop
end
end
end
end

NodeResponse.new(true, "")
end
2 changes: 1 addition & 1 deletion mgr/src/server/services/fix_layout.cr
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class FixLayoutService < Service
@create_pid_file = true

@path = PROGRAM_NAME == "kadalu" ? PROGRAM_NAME : Path[PROGRAM_NAME].expand.to_s
@id = "rebalance-fix-layout-#{storage_unit.path}"
@id = "rebalance-fix-layout-#{storage_unit.path.gsub("/", "%2F")}"
@pid_file = "/run/kadalu/#{@id}.pid"
@args = [
"_rebalance", "--fix-layout",
Expand Down
2 changes: 1 addition & 1 deletion mgr/src/server/services/migrate_data.cr
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class MigrateDataService < Service
@create_pid_file = true

@path = PROGRAM_NAME == "kadalu" ? PROGRAM_NAME : Path[PROGRAM_NAME].expand.to_s
@id = "rebalance-migrate-data-#{storage_unit.path}"
@id = "rebalance-migrate-data-#{storage_unit.path.gsub("/", "%2F")}"
@pid_file = "/run/kadalu/#{@id}.pid"
@args = [
"_rebalance", "--migrate-data",
Expand Down

0 comments on commit 079bc7e

Please sign in to comment.