Closed aravindavk closed 1 year ago
Cool will send fix to delete the status file for particular volume only if status complete: true
.
Guess this should work,
def status_file_check(rollback_volume)
workdir = "/var/lib/kadalu"
status_file = reb.status_file("fix-layout")
fix_layout_status_file_path = Path[workdir].join("rebalance-fix-layout-#{rollback_volume.not_nil!.distribute_groups[0].storage_units[0].path.gsub("/", "%2F")}.json")
if File.exists?(fix_layout_status_file_path)
data = MoanaTypes::FixLayoutRebalanceStatus.from_json(File.read(fix_layout_status_file_path))
FileUtils.rm(fix_layout_status_file_path) if data.complete
end
end
But as of now manage_services
node action is made to run on all unique nodes,
But adding this to that node action will add additional complexity of checking for status file in every node.
Before start of {fix-layout|migrate-data} rebalance, remove the status file. No need to check for the complete state.
https://github.com/kadalu/moana/blob/main/mgr/src/server/plugins/volume_utils.cr#L139
Change this id to match the status file path. https://github.com/kadalu/moana/blob/main/mgr/src/server/services/fix_layout.cr#L13
So that you can delete the status file as
elsif svc.name == "fixlayoutservice" || svc.name == "migratedataservice"
status_file = "/var/lib/kadalu/#{svc.id}.json"
FileUtils.rm(status_file) if File.exists?(status_file)
svc.start
Before starting the rebalance process(Fix layout or Migrate data), remove the status file because Rebalance process will not start if
complete: true
.Reproduce: