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

Commit fa06359

Browse files
authored
[1LP][RFR] Update set_conversion_host_api() to use CA certs (#10047)
* Update set_conversion_host_api() to use CA certs * Update set_conversion_host_api() to use CA certs * Update set_conversion_host_api() to use CA certs * Update set_conversion_host_api() to use CA certs * Update set_conversion_host_api() to use CA certs * Update set_conversion_host_api() to use CA certs * Update set_conversion_host_api() to use CA certs * Update set_conversion_host_api() to use CA certs
1 parent 0a87295 commit fa06359

2 files changed

Lines changed: 41 additions & 16 deletions

File tree

cfme/fixtures/v2v_fixtures.py

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -213,28 +213,37 @@ def vddk_url():
213213

214214

215215
def get_conversion_data(appliance, target_provider):
216+
# SSL certificate verification is required while configuring conversion hosts only if RHV-M
217+
# uses SSL. It's not related to the SSL certificate verification in the provider configuration
218+
# and there is no way to link them because they are not used in the same way.
219+
tls_ca_certs = None
220+
216221
if target_provider.one_of(RHEVMProvider):
222+
engine_key = conf.credentials[target_provider.data["ssh_creds"]]
223+
ssh_client = ssh.SSHClient(
224+
hostname=target_provider.hostname,
225+
username=engine_key.username,
226+
password=engine_key.password,
227+
)
228+
217229
# Support for UCI hosts for RHV would be added in 5.11.6.
218230
if appliance.version >= '5.11.6':
231+
tls_ca_certs = ssh_client.run_command(
232+
"cat /etc/pki/ovirt-engine/apache-ca.pem").output
219233
resource_type = "ManageIQ::Providers::Redhat::InfraManager::Vm"
220234
vm_key = conf.credentials[
221235
target_provider.data["private-keys"]["engine-rsa"]["credentials"]]
222236
auth_user = vm_key.username
223-
private_key = vm_key.password
237+
private_key = ssh_client.run_command(
238+
"cat /root/.ssh/id_rsa").output
224239
try:
225240
hosts = target_provider.data["conversion_instances"]
226241
except KeyError:
227242
pytest.skip("No conversion host on provider")
228243

229244
else:
230245
resource_type = "ManageIQ::Providers::Redhat::InfraManager::Host"
231-
engine_key = conf.credentials[target_provider.data["ssh_creds"]]
232246
auth_user = engine_key.username
233-
ssh_client = ssh.SSHClient(
234-
hostname=target_provider.hostname,
235-
username=engine_key.username,
236-
password=engine_key.password,
237-
)
238247
private_key = ssh_client.run_command(
239248
"cat /etc/pki/ovirt-engine/keys/engine_id_rsa").output
240249
try:
@@ -257,7 +266,8 @@ def get_conversion_data(appliance, target_provider):
257266
"resource_type": resource_type,
258267
"private_key": private_key,
259268
"auth_user": auth_user,
260-
"hosts": hosts
269+
"hosts": hosts,
270+
"tls_ca_certs": tls_ca_certs
261271
}
262272

263273

@@ -294,13 +304,23 @@ def set_conversion_host_api(
294304
host_id = (
295305
getattr(appliance.rest_api.collections, conversion_entity).filter(
296306
Q.from_dict({"name": host})).resources[0].id)
297-
response = appliance.rest_api.collections.conversion_hosts.action.create(
298-
resource_id=host_id,
299-
resource_type=conversion_data["resource_type"],
300-
vmware_vddk_package_url=vmware_vddk_package_url,
301-
vmware_ssh_private_key=vmware_ssh_private_key,
302-
conversion_host_ssh_private_key=conversion_data["private_key"],
303-
auth_user=conversion_data["auth_user"])[0]
307+
if target_provider.one_of(RHEVMProvider) and appliance.version >= '5.11.6':
308+
response = appliance.rest_api.collections.conversion_hosts.action.create(
309+
resource_id=host_id,
310+
resource_type=conversion_data["resource_type"],
311+
vmware_vddk_package_url=vmware_vddk_package_url,
312+
vmware_ssh_private_key=vmware_ssh_private_key,
313+
conversion_host_ssh_private_key=conversion_data["private_key"],
314+
tls_ca_certs=conversion_data["tls_ca_certs"],
315+
auth_user=conversion_data["auth_user"])[0]
316+
else:
317+
response = appliance.rest_api.collections.conversion_hosts.action.create(
318+
resource_id=host_id,
319+
resource_type=conversion_data["resource_type"],
320+
vmware_vddk_package_url=vmware_vddk_package_url,
321+
vmware_ssh_private_key=vmware_ssh_private_key,
322+
conversion_host_ssh_private_key=conversion_data["private_key"],
323+
auth_user=conversion_data["auth_user"])[0]
304324
response.reload()
305325
wait_for(
306326
lambda: response.task.state == "Finished",

cfme/infrastructure/virtual_machines.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1521,7 +1521,12 @@ def step(self, *args, **kwargs):
15211521
entity_item.click()
15221522

15231523
def resetter(self, *args, **kwargs):
1524-
self.view.toolbar.reload.click()
1524+
# https://bugzilla.redhat.com/show_bug.cgi?id=1821974#c5
1525+
# History & Refresh buttons have been removed from explorer screens on upstream only.
1526+
if self.obj.appliance.is_downstream:
1527+
self.view.toolbar.reload.click()
1528+
else:
1529+
pass
15251530

15261531

15271532
@navigator.register(InfraTemplate, 'ArchiveDetails')

0 commit comments

Comments
 (0)