Change in vdsm[master]: hooks:checkips: add checkips hook

alukiano at redhat.com alukiano at redhat.com
Thu Mar 17 23:47:37 UTC 2016


Artyom Lukianov has posted comments on this change.

Change subject: hooks:checkips: add checkips hook
......................................................................


Patch Set 3:

(4 comments)

https://gerrit.ovirt.org/#/c/54102/3/vdsm_hooks/checkips/after_get_stats.py
File vdsm_hooks/checkips/after_get_stats.py:

Line 46: TEST_DIR = '/tmp'
Line 47: CONNECTIVITY_TIMEOUT = 60
Line 48: 
Line 49: 
Line 50: def _is_connectivity(address, net, file_dir):
> _is_network_accessible() is a better name
Done
Line 51:     file_name = '{net}_{address}'.format(net=net, address=address)
Line 52:     file_path = os.path.join(file_dir, file_name)
Line 53:     if os.path.exists(file_path):
Line 54:         return (


Line 47: CONNECTIVITY_TIMEOUT = 60
Line 48: 
Line 49: 
Line 50: def _is_connectivity(address, net, file_dir):
Line 51:     file_name = '{net}_{address}'.format(net=net, address=address)
> that's a nice extension; but I'm not sure if we should require ALL hosts or
Done
Line 52:     file_path = os.path.join(file_dir, file_name)
Line 53:     if os.path.exists(file_path):
Line 54:         return (
Line 55:             time.time() - os.stat(file_path).st_atime <=


Line 51:     file_name = '{net}_{address}'.format(net=net, address=address)
Line 52:     file_path = os.path.join(file_dir, file_name)
Line 53:     if os.path.exists(file_path):
Line 54:         return (
Line 55:             time.time() - os.stat(file_path).st_atime <=
> atime can change if someone reads the file by mistake. it makes less sense 
understand will change it to st_mtime
Line 56:             CONNECTIVITY_TIMEOUT
Line 57:         )
Line 58:     return False
Line 59: 


Line 57:         )
Line 58:     return False
Line 59: 
Line 60: 
Line 61: def allocate_given_address(stats_json, networks, file_dir):
> I'm afraid that the code quality of some of the hooks can be improved.
Done
Line 62:     for net, params in networks.iteritems():
Line 63:         addresses = checkips_utils.parse_addresses(params)
Line 64:         for address in addresses:
Line 65:             if not _is_connectivity(address, net, file_dir):


-- 
To view, visit https://gerrit.ovirt.org/54102
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I53cec37310f0f1844d6fe244419fd8c10e9b7ebb
Gerrit-PatchSet: 3
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Artyom Lukianov <alukiano at redhat.com>
Gerrit-Reviewer: Artyom Lukianov <alukiano at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Edward Haas <edwardh at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list