From f926eb6f7ccca4dacad438382f48cf75f854ab77 Mon Sep 17 00:00:00 2001 From: Rongze Zhu Date: Fri, 7 Sep 2012 14:13:11 +0800 Subject: [PATCH] Remove vpn_ping function in cinder/utils.py vpn_ping is not be used by cinder. Change-Id: I3ea04200360a23259ce3cce54ff88125895e217b --- cinder/utils.py | 48 ------------------------------------------------ 1 file changed, 48 deletions(-) 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) -- 2.45.2