Commit 45317e3a authored by Iustin Pop's avatar Iustin Pop
Browse files

Remove some unused Python code

This patch removes code which is no longer used due to refactoring:

- http.InitSsl, last usage removed in commit 33231500 (“Convert RPC
  client to PycURL”)
- rapi.baserlib.MakeParamsDict, last usage remove in commit 4e5a68f8
  (“RAPI: rlib1 removal”)
- rapi.baserlib.ExtractField, last usage removed in commit 028c6b76
  (“RAPI:Fix root list and unittest for it.”)
- qa.qa_utils.AssertNotEqual, last real usage removed in commit
  2f4b4f78 (“Simplify QA commands”) (but it was still imported for a
  while, until we extended pylint to run over the QA code as well)
- qlang._IsHostname, added in commit f8638e28 (“Detect globbing
  patterns as query arguments”) but never used
- cmdlib._BuildNetworkHookEnvByObject, last usage removed in commit

 (“Locking related fixes for networks”)
- NLD constants, which are obsolete—the nbma project is no longer
  maintained and it's not working with current ganeti
Signed-off-by: default avatarIustin Pop <>
Reviewed-by: default avatarMichael Hanselmann <>
parent d45a824b
......@@ -1367,27 +1367,6 @@ def _BuildNetworkHookEnv(name, subnet, gateway, network6, gateway6,
return env
def _BuildNetworkHookEnvByObject(net):
"""Builds network related env varliables for hooks
@type net: L{objects.Network}
@param net: the network object
args = {
"gateway": net.gateway,
"network6": net.network6,
"gateway6": net.gateway6,
"network_type": net.network_type,
"mac_prefix": net.mac_prefix,
"tags": net.tags,
return _BuildNetworkHookEnv(**args) # pylint: disable=W0142
def _BuildInstanceHookEnv(name, primary_node, secondary_nodes, os_type, status,
minmem, maxmem, vcpus, nics, disk_template, disks,
bep, hvp, hypervisor_name, tags):
......@@ -146,8 +146,6 @@ NODED = "ganeti-noded"
CONFD = "ganeti-confd"
RAPI = "ganeti-rapi"
MASTERD = "ganeti-masterd"
# used in the ganeti-nbma project
NLD = "ganeti-nld"
# daemon-name: ("proto", "default-port")
......@@ -155,14 +153,10 @@ DAEMONS_PORTS = {
CONFD: ("udp", 1814),
RAPI: ("tcp", 5080),
"ssh": ("tcp", 22),
# used in the ganeti-nbma project
NLD: ("udp", 1816),
# used in the ganeti-nbma project
# Copyright (C) 2007, 2008, 2010 Google Inc.
# Copyright (C) 2007, 2008, 2010, 2012 Google Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......@@ -530,19 +530,6 @@ def Handshake(sock, write_timeout):
raise HttpError("Error in SSL handshake: %s" % err)
def InitSsl():
"""Initializes the SSL infrastructure.
This function is idempotent.
if not OpenSSL.rand.status():
raise EnvironmentError("OpenSSL could not collect enough entropy"
" for the PRNG")
# TODO: Maybe add some additional seeding for OpenSSL's PRNG
class HttpSslParams(object):
"""Data class for SSL key and certificate.
......@@ -38,7 +38,6 @@ import logging
import pyparsing as pyp
from ganeti import errors
from ganeti import netutils
from ganeti import utils
from ganeti import compat
......@@ -258,20 +257,6 @@ def ParseFilter(text, parser=None):
" '%s': %s" % (text, err), err)
def _IsHostname(text):
"""Checks if a string could be a hostname.
@rtype: bool
except errors.OpPrereqError:
return False
return True
def _CheckFilter(text):
"""CHecks if a string could be a filter.
......@@ -85,16 +85,6 @@ def BuildUriList(ids, uri_format, uri_fields=("name", "uri")):
return map(_MapId, ids)
def ExtractField(sequence, index):
"""Creates a list containing one column out of a list of lists.
@param sequence: sequence of lists
@param index: index of field
return map(lambda item: item[index], sequence)
def MapFields(names, data):
"""Maps two lists into one dictionary.
......@@ -127,33 +117,6 @@ def MapBulkFields(itemslist, fields):
return items_details
def MakeParamsDict(opts, params):
"""Makes params dictionary out of a option set.
This function returns a dictionary needed for hv or be parameters. But only
those fields which provided in the option set. Takes parameters frozensets
from constants.
@type opts: dict
@param opts: selected options
@type params: frozenset
@param params: subset of options
@rtype: dict
@return: dictionary of options, filtered by given subset.
result = {}
for p in params:
value = opts[p]
except KeyError:
result[p] = value
return result
def FillOpcode(opcls, body, static, rename=None):
"""Fills an opcode with body parameters.
......@@ -118,14 +118,6 @@ def AssertEqual(first, second):
raise qa_error.Error("%r == %r" % (first, second))
def AssertNotEqual(first, second):
"""Raises an error when values are equal.
if not first != second:
raise qa_error.Error("%r != %r" % (first, second))
def AssertMatch(string, pattern):
"""Raises an error when string doesn't match regexp pattern.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment