]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Remove vpn_ping function in cinder/utils.py
authorRongze Zhu <zrzhit@gmail.com>
Fri, 7 Sep 2012 06:13:11 +0000 (14:13 +0800)
committerRongze Zhu <zrzhit@gmail.com>
Fri, 7 Sep 2012 06:13:11 +0000 (14:13 +0800)
vpn_ping is not be used by cinder.

Change-Id: I3ea04200360a23259ce3cce54ff88125895e217b

cinder/utils.py

index 5f896a3af80097261f891abca7a8b79a9fc46481..467aa961b8deb4c7f626d5e0699efd9cf888c8dd 100644 (file)
@@ -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)