Skip to content
This repository has been archived by the owner on Nov 9, 2020. It is now read-only.

Report errno and proper strings on vSocket communcation failures #435

Merged
merged 2 commits into from Jun 2, 2016

Conversation

msterin
Copy link
Contributor

@msterin msterin commented Jun 2, 2016

Fixes #206

  • Client code passes errno up and GO code handles it.
    CGO auto-returns (return_code, error) tuple and error info was there all along, we just use it now.
  • Server code makes sure errno is properly set (and not cleaned up by close() and the likes) ,
    and sets errno when needed. Python code then generates proper messages
  • removed uneeded custom error codes - it turned out to be throwaway code
  • a few cosmetic changes - mainly dropped single letter variables since they are hard to maintain

Tested with CI and 'make all'. some error codes tested manually, to make sure the path works:

  • Run python service while it is already up. Log says:
05/14/16 15:19:51 562104 [ERROR  ] Failed to initialize vSocket listener: Address already in use (errno=98)
Traceback (most recent call last):
  File "/usr/lib/vmware/vmdkops/bin/vmdk_ops.py", line 725, in main
    handleVmciRequests()
  File "/usr/lib/vmware/vmdkops/bin/vmdk_ops.py", line 667, in handleVmciRequests
    %  (os.strerror(errno), errno))
OSError: Failed to initialize vSocket listener: Address already in use (errno=98)
  • Run docker volume ls when the ESX service is down. Docker says
root@ubuntu-srv14:~# docker volume ls
list vmdk: VolumeDriver.List: 'list' failed: connection reset by peer (errno=104). Check that ESX service is running.
DRIVER              VOLUME NAME
root@ubuntu-srv14:~# 

Fixes #206

* Client code passes errno up and GO code handles it.
  CGO auto0-returns (return, error) tuple and error info was there all along, we just use it now.
* Server code makes sure  errno is properly set (and not cleaned up by close() and the likes) ,
  and sets errno when needed. Python code then generates proper messages
* removed uneeded custom error codes - it turned out to be throwaway code
* a few cosmetic changes - mainly dropped single letter variables since they are hard to  maintain

response = lib.vmci_reply(c, c_char_p(json.dumps(ret)))
errno = get_errno()
Copy link
Contributor

Choose a reason for hiding this comment

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

What are we doing with this errno? Should we log it?

Copy link
Contributor Author

@msterin msterin Jun 2, 2016

Choose a reason for hiding this comment

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

yep, I missed this. Added check and log.
Thanks !

@andrewjstone
Copy link
Contributor

LGTM

@@ -175,6 +172,7 @@ vsock_get_family(void)
}

// Create and connect VMCI socket.
// return success (0) or failure (-1)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: return CONN_SUCCESS (0) or CONN_FAILURE(-1)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@msterin msterin force-pushed the vmci-errno.msterin branch 2 times, most recently from 8f12d41 to bfa2543 Compare June 2, 2016 19:21
@kerneltime
Copy link
Contributor

LGTM but this code needs another round of clean up. Will see if I can get it done as part of the capabilities change.

@msterin msterin merged commit e1da74b into master Jun 2, 2016
@kerneltime kerneltime deleted the vmci-errno.msterin branch June 7, 2016 00:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

VMCI failures are all reported as "code: -1. can't connect to ESX".
5 participants