From c9f9bf7def0efa819e3c60d4c3c3f3c2237ba1f9 Mon Sep 17 00:00:00 2001 From: Juan Hernandez Date: Wed, 22 Mar 2017 19:51:55 +0100 Subject: [PATCH] Drop support for oVirt /api, always use /ovirt-engine/api Versions of oVirt 3.4 and older only supported the /api path for access to the API. Since version 3.5 /ovirt-engine/api is supported as well, and /api is deprecated. In version 4.0 /api was removed completely. The provider has supported both paths, which caused confusion and problems during upgrades. As we no longer need to support oVirt 3.4 or older, that support can now be removed. That is what this patch does. The path will be still saved to the 'path' column of the 'endpoints' table, but not used at all. https://bugzilla.redhat.com/1427653 --- .../redhat/infra_manager/api_integration.rb | 6 +- .../redhat/infra_manager/refresher_3_0.yml | 2775 ++++++++------- .../redhat/infra_manager/refresher_3_1.yml | 3067 ++++++++--------- .../refresher_after_migration.yml | 78 +- .../refresher_before_migration.yml | 226 +- .../infra_manager/refresher_target_new_vm.yml | 569 ++- .../infra_manager/refresher_target_vm.yml | 569 ++- .../redhat/infra_manager/vm_fetch_disks.yml | 45 +- .../infra_manager/vm_fetch_no_disks.yml | 37 +- 9 files changed, 3582 insertions(+), 3790 deletions(-) diff --git a/app/models/manageiq/providers/redhat/infra_manager/api_integration.rb b/app/models/manageiq/providers/redhat/infra_manager/api_integration.rb index 24ff4582a84..6eea67d2d66 100644 --- a/app/models/manageiq/providers/redhat/infra_manager/api_integration.rb +++ b/app/models/manageiq/providers/redhat/infra_manager/api_integration.rb @@ -19,12 +19,10 @@ def connect(options = {}) unless options[:skip_supported_api_validation] || supports_the_api_version?(version) raise "version #{version} of the api is not supported by the provider" end - # If there is API path stored in the endpoints table and use it: - path = options[:path] || default_endpoint.path - _log.info("Using stored API path '#{path}'.") unless path.blank? server = options[:ip] || address port = options[:port] || self.port + path = options[:path] || '/ovirt-engine/api' username = options[:user] || authentication_userid(options[:auth_type]) password = options[:pass] || authentication_password(options[:auth_type]) service = options[:service] || "Service" @@ -47,7 +45,7 @@ def connect(options = {}) connection = self.class.public_send(connect_method, server, port, path, username, password, service) # Copy the API path to the endpoints table: - default_endpoint.path = version == 4 ? '/ovirt-engine/api' : connection.api_path + default_endpoint.path = path connection end diff --git a/spec/vcr_cassettes/manageiq/providers/redhat/infra_manager/refresher_3_0.yml b/spec/vcr_cassettes/manageiq/providers/redhat/infra_manager/refresher_3_0.yml index 8f562fa4453..d0643e8d5b3 100644 --- a/spec/vcr_cassettes/manageiq/providers/redhat/infra_manager/refresher_3_0.yml +++ b/spec/vcr_cassettes/manageiq/providers/redhat/infra_manager/refresher_3_0.yml @@ -2,18 +2,7 @@ http_interactions: - request: method: get - uri: https://192.168.252.231:8443/api - response: - status: - code: 401 - message: Unauthorized - headers: - WWW-Authenticate: - - Basic realm="RESTAPI" - recorded_at: Tue, 26 Apr 2016 10:00:00 GMT -- request: - method: get - uri: https://evm%40manageiq.com:password@192.168.252.231:8443/api + uri: https://evm%40manageiq.com:password@192.168.252.231:8443/ovirt-engine/api body: encoding: US-ASCII string: '' @@ -42,20 +31,20 @@ http_interactions: X-Powered-By: - Servlet 2.5; JBoss-5.0/JBossWeb-2.1 Link: - - ; rel=capabilities,; - rel=clusters,; rel=clusters/search,; - rel=datacenters,; - rel=datacenters/search,; rel=events,; - rel=events/search,; rel=hosts,; - rel=hosts/search,; rel=networks,; - rel=roles,; rel=storagedomains,; - rel=storagedomains/search,; rel=tags,; - rel=templates,; - rel=templates/search,; rel=users,; - rel=users/search,; rel=groups,; - rel=groups/search,; rel=domains,; - rel=vmpools,; rel=vmpools/search,; - rel=vms,; rel=vms/search + - ; rel=capabilities,; + rel=clusters,; rel=clusters/search,; + rel=datacenters,; + rel=datacenters/search,; rel=events,; + rel=events/search,; rel=hosts,; + rel=hosts/search,; rel=networks,; + rel=roles,; rel=storagedomains,; + rel=storagedomains/search,; rel=tags,; + rel=templates,; + rel=templates/search,; rel=users,; + rel=users/search,; rel=groups,; + rel=groups/search,; rel=domains,; + rel=vmpools,; rel=vmpools/search,; + rel=vms,; rel=vms/search Content-Type: - application/xml Content-Length: @@ -65,25 +54,25 @@ http_interactions: body: encoding: US-ASCII string: ! "\n\n - \ \n \n \n - \ \n \n \n - \ \n - \ \n \n \n - \ \n \n \n - \ \n \n - \ \n - \ \n \n \n - \ \n \n \n - \ \n - \ \n \n - \ \n \n - \ \n + \ \n \n \n + \ \n \n \n + \ \n + \ \n \n \n + \ \n \n \n + \ \n \n + \ \n + \ \n \n \n + \ \n \n \n + \ \n + \ \n \n + \ \n \n + \ \n \ \n \n Red Hat Enterprise Virtualization\n Red Hat\n \n \n @@ -96,7 +85,7 @@ http_interactions: recorded_at: Tue, 07 Oct 2014 17:58:28 GMT - request: method: get - uri: https://evm%40manageiq.com:password@192.168.252.231:8443/api/clusters + uri: https://evm%40manageiq.com:password@192.168.252.231:8443/ovirt-engine/api/clusters body: encoding: US-ASCII string: '' @@ -133,52 +122,52 @@ http_interactions: body: encoding: US-ASCII string: ! "\n\n - \ \n - \ Cluster1-iSCSI\n \n - \ \n + \ \n + \ Cluster1-iSCSI\n \n + \ \n \ \n \n \n + href=\"/ovirt-engine/api/datacenters/199560d0-9b83-4212-b2a1-077e1b4371af\"/>\n \n \ \n \n \ true\n \n \ \n \n \n \n migrate\n \ \n \n \n Cluster2\n - \ \n - \ \n + href=\"/ovirt-engine/api/clusters/40c1c666-e919-11e0-9c6b-005056af0085\">\n Cluster2\n + \ \n + \ \n \ \n \n \n + href=\"/ovirt-engine/api/datacenters/eb5592d2-ce76-11e0-a703-005056af0085\"/>\n \n \ \n \n \ true\n \n \ \n \n \n \n do_not_migrate\n \ \n \n \n DC2Cluster1\n - \ \n - \ \n + href=\"/ovirt-engine/api/clusters/d373fcee-e91a-11e0-83d7-005056af0085\">\n DC2Cluster1\n + \ \n + \ \n \ \n \n \n + href=\"/ovirt-engine/api/datacenters/cb50d90a-f585-4d17-a524-a577a97da928\"/>\n \n \ \n \n \ true\n \n \ \n \n \n \n migrate\n \ \n \n \n DC2-iSCSI\n - \ \n - \ \n + href=\"/ovirt-engine/api/clusters/40acd32e-4ce6-11e1-8f17-005056af0085\">\n DC2-iSCSI\n + \ \n + \ \n \ \n \n \n + href=\"/ovirt-engine/api/datacenters/cb50d90a-f585-4d17-a524-a577a97da928\"/>\n \n \ \n \n \ true\n \n \ \n \n \n \n migrate\n \ \n \n \n Default\n + href=\"/ovirt-engine/api/clusters/99408929-82cf-4dc7-a532-9d998063fa95\">\n Default\n \ The default server cluster\n \n - \ \n + rel=\"networks\" href=\"/ovirt-engine/api/clusters/99408929-82cf-4dc7-a532-9d998063fa95/networks\"/>\n + \ \n \ \n \n \n + href=\"/ovirt-engine/api/datacenters/eb5592d2-ce76-11e0-a703-005056af0085\"/>\n \n \ \n \n \ true\n \n \ \n \n \n\n - \ \n + \ \n \ test\n \n \n \n false\n \n non_operational\n \ \n \n \n rhevm\n + href=\"/ovirt-engine/api/networks/00000000-0000-0000-0000-000000000009\">\n rhevm\n \ Management Network\n \n + id=\"eb5592d2-ce76-11e0-a703-005056af0085\" href=\"/ovirt-engine/api/datacenters/eb5592d2-ce76-11e0-a703-005056af0085\"/>\n \ false\n \n operational\n \ \n \n \n rhevm\n + href=\"/ovirt-engine/api/networks/41f0f0c6-dc66-4b47-9f60-bd0f68318e79\">\n rhevm\n \ Management Network\n \n + id=\"199560d0-9b83-4212-b2a1-077e1b4371af\" href=\"/ovirt-engine/api/datacenters/199560d0-9b83-4212-b2a1-077e1b4371af\"/>\n \ false\n \n operational\n \ \n \n \n temp\n - \ \n + href=\"/ovirt-engine/api/networks/2e61e550-84e1-4db4-b6ba-270dcd8389a7\">\n temp\n + \ \n \ false\n \n non_operational\n \ \n \n \n rhevm\n + href=\"/ovirt-engine/api/networks/00000000-0000-0000-0000-000000000009\">\n rhevm\n \ Management Network\n \n + id=\"eb5592d2-ce76-11e0-a703-005056af0085\" href=\"/ovirt-engine/api/datacenters/eb5592d2-ce76-11e0-a703-005056af0085\"/>\n \ false\n \n operational\n \ \n \n \n rhevm\n + href=\"/ovirt-engine/api/networks/2f17d722-a330-4861-959e-699af75ff608\">\n rhevm\n \ Management Network\n \n + id=\"cb50d90a-f585-4d17-a524-a577a97da928\" href=\"/ovirt-engine/api/datacenters/cb50d90a-f585-4d17-a524-a577a97da928\"/>\n \ false\n \n operational\n \ \n \n \n iSCSI\n + href=\"/ovirt-engine/api/networks/674d7bb5-15de-4ac8-b6d7-3ff935f041fc\">\n iSCSI\n \ iSCSI network\n \n false\n + href=\"/ovirt-engine/api/datacenters/cb50d90a-f585-4d17-a524-a577a97da928\"/>\n false\n \ \n operational\n \n \ \n\n" http_version: recorded_at: Tue, 07 Oct 2014 17:58:29 GMT - request: method: get - uri: https://evm%40manageiq.com:password@192.168.252.231:8443/api/storagedomains?search=sortby%20name%20asc%20page%201 + uri: https://evm%40manageiq.com:password@192.168.252.231:8443/ovirt-engine/api/storagedomains?search=sortby%20name%20asc%20page%201 body: encoding: US-ASCII string: '' @@ -345,43 +334,43 @@ http_interactions: body: encoding: US-ASCII string: ! "\n\n - \ \n - \ export\n \n - \ \n - \ \n + \ \n + \ export\n \n + \ \n + \ \n \ export\n \n unattached\n \ \n false\n \n nfs\n \
10.10.1.39
\n /srv/export\n \
\n 41875931136\n 10737418240\n \ 0\n v1\n \
\n \n Export\n - \ \n - \ \n - \ \n + href=\"/ovirt-engine/api/storagedomains/f291819d-6f09-4a5b-9e48-0bc40898362b\">\n Export\n + \ \n + \ \n + \ \n \ export\n \n unattached\n \ \n false\n \n nfs\n \
192.168.252.65
\n /srv/export\n \
\n 51539607552\n 11811160064\n \ 0\n v1\n \
\n \n HostNFS\n - \ \n + href=\"/ovirt-engine/api/storagedomains/65ca9577-0d95-4909-8532-4c45201fbfe4\">\n HostNFS\n + \ \n \ data\n true\n \n \ nfs\n
192.168.252.119
\n \ /srv/nfs\n
\n 69793218560\n \ 98784247808\n 532575944704\n \ v1\n
\n \n - \ NFS-ISO-Domain\n \n - \ \n + id=\"298906e7-e1a8-446f-85e9-dc894d0e284b\" href=\"/ovirt-engine/api/storagedomains/298906e7-e1a8-446f-85e9-dc894d0e284b\">\n + \ NFS-ISO-Domain\n \n + \ \n \ iso\n false\n \n \ nfs\n
192.168.252.231
\n \ /srv/nfs\n
\n 11811160064\n \ 45097156608\n 0\n v1\n \
\n \n StarM1RHEV-1\n - \ \n + href=\"/ovirt-engine/api/storagedomains/6efaa0f3-d832-4e8f-846f-aacdc974e6d0\">\n StarM1RHEV-1\n + \ \n \ data\n true\n \n \ iscsi\n \n \ \n
10.1.1.202
\n @@ -394,8 +383,8 @@ http_interactions: \ 75161927680\n 134217728000\n \ 201863462912\n v2\n \
\n \n StarM1-RHEVM1\n - \ \n + href=\"/ovirt-engine/api/storagedomains/40f45969-31e9-4db6-9c9c-9a683c3755aa\">\n StarM1-RHEVM1\n + \ \n \ data\n true\n \n \ iscsi\n \n \ \n
10.1.1.202
\n @@ -412,7 +401,7 @@ http_interactions: recorded_at: Tue, 07 Oct 2014 17:58:29 GMT - request: method: get - uri: https://evm%40manageiq.com:password@192.168.252.231:8443/api/storagedomains?search=sortby%20name%20asc%20page%202 + uri: https://evm%40manageiq.com:password@192.168.252.231:8443/ovirt-engine/api/storagedomains?search=sortby%20name%20asc%20page%202 body: encoding: US-ASCII string: '' @@ -457,7 +446,7 @@ http_interactions: recorded_at: Tue, 07 Oct 2014 17:58:29 GMT - request: method: get - uri: https://evm%40manageiq.com:password@192.168.252.231:8443/api/datacenters + uri: https://evm%40manageiq.com:password@192.168.252.231:8443/ovirt-engine/api/datacenters body: encoding: US-ASCII string: '' @@ -494,28 +483,28 @@ http_interactions: body: encoding: US-ASCII string: ! "\n\n - \ \n + \ \n \ DC2\n \n \n - \ \n + rel=\"storagedomains\" href=\"/ovirt-engine/api/datacenters/cb50d90a-f585-4d17-a524-a577a97da928/storagedomains\"/>\n + \ \n \ iscsi\n v2\n \ \n \n \ \n \n \ \n maintenance\n \n \ \n \n DC-iSCSI\n + href=\"/ovirt-engine/api/datacenters/199560d0-9b83-4212-b2a1-077e1b4371af\">\n DC-iSCSI\n \ \n \n - \ \n + href=\"/ovirt-engine/api/datacenters/199560d0-9b83-4212-b2a1-077e1b4371af/storagedomains\"/>\n + \ \n \ iscsi\n v2\n \ \n \n \ \n \n \ \n not_operational\n \n \ \n \n Default\n + href=\"/ovirt-engine/api/datacenters/eb5592d2-ce76-11e0-a703-005056af0085\">\n Default\n \ The default Data Center\n \n - \ \n + rel=\"storagedomains\" href=\"/ovirt-engine/api/datacenters/eb5592d2-ce76-11e0-a703-005056af0085/storagedomains\"/>\n + \ \n \ nfs\n v1\n \ \n \n \ \n \n @@ -525,7 +514,7 @@ http_interactions: recorded_at: Tue, 07 Oct 2014 17:58:29 GMT - request: method: get - uri: https://evm%40manageiq.com:password@192.168.252.231:8443/api/hosts?search=sortby%20name%20asc%20page%201 + uri: https://evm%40manageiq.com:password@192.168.252.231:8443/ovirt-engine/api/hosts?search=sortby%20name%20asc%20page%201 body: encoding: US-ASCII string: '' @@ -562,24 +551,24 @@ http_interactions: body: encoding: US-ASCII string: ! "\n\n - \ \n + \ \n \ rhelvirt.manageiq.com\n \n \n - \ \n - \ \n - \ \n - \ \n - \ \n - \ \n - \ \n - \ \n \n - \ \n - \ \n - \ \n - \ \n + rel=\"install\" href=\"/ovirt-engine/api/hosts/ca389dbc-2054-11e1-9241-005056af0085/install\"/>\n + \ \n + \ \n + \ \n + \ \n + \ \n + \ \n + \ \n + \ \n \n + \ \n + \ \n + \ \n + \ \n \
192.168.252.119
\n \n non_responsive\n \ \n \n 54321\n + href=\"/ovirt-engine/api/clusters/40c1c666-e919-11e0-9c6b-005056af0085\"/>\n 54321\n \ rhel\n true\n \ \n false\n \n \ \n \n false\n @@ -593,7 +582,7 @@ http_interactions: recorded_at: Tue, 07 Oct 2014 17:58:30 GMT - request: method: get - uri: https://evm%40manageiq.com:password@192.168.252.231:8443/api/hosts?search=sortby%20name%20asc%20page%202 + uri: https://evm%40manageiq.com:password@192.168.252.231:8443/ovirt-engine/api/hosts?search=sortby%20name%20asc%20page%202 body: encoding: US-ASCII string: '' @@ -638,7 +627,7 @@ http_interactions: recorded_at: Tue, 07 Oct 2014 17:58:30 GMT - request: method: get - uri: https://evm%40manageiq.com:password@192.168.252.231:8443/api/vms?search=sortby%20name%20asc%20page%201 + uri: https://evm%40manageiq.com:password@192.168.252.231:8443/ovirt-engine/api/vms?search=sortby%20name%20asc%20page%201 body: encoding: US-ASCII string: '' @@ -675,24 +664,24 @@ http_interactions: body: encoding: US-ASCII string: ! "\n\n - \ \n + \ \n \ Brandon-Clone1\n \n \n - \ \n - \ \n - \ \n - \ \n - \ \n - \ \n - \ \n - \ \n - \ \n \n - \ \n - \ \n - \ \n - \ \n - \ \n - \ \n + rel=\"shutdown\" href=\"/ovirt-engine/api/vms/f84706ea-a68a-4206-a6cf-a06e11da70c0/shutdown\"/>\n + \ \n + \ \n + \ \n + \ \n + \ \n + \ \n + \ \n + \ \n + \ \n \n + \ \n + \ \n + \ \n + \ \n + \ \n + \ \n \ server\n \n down\n \ \n 10737418240\n \n \n \n \n @@ -701,30 +690,30 @@ http_interactions: \ false\n 1\n \ \n \n spice\n \ 1\n \n \n