Skip to content

Commit

Permalink
Merge pull request #19995 from fdupont-redhat/v2v_bz_1812685_2
Browse files Browse the repository at this point in the history
Allow overriding ESXi IP address with a custom attribute - Part 2

(cherry picked from commit 7601966)

https://bugzilla.redhat.com/show_bug.cgi?id=1812685
  • Loading branch information
agrare authored and simaishi committed Apr 13, 2020
1 parent 1800825 commit 8bc4cf6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/service_template_transformation_plan_task.rb
Expand Up @@ -361,7 +361,7 @@ def conversion_options_source_provider_vmwarews_ssh(storage)
:vm_name => URI::Generic.build(
:scheme => 'ssh',
:userinfo => 'root',
:host => source.host.ipaddress,
:host => source.host.miq_custom_get('TransformationIPAddress') || source.host.ipaddress,
:path => "/vmfs/volumes/#{Addressable::URI.escape(storage.name)}/#{Addressable::URI.escape(source.location)}"
).to_s,
:vm_uuid => source.uid_ems,
Expand Down
19 changes: 19 additions & 0 deletions spec/models/service_template_transformation_plan_task_spec.rb
Expand Up @@ -656,6 +656,25 @@
:daemonize => false
)
end

it "generates conversion options hash with host custom IP address" do
src_host.miq_custom_set('TransformationIPAddress', '192.168.254.1')
expect(task_1.conversion_options).to eq(
:vm_name => "ssh://root@192.168.254.1/vmfs/volumes/stockage%20r%C3%A9cent/#{src_vm_1.location}",
:vm_uuid => src_vm_1.uid_ems,
:conversion_host_uuid => conversion_host.resource.ems_ref,
:transport_method => 'ssh',
:rhv_url => "https://#{redhat_ems.hostname}/ovirt-engine/api",
:rhv_cluster => redhat_cluster.name,
:rhv_storage => redhat_storages.first.name,
:rhv_password => redhat_ems.authentication_password,
:source_disks => [src_disk_1.filename, src_disk_2.filename],
:network_mappings => task_1.network_mappings,
:install_drivers => true,
:insecure_connection => true,
:daemonize => false
)
end
end
end

Expand Down

0 comments on commit 8bc4cf6

Please sign in to comment.