From: Rongze Zhu Date: Fri, 7 Sep 2012 06:13:11 +0000 (+0800) Subject: Remove vpn_ping function in cinder/utils.py X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=f926eb6f7ccca4dacad438382f48cf75f854ab77;p=openstack-build%2Fcinder-build.git Remove vpn_ping function in cinder/utils.py vpn_ping is not be used by cinder. Change-Id: I3ea04200360a23259ce3cce54ff88125895e217b --- diff --git a/cinder/utils.py b/cinder/utils.py index 5f896a3af..467aa961b 100644 --- a/cinder/utils.py +++ b/cinder/utils.py @@ -85,54 +85,6 @@ def find_config(config_path): raise exception.ConfigNotFound(path=os.path.abspath(config_path)) -def vpn_ping(address, port, timeout=0.05, session_id=None): - """Sends a vpn negotiation packet and returns the server session. - - Returns False on a failure. Basic packet structure is below. - - Client packet (14 bytes):: - - 0 1 8 9 13 - +-+--------+-----+ - |x| cli_id |?????| - +-+--------+-----+ - x = packet identifier 0x38 - cli_id = 64 bit identifier - ? = unknown, probably flags/padding - - Server packet (26 bytes):: - - 0 1 8 9 13 14 21 2225 - +-+--------+-----+--------+----+ - |x| srv_id |?????| cli_id |????| - +-+--------+-----+--------+----+ - x = packet identifier 0x40 - cli_id = 64 bit identifier - ? = unknown, probably flags/padding - bit 9 was 1 and the rest were 0 in testing - - """ - if session_id is None: - session_id = random.randint(0, 0xffffffffffffffff) - sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) - data = struct.pack('!BQxxxxx', 0x38, session_id) - sock.sendto(data, (address, port)) - sock.settimeout(timeout) - try: - received = sock.recv(2048) - except socket.timeout: - return False - finally: - sock.close() - fmt = '!BQxxxxxQxxxx' - if len(received) != struct.calcsize(fmt): - print struct.calcsize(fmt) - return False - (identifier, server_sess, client_sess) = struct.unpack(fmt, received) - if identifier == 0x40 and client_sess == session_id: - return server_sess - - def fetchfile(url, target): LOG.debug(_('Fetching %s') % url) execute('curl', '--fail', url, '-o', target)