Bug 1450989

Summary: Vdsm client is not aware when connection is stale
Product: [oVirt] vdsm Reporter: Piotr Kliczewski <pkliczew>
Component: Bindings-APIAssignee: Piotr Kliczewski <pkliczew>
Status: CLOSED CURRENTRELEASE QA Contact: Nikolai Sednev <nsednev>
Severity: high Docs Contact:
Priority: unspecified    
Version: 4.19.20CC: bugs, mavital, mperina, pkliczew, stirabos
Target Milestone: ovirt-4.1.3Keywords: Triaged
Target Release: 4.19.16Flags: rule-engine: ovirt-4.1+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-07-06 13:17:14 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:

Description Piotr Kliczewski 2017-05-15 14:04:57 UTC
When using vdsm client it is not possible to understand whether the connection is still open. During hosted engine configuration vdsm is restarted so it is important to understand when connection to vdsm is not active.

Comment 1 Nikolai Sednev 2017-06-05 09:02:43 UTC
Please provide reproduction steps for this bug.

Comment 2 Piotr Kliczewski 2017-06-05 09:34:36 UTC
When using vdsm.client module we need to connect and call any verb (getCapabilities). When client code is still running restart vdsm and attempt to call a verb again.

The client should raise Disconnected error.

Comment 3 Nikolai Sednev 2017-06-05 11:55:07 UTC
    from vdsm import client
    cli = client.connect(localhost, 54321, use_tls=True)
    cli.Host.getCapabilities()
    ...
    # systemctl restart vdsmd
     
    cli.Host.getCapabilities()
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/usr/lib/python2.7/site-packages/vdsm/client.py", line 247, in _call
        responses = self._client.call(req, timeout=timeout)
      File "/usr/lib/python2.7/site-packages/yajsonrpc/__init__.py", line 362, in call
        call = self.call_async(*reqs)
      File "/usr/lib/python2.7/site-packages/yajsonrpc/__init__.py", line 368, in call_async
        self.call_cb(call.callback, *reqs)
      File "/usr/lib/python2.7/site-packages/yajsonrpc/__init__.py", line 384, in call_cb
        self._transport.send(ctx.encode())
      File "/usr/lib/python2.7/site-packages/yajsonrpc/stompreactor.py", line 564, in send
        headers,
      File "/usr/lib/python2.7/site-packages/yajsonrpc/stompreactor.py", line 414, in send
        raise stomp.Disconnected()
    yajsonrpc.stomp.Disconnected


Works for me on these components on host:
ovirt-vmconsole-host-1.0.4-1.el7ev.noarch
mom-0.5.9-1.el7ev.noarch
ovirt-imageio-daemon-1.0.0-0.el7ev.noarch
libvirt-client-2.0.0-10.el7_3.9.x86_64
ovirt-vmconsole-1.0.4-1.el7ev.noarch
vdsm-4.19.17-1.el7ev.x86_64
ovirt-hosted-engine-ha-2.1.1-1.el7ev.noarch
ovirt-host-deploy-1.6.5-1.el7ev.noarch
ovirt-imageio-common-1.0.0-0.el7ev.noarch
qemu-kvm-rhev-2.6.0-28.el7_3.10.x86_64
ovirt-hosted-engine-setup-2.1.2-2.el7ev.noarch
sanlock-3.4.0-1.el7.x86_64
ovirt-setup-lib-1.1.1-1.el7ev.noarch
ovirt-engine-sdk-python-3.6.9.1-1.el7ev.noarch
Linux version 3.10.0-514.21.1.el7.x86_64 (mockbuild.eng.bos.redhat.com) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC) ) #1 SMP Sat Apr 22 02:41:35 EDT 2017
Linux 3.10.0-514.21.1.el7.x86_64 #1 SMP Sat Apr 22 02:41:35 EDT 2017 x86_64 x86_64 x86_64 GNU/Linux
Red Hat Enterprise Linux Server release 7.3 (Maipo)

Engine:
rhev-guest-tools-iso-4.1-5.el7ev.noarch
rhevm-dependencies-4.1.1-1.el7ev.noarch
rhevm-4.1.3.1-0.1.el7.noarch
rhevm-setup-plugins-4.1.2-1.el7ev.noarch
rhevm-branding-rhev-4.1.0-1.el7ev.noarch
rhevm-doc-4.1.3-1.el7ev.noarch
Linux version 3.10.0-514.16.1.el7.x86_64 (mockbuild.eng.bos.redhat.com) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC) ) #1 SMP Fri Mar 10 13:12:32 EST 2017
Linux  3.10.0-514.16.1.el7.x86_64 #1 SMP Fri Mar 10 13:12:32 EST 2017 x86_64 x86_64 x86_64 GNU/Linux
Red Hat Enterprise Linux Server release 7.3 (Maipo)