Skip to content

Commit

Permalink
Merge pull request ManageIQ#19870 from djberg96/default_kill_virtv2v_…
Browse files Browse the repository at this point in the history
…signal

Set the default signal to 'TERM' in ConversionHost#kill_virtv2v
  • Loading branch information
Fryguy authored Feb 24, 2020
2 parents 71bea22 + 03f02ab commit 3edab6d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/models/conversion_host.rb
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ def create_cutover_file(task_id)
# Kill a specific remote process over ssh, sending the specified +signal+, or 'TERM'
# if no signal is specified.
#
def kill_virtv2v(task_id, signal)
def kill_virtv2v(task_id, signal = 'TERM')
command = AwesomeSpawn.build_command_line("/usr/bin/podman", ["exec", "conversion-#{task_id}", "/usr/bin/killall", :s, signal, "virt-v2v"])
connect_ssh { |ssu| ssu.shell_exec(command, nil, nil, nil) }
true
Expand Down
4 changes: 2 additions & 2 deletions app/models/service_template_transformation_plan_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ def cutover
end
end

def kill_virtv2v
def kill_virtv2v(signal = 'TERM')
get_conversion_state

unless virtv2v_running?
Expand All @@ -279,7 +279,7 @@ def kill_virtv2v
end

_log.info("Killing conversion pod for task '#{id}'.")
conversion_host.kill_virtv2v(id)
conversion_host.kill_virtv2v(id, signal)
end

def virtv2v_running?
Expand Down
8 changes: 4 additions & 4 deletions spec/models/service_template_transformation_plan_task_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -232,13 +232,13 @@
end

it "returns false if if kill command failed" do
allow(conversion_host).to receive(:kill_virtv2v).with(task.id).and_return(false)
expect(task.kill_virtv2v).to eq(false)
allow(conversion_host).to receive(:kill_virtv2v).with(task.id, 'KILL').and_return(false)
expect(task.kill_virtv2v('KILL')).to eq(false)
end

it "returns true if if kill command succeeded" do
allow(conversion_host).to receive(:kill_virtv2v).with(task.id).and_return(true)
expect(task.kill_virtv2v).to eq(true)
allow(conversion_host).to receive(:kill_virtv2v).with(task.id, 'KILL').and_return(true)
expect(task.kill_virtv2v('KILL')).to eq(true)
end
end
end
Expand Down

0 comments on commit 3edab6d

Please sign in to comment.