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
f22433c0 (“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: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
return env
-def _BuildNetworkHookEnvByObject(net):
- """Builds network related env varliables for hooks
-
- @type net: L{objects.Network}
- @param net: the network object
-
- """
- args = {
- "name": net.name,
- "subnet": net.network,
- "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):
CONFD = "ganeti-confd"
RAPI = "ganeti-rapi"
MASTERD = "ganeti-masterd"
-# used in the ganeti-nbma project
-NLD = "ganeti-nld"
DAEMONS_PORTS = {
# daemon-name: ("proto", "default-port")
CONFD: ("udp", 1814),
RAPI: ("tcp", 5080),
"ssh": ("tcp", 22),
- # used in the ganeti-nbma project
- NLD: ("udp", 1816),
}
DEFAULT_NODED_PORT = DAEMONS_PORTS[NODED][1]
DEFAULT_CONFD_PORT = DAEMONS_PORTS[CONFD][1]
DEFAULT_RAPI_PORT = DAEMONS_PORTS[RAPI][1]
-# used in the ganeti-nbma project
-DEFAULT_NLD_PORT = DAEMONS_PORTS[NLD][1]
FIRST_DRBD_PORT = 11000
LAST_DRBD_PORT = 14999
#
#
-# 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
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.
import pyparsing as pyp
from ganeti import errors
-from ganeti import netutils
from ganeti import utils
from ganeti import compat
" '%s': %s" % (text, err), err)
-def _IsHostname(text):
- """Checks if a string could be a hostname.
-
- @rtype: bool
-
- """
- try:
- netutils.Hostname.GetNormalizedName(text)
- except errors.OpPrereqError:
- return False
- else:
- return True
-
-
def _CheckFilter(text):
"""CHecks if a string could be a filter.
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.
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:
- try:
- value = opts[p]
- except KeyError:
- continue
- result[p] = value
-
- return result
-
-
def FillOpcode(opcls, body, static, rename=None):
"""Fills an opcode with body parameters.
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.