Bug 1508944
Summary: | [RFE] Add support for connect timeout | ||
---|---|---|---|
Product: | [oVirt] ovirt-engine-sdk-ruby | Reporter: | Juan Hernández <juan.hernandez> |
Component: | Core | Assignee: | Juan Hernández <juan.hernandez> |
Status: | CLOSED CURRENTRELEASE | QA Contact: | Radim Hrazdil <rhrazdil> |
Severity: | medium | Docs Contact: | |
Priority: | unspecified | ||
Version: | 4.1.9 | CC: | bugs, lveyde |
Target Milestone: | ovirt-4.1.8 | Keywords: | FutureFeature |
Target Release: | 4.1.10 | Flags: | rule-engine:
ovirt-4.1?
rhrazdil: testing_plan_complete- rule-engine: planning_ack? rule-engine: devel_ack+ pstehlik: testing_ack+ |
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | 4.1.10 | Doc Type: | If docs needed, set a value |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2017-12-11 16:28:49 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | Infra | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: | |||
Bug Depends On: | |||
Bug Blocks: | 1448065 |
Description
Juan Hernández
2017-11-02 14:35:51 UTC
To verify select an IP address that can doesn't respond. The easy way is to use the "iptables" command to just make sure that the traffic to that IP address is dropped: # iptables --table filter --append OUTPUT --dest 192.168.122.100 --jump DROP Then create a script that tries to use that IP address: ---8<--- require 'logger' require 'ovirtsdk4' # Create the connection to the server: connection = OvirtSDK4::Connection.new( url: 'https://192.168.122.100/ovirt-engine/api', username: 'admin@internal', password: 'redhat123', insecure: true ) # Test the connection: connection.test(raise_exception: true) # Close the connection: connection.close ---8<--- This will fail, but it take several minutes, till the the TCP time-out expires. Repeat the same adding the new `connect_timeout` parameter, for example setting it to 10 seconds: ---8<--- require 'logger' require 'ovirtsdk4' # Create the connection to the server: connection = OvirtSDK4::Connection.new( url: 'https://192.168.122.100/ovirt-engine/api', username: 'admin@internal', password: 'redhat123', insecure: true, connect_timeout: 10 ) # Test the connection: connection.test(raise_exception: true) # Close the connection: connection.close ---8<--- It should fail anyhow, but much earlier, after 10 seconds. Verified using method suggested by Juan, with connect_timeout parameter such request fails after given number of seconds. Used sdk version 4.2.0.beta2, RHVM 4.1.8.1. |