- Jan 11, 2011
-
-
Apollon Oikonomopoulos authored
Passing tap devices to KVM as file descriptors requires that the respective file decriptors remain open during utils.RunCmd execution. To this direction, we add a “noclose_fds” keyword argument to utils.RunCmd, accepting a list of file descriptors to keep open. The actual fd handling is implemented in _RunCmdPipe and _RunCmdFile using subprocess.Popen's “preexec_fn”[1], since subprocess.Popen provides no other way to selectively handle fds. A small modification is also made to test/ganeti.utils_unittest.py to comply with _RunCmdPipe's new API and a new unit test is added to test the selective fd retention functionality. [1] “If preexec_fn is set to a callable object, this object will be called in the child process just before the child is executed. (Unix only)” Subprocess documentation Signed-off-by:
Apollon Oikonomopoulos <apollon@noc.grnet.gr> Signed-off-by:
Guido Trotter <ultrotter@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com>
-
Michael Hanselmann authored
Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Michael Hanselmann authored
Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Michael Hanselmann authored
Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Michael Hanselmann authored
Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Michael Hanselmann authored
Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Michael Hanselmann authored
Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Michael Hanselmann authored
Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Michael Hanselmann authored
Use a function instead of a variable written by another module. Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Michael Hanselmann authored
This avoids having to monkey-patch the utils module for unittests. Monkey patching is evil and caused a bug while moving code around. Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
- Jan 10, 2011
-
-
Michael Hanselmann authored
Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Michael Hanselmann authored
Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Michael Hanselmann authored
Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Michael Hanselmann authored
Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
- Dec 21, 2010
-
-
Michael Hanselmann authored
Long story short: time.strftime("%Z", time.localtime()) doesn't work, even though it's documented to be equivalent to time.strftime("%Z"). $ TZ=America/Sao_Paulo python -c 'import time; print time.strftime("%Z"), time.strftime("%Z", time.localtime())' BRST LMT References: http://bugs.python.org/issue762963 https://bugs.launchpad.net/ubuntu/+source/python2.6/+bug/564607 http://stackoverflow.com/questions/4367896/issue-with-timezone-with-time-strftime Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Michael Hanselmann authored
Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Michael Hanselmann authored
- Update docstrings to explicitely mention Epoch - Fix timezone bug in FormatTimestampWithTZ, where it would use GMT/UTC when it should use the local timezone - Add unittests for time formatting functions Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
- Dec 17, 2010
-
-
Michael Hanselmann authored
This patch changes utils.NiceSort to use the built-in “sorted()” and gets rid of the intermediate list. Instead of wrapping the items ourselves, a key function is used. The caller can specify another key function (useful to sort objects by their name, e.g. “utils.NiceSort(instances, key=operator.attrgetter("name"))”. Unittests are provided. Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
- Dec 06, 2010
-
-
Michael Hanselmann authored
Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Adeodato Simo <dato@google.com>
-
- Nov 28, 2010
-
-
Iustin Pop authored
This just a random collection of unittest improvements. Coverage increases from 73% to 76%. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Michael Hanselmann <hansmi@google.com>
-
- Nov 23, 2010
-
-
Iustin Pop authored
Currently the test executes "/bin/sh -c 'trap "" TERM …" via the shell, which means we have two shells involved (the parent one and the child one, which does the trap). For some weird reason, this works for older OSes: the first shell exec's the second one, whereas on squeeze it forks and only then exec. This might be due to changes in Python or bash or whatever. In any case, the point is that this is a hacky way to call a shell, so we change this to simply execute the desired shell directly, without any intermediate shells (I don't understand why it was written as such originally). Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
René Nussbaumer <rn@google.com>
-
- Nov 19, 2010
-
-
Iustin Pop authored
make check < /dev/null breaks these tests. Until we have change RunCmd to override stdin, we need to remove them. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Michael Hanselmann <hansmi@google.com>
-
René Nussbaumer authored
Further investigations have to be done for merging some of these bits together with import-export daemon which uses similiar logic. Signed-off-by:
René Nussbaumer <rn@google.com> Reviewed-by:
Michael Hanselmann <hansmi@google.com>
-
- Nov 16, 2010
-
-
René Nussbaumer authored
Signed-off-by:
René Nussbaumer <rn@google.com> Reviewed-by:
Michael Hanselmann <hansmi@google.com>
-
- Oct 22, 2010
-
-
Iustin Pop authored
Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Michael Hanselmann <hansmi@google.com>
-
Iustin Pop authored
Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Michael Hanselmann <hansmi@google.com>
-
- Oct 20, 2010
-
-
Michael Hanselmann authored
This basically extracts a small piece of code from ganeti-rapi and puts it into a utility function. RAPI resources are found using a dictionary in which the keys can either be static strings or compiled regular expressions. This might be handy in other places, hence extracting it and adding unittests. Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
René Nussbaumer <rn@google.com>
-
- Oct 07, 2010
-
-
Iustin Pop authored
This patch merges the pid file handling used for ganeti-* daemons and impexp daemons. The latter version is used, since it's more reliable: uses locked pid files as opposed to checking 'live' processes. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Michael Hanselmann <hansmi@google.com>
-
- Oct 05, 2010
-
-
Michael Hanselmann authored
Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
- Sep 29, 2010
-
-
Guido Trotter authored
Signed-off-by:
Guido Trotter <ultrotter@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
- Jul 30, 2010
-
-
Michael Hanselmann authored
Before strict checking was implemented, NIC IP addresses could be set to “None”. Commit bd061c35 added more strict checking, including enforcing the IP address to be a string. With this new type, it can again be set to None. Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
- Jul 16, 2010
-
-
Balazs Lecz authored
Also adds a generic ParseError exception. Signed-off-by:
Balazs Lecz <leczb@google.com> Reviewed-by:
Michael Hanselmann <hansmi@google.com>
-
- Jul 15, 2010
-
-
Michael Hanselmann authored
Also add unittest. Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Michael Hanselmann authored
Usually our tests are named “Test…”. Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Manuel Franceschini <livewire@google.com>
-
- Jul 12, 2010
-
-
Manuel Franceschini authored
Use RFC 5737 IP addresses and RFC 2606 domain names in all unittests, docs, qa and docstrings. Signed-off-by:
Manuel Franceschini <livewire@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
- Jul 09, 2010
-
-
Manuel Franceschini authored
This patch moves network utility functions to a dedicated module. Signed-off-by:
Manuel Franceschini <livewire@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
- Jul 06, 2010
-
-
Balazs Lecz authored
Signed-off-by:
Balazs Lecz <leczb@google.com> Reviewed-by:
Michael Hanselmann <hansmi@google.com>
-
- Jun 30, 2010
-
-
Manuel Franceschini authored
Signed-off-by:
Manuel Franceschini <livewire@google.com> Reviewed-by:
Michael Hanselmann <hansmi@google.com>
-
Manuel Franceschini authored
Signed-off-by:
Manuel Franceschini <livewire@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com>
-
Manuel Franceschini authored
This patch introduces functions to check for valid IPv4 and IPv6 addresses and converts IsValidIP() to return True if it is either a IPv4 or a IPv6 address. For now we do not change the functional behavior and replace IsValidIP with IsValidIP4. This might change in the future. Signed-off-by:
Manuel Franceschini <livewire@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-