Skip to content
This repository has been archived by the owner on Apr 7, 2022. It is now read-only.

[1LP][RFR] UCI code for RHV shouldn't be executed for <=5.11.4 #9975

Merged
merged 2 commits into from
Mar 10, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 18 additions & 16 deletions cfme/fixtures/v2v_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,20 @@ def vddk_url():

def get_conversion_data(appliance, target_provider):
if target_provider.one_of(RHEVMProvider):
if appliance.version < '5.11':
# Support for UCI hosts for RHV would be added in 5.11.5.
# So, this if block should be disabled until then.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove this comment @nachandr . Rest looks good 👍

if appliance.version >= '5.11.5':
resource_type = "ManageIQ::Providers::Redhat::InfraManager::Vm"
vm_key = conf.credentials[
target_provider.data["private-keys"]["engine-rsa"]["credentials"]]
auth_user = vm_key.username
private_key = vm_key.password
try:
hosts = target_provider.data["conversion_instances"]
except KeyError:
pytest.skip("No conversion host on provider")

else:
resource_type = "ManageIQ::Providers::Redhat::InfraManager::Host"
engine_key = conf.credentials[target_provider.data["ssh_creds"]]
auth_user = engine_key.username
Expand All @@ -230,17 +243,6 @@ def get_conversion_data(appliance, target_provider):
except KeyError:
pytest.skip("No conversion host on provider")

elif appliance.version > '5.10':
resource_type = "ManageIQ::Providers::Redhat::InfraManager::Vm"
vm_key = conf.credentials[
target_provider.data["private-keys"]["engine-rsa"]["credentials"]]
auth_user = vm_key.username
private_key = vm_key.password
try:
hosts = target_provider.data["conversion_instances"]
except KeyError:
pytest.skip("No conversion host on provider")

else:
resource_type = "ManageIQ::Providers::Openstack::CloudManager::Vm"
instance_key = conf.credentials[
Expand All @@ -265,7 +267,7 @@ def set_conversion_host_api(
"""
Setting conversion host for RHV and OSP provider via REST

Note: Support for using VM as UCI conversion hosts was added for RHV in 5.11.4.
Note: Support for using VM as UCI conversion hosts will be added for RHV in 5.11.5.
"""
vmware_ssh_private_key = None
vmware_vddk_package_url = None
Expand All @@ -286,9 +288,9 @@ def set_conversion_host_api(

for host in conversion_data["hosts"]:
conversion_entity = (
"hosts"
if target_provider.one_of(RHEVMProvider) and appliance.version < '5.11'
else "vms"
"vms"
if target_provider.one_of(RHEVMProvider) and appliance.version >= '5.11.5'
else "hosts"
)
host_id = (
getattr(appliance.rest_api.collections, conversion_entity).filter(
Expand Down