1. 01 Oct, 2008 1 commit
  2. 28 Sep, 2008 1 commit
    • Iustin Pop's avatar
      Move the pseudo-secret generation to utils.py · 33081d90
      Iustin Pop authored
      The bootstrap code needs a pseudo-secret and this is currently generated
      inside the InitGanetiServerSetup function. Since more users will need
      this, move it to utils.py
      
      Reviewed-by: ultrotter
      33081d90
  3. 17 Sep, 2008 1 commit
  4. 05 Sep, 2008 2 commits
  5. 29 Aug, 2008 1 commit
  6. 26 Aug, 2008 1 commit
    • Michael Hanselmann's avatar
      Add simple lock debug output · e67bd559
      Michael Hanselmann authored
      Currently it can only be enabled by modifying utils.py, but we can
      add a command line parameter later if needed.
      
      Reviewed-by: schreiberal
      e67bd559
  7. 14 Aug, 2008 1 commit
    • Guido Trotter's avatar
      RunCmd: add optional environment overriding · 2557ff82
      Guido Trotter authored
      If the user passes an env dict to RunCmd we'll override the environment
      passed to the to-be-executed command with the values in the dict. This
      allows us to pass arbitrary environment values to commands we run.
      
      Reviewed-by: imsnah 
      2557ff82
  8. 13 Aug, 2008 1 commit
  9. 11 Aug, 2008 1 commit
  10. 08 Aug, 2008 1 commit
  11. 31 Jul, 2008 1 commit
    • Michael Hanselmann's avatar
      Add FileLock utility class · a87b4824
      Michael Hanselmann authored
      This class is a wrapper around fcntl.flock and abstracts opening and
      closing the lockfile. It'll used for the job queue.
      
      (The patch also removes a duplicate import of tempfile into the unittest)
      
      Reviewed-by: iustinp
      a87b4824
  12. 30 Jul, 2008 3 commits
    • Iustin Pop's avatar
      Fix a misuse of exc_info in logging.info · 8161a646
      Iustin Pop authored
      This is my fault, sorry.
      
      Reviewed-by: imsnah
      8161a646
    • Iustin Pop's avatar
      Fix pylint-detected issues · 38206f3c
      Iustin Pop authored
      This is mostly:
        - whitespace fix (space at EOL in some files, not all, broken
          indentation, etc)
        - variable names overriding others (one is a real bug in there)
        - too-long-lines
        - cleanup of most unused imports (not all)
      
      Reviewed-by: ultrotter
      38206f3c
    • Iustin Pop's avatar
      Expose utils.DaemonPidFileName · 53beffbb
      Iustin Pop authored
      Since we need to compute this from outside utils.py, we change this to a
      public function.
      
      Reviewed-by: ultrotter
      53beffbb
  13. 29 Jul, 2008 2 commits
    • Iustin Pop's avatar
      Add a KillProcess function · b2a1f511
      Iustin Pop authored
      We cannot depend on all environments to have a start-stop-daemon or
      similar tool. We instead implement a KillProcess function that behaves
      similar to “start-stop-daemon --retry”.
      
      Note that the attached unittest can hang in foreground if the child
      misbehaves (doesn't write to the internal pipe). Since unittest are
      either run in the foreground or are run with a timeout from an automated
      framework, I think this is an acceptable trade-off (against of using
      hardcoded timeouts in the test).
      
      Reviewed-by: imsnah
      b2a1f511
    • Iustin Pop's avatar
      Change IsPidFileAlive into ReadPidFile · d9f311d7
      Iustin Pop authored
      We already have a function to test if a PID is alive, so it makes more
      sense to use function composition that force calling (since we need to
      read PIDs from files in other places too). Now IsProcessAlive returns
      False for PIDs <= 0, since this is the error return from ReadPidFile.
      
      The patch also adds a unittest for checking that WriteFile raises the
      correct exception, and checks that an invalid or missing file causes
      ReadPidFile to return zero. The unittest tearDown method will try to
      cleanup the temp directory too (otherwise it leaves stuff after it).
      
      Reviewed-by: ultrotter
      d9f311d7
  14. 28 Jul, 2008 1 commit
  15. 23 Jul, 2008 2 commits
    • Guido Trotter's avatar
      Add utils.{Write,Remove}PidFile · b330ac0b
      Guido Trotter authored
      WritePidFile is a helper function that writes the current pid in a
      pidfile within the ganeti run directory. RemovePidFile tries to delete
      it.
      
      Reviewed-by: iustinp
      
      b330ac0b
    • Guido Trotter's avatar
      Add utils.IsPidFileAlive function · fee80e90
      Guido Trotter authored
      This helper function reads a pid from a file containing it and checks
      whether it refers to a live process.
      
      Reviewed-by: iustinp
      
      fee80e90
  16. 21 Jul, 2008 1 commit
    • Michael Hanselmann's avatar
      Add signal handler class · de499029
      Michael Hanselmann authored
      This signal handler class abstracts some of the code previously
      used in other places. It also uninstalls its handler when Reset()
      is called or the class is destructed, thereby restoring the
      previous behaviour.
      
      Reviewed-by: iustinp
      de499029
  17. 10 Jul, 2008 2 commits
  18. 09 Jul, 2008 2 commits
  19. 01 Jul, 2008 1 commit
  20. 23 Jun, 2008 1 commit
  21. 18 Jun, 2008 1 commit
    • Michael Hanselmann's avatar
      Add more parameters to utils.WriteFile · 71714516
      Michael Hanselmann authored
      - Make closing file optional: Required by ganeti-watcher to keep
        file open after writing it. Changes return value of utils.WriteFile
        if "close" parameter evaluates to True.
      - Pre- and post-write functions: Can be used to lock files. This
        will be used by ganeti-watcher to lock the temporary file before
        renaming.
      
      Reviewed-by: iustinp
      71714516
  22. 12 Jun, 2008 2 commits
  23. 09 May, 2008 1 commit
    • Michael Hanselmann's avatar
      Remove utils.CheckDaemonAlive and use “xm info” instead · e3e66f02
      Michael Hanselmann authored
      There are a couple of reasons for doing so:
      - /proc is not OS independent, it's only supported by Linux (there are
        emulations on other systems, but those might differ from the way
        Linux represents data).
      - Checking a daemon's state doesn't necessarily mean it's usable.
        Connecting to the socket using “xm info” is much safer.
      - Reduce code size.
      
      Reviewed-by: iustinp
      e3e66f02
  24. 29 Apr, 2008 1 commit
    • Iustin Pop's avatar
      Disable forking in the master daemon · b74159ee
      Iustin Pop authored
      This patch adds a mechanism to disable utils.RunCmd in selected
      programs. This is needed in the master daemon unless we confirm
      threading doesn't pose any problems.
      
      This makes cluster init fail, but creating new trunk clusters is anyway
      broken at the moment.
      
      Reviewed-by: ultrotter
      b74159ee
  25. 25 Apr, 2008 1 commit
    • Michael Hanselmann's avatar
      Extend utils.WriteFile · 70f4497c
      Michael Hanselmann authored
      Add parameters to not check the path for absoluteness, implement a dry
      run mode and automatically create a backup if requested. This will be
      used by the cfgupgrade utility.
      
      Reviewed-by: schreiberal
      70f4497c
  26. 10 Apr, 2008 1 commit
    • Iustin Pop's avatar
      Move the OS search code into an abstract function · 57c177af
      Iustin Pop authored
      Based on the previous OS search code changes, we can now move the OS
      search code into a generic look-for-file function in utils.py. This
      means that the allocator code can use the same function.
      
      Reviewed-by: ultrotter
      57c177af
  27. 04 Apr, 2008 2 commits
    • Iustin Pop's avatar
      Allow utils.Daemonize() to not close some fds · 8ff612c2
      Iustin Pop authored
      This patch implements an optional parameter to utils.Daemonize() which
      allows that function to not close some file descriptors.
      
      This will allow the master daemon to open the listening socket before
      fork - in order to be able to notify errors and return a meaningful exit
      code, and then when we fork we don't close that fd.
      
      Reviewed-by: imsnah
      8ff612c2
    • Iustin Pop's avatar
      Move the daemonize function to utils.py · 8f765069
      Iustin Pop authored
      Currently, in ganeti-noded we have the createDaemon function. Since
      we'll need the same in other daemons, we move this function to utils.py
      
      With the move, a few changes were also done:
        - change the name to Daemonize()
        - add a parameter, logfile, as different daemons will want to log to
          different files
        - remove the try.. except.. around the fork calls, since they were
          only re-raising the OS exception with less data; unless we want to
          actually handle fork error (not just re-raising), these try blocks
          are not useful
        - change the return style at the end of the function
      
      Reviewed-by: imsnah
      8f765069
  28. 11 Mar, 2008 1 commit
    • Iustin Pop's avatar
      Modify utils.TcpPing to make source address optional · b15d625f
      Iustin Pop authored
      This patch modifies TcpPing and its callers to make the source address
      selection optional. Usually, the kernel will know better what
      source address to use, just in some cases we want to enforce a given
      source address so it makes sense to make this optional.
      
      Reviewed-by: ultrotter
      b15d625f
  29. 05 Mar, 2008 1 commit
  30. 05 Feb, 2008 1 commit
  31. 27 Dec, 2007 1 commit