Statistics
| Branch: | Tag: | Revision:

root / lib / netutils.py @ 9b4cb29d

History | View | Annotate | Download (18.9 kB)

# Date Author Comment
25ba209e 02/25/2013 05:53 pm Michael Hanselmann

TcpPing: Better error handling, logging

Log every attempt to reach a port on another node. Don't silently return
False if a target not recognized as an IP address is given (e.g. a
hostname).

Signed-off-by: Michael Hanselmann <>
Reviewed-by: Michele Tartara <>

5f30ea3f 12/20/2012 12:37 pm Michael Hanselmann

netutils: Normalize all FQDNs

Addresses issue 147. Only the hostnames resolved using
“netutils.Hostname($name)” were normalized, but those returned by the
class method “GetSysName” weren't.

Signed-off-by: Michael Hanselmann <>
Reviewed-by: Helga Velroyen <>

39d1744a 10/09/2012 01:46 pm Iustin Pop

Fix usage of errors.ResolverError

This exception is documented to have three arguments, but in one case
we raise it with a simple string argument. Let's fix that.

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

e91b297c 09/21/2012 03:44 pm Michael Hanselmann

netutils: Use virtual hostname if set

This enables the hostname seen by other code through Hostname.GetFqdn to
be changed through the environment variable “GANETI_HOSTNAME”.

Signed-off-by: Michael Hanselmann <>
Reviewed-by: René Nussbaumer <>

8ad0da1e 09/03/2012 07:09 pm Iustin Pop

Fix warnings/errors with newer pylint

To help developing Ganeti on newer distributions, let's try to fix
pylint warnings/errors. I'm using pylint from current Debian wheezy:
pylint 0.25.1, astng 0.23.1, common 0.58.0, and we have 3 things that
needs fixing....

7df2c4f0 10/05/2011 12:05 pm Andrea Spadaccini

Add ValidateNetmask and GetClass IPAddress methods

Add the following methods to netutils.IPAddress:
  • ValidateNetmask
  • GetClassFromIpVersion
  • GetClassFromIpFamily

Also, add related tests to the test suite.

Signed-off-by: Andrea Spadaccini <>...

17385bd2 08/30/2011 02:01 pm Andrea Spadaccini

Fixes to errors/warnings raised by pylint 0.24

Running pylint 0.24.0 revealed 2 errors and 1 warning. Here is how I
fixed them:

  • jqueue.py: silenced E1101
  • netutils.py: rewrote the list comprehension using extend()
  • watcher/__init__.py: fixed a missing format string parameter...
e687ec01 08/25/2011 01:53 pm Michael Hanselmann

PEP8 style fixes

Identified using the “pep8” utility.

Signed-off-by: Michael Hanselmann <>
Reviewed-by: Iustin Pop <>

37531236 08/11/2011 03:18 pm Andrea Spadaccini

Added helper functions in netutils and related constants

Added the following functions to netutils:
- IsValidInterface
- GetInterfaceIpAddresses
- _GetIpAddressesFromIpOutput

Added the following static methods to netutils.IPAddress:
- GetAddressFamilyFromVersion...

d0c8c01d 07/25/2011 04:55 pm Iustin Pop

Most boring patch ever

s/'/"/ in (hopefully) the right places.

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

77b02a99 02/17/2011 04:39 pm René Nussbaumer

Rephrase a misleading pydoc for netutils.TcpPing

Signed-off-by: René Nussbaumer <>
Reviewed-by: Stephen Shirley <>

17f7fd27 08/23/2010 02:58 pm Manuel Franceschini

Fix a few epydoc docstrings

Signed-off-by: Manuel Franceschini <>
Reviewed-by: Iustin Pop <>

981732fb 08/23/2010 01:31 pm Manuel Franceschini

Make family argument in FormatAddress optional

By doing this we delegate the task of finding the correct address family
to the FormatAddress method.

Signed-off-by: Manuel Franceschini <>
Reviewed-by: Iustin Pop <>

f3044516 08/20/2010 02:10 pm Manuel Franceschini

Make Hostname object always intialize its name to fqdn

This patch restores the behaviour of Hostname (previously known as
HostInfo) to always use fqdn. This was broken due to the fact that the
now used getaddrinfo does not return an fqdn in contrast to
gethostbyname_ex()....

b43dcc5a 08/19/2010 12:44 pm Manuel Franceschini

Support IPv6 node add

Signed-off-by: Manuel Franceschini <>
Reviewed-by: Iustin Pop <>

e7b3ad26 08/19/2010 12:41 pm Manuel Franceschini

netutils: make re class attribute and catch IndexError

These missing changes were initially agreed upon but then forgotten.
First, we move the valid name regex to the class-level such that it
won't be compiled for every invocation of GetIP() and we wrap the result...

7845b8c8 08/18/2010 04:07 pm Manuel Franceschini

Fix some small newline style issues

Signed-off-by: Manuel Franceschini <>
Reviewed-by: Iustin Pop <>

1a8337f2 08/18/2010 11:28 am Manuel Franceschini

rapi.client, http.client: Format url correctly when using IPv6

This patch moves the FormatAddress helper function from daemon.py to
netutils.py. This enables its use in http.client as well as in
rapi.client. Furthermore this adds functionality to format IPv6...

b705c7a6 08/18/2010 11:27 am Manuel Franceschini

Support for resolving hostnames to IPv6 addresses

This patch enables IPv6 name resolution by using socket.getaddrinfo
instead of socket.gethostbyname_ex.

It renames the HostInfo class to Hostname and unifies its use throughout
the code. This is achieved by using static calls where no object is...

8b312c1d 08/18/2010 11:26 am Manuel Franceschini

Introduce new IPAddress classes

This patch unifies the netutils functions dealing with IP addresses to
three classes:
- IPAddress: Common IP address functionality
- IPv4Address: IPv4 specific functionality
- IPv6address: IPv6-specific functionality

Furthermore it adds methods to check whether an address is a loopback...

a744b676 07/09/2010 04:37 pm Manuel Franceschini

Introduce lib/netutils.py

This patch moves network utility functions to a dedicated module.

Signed-off-by: Manuel Franceschini <>
Reviewed-by: Iustin Pop <>