1. 16 Dec, 2008 1 commit
  2. 14 Dec, 2008 2 commits
  3. 03 Dec, 2008 1 commit
  4. 02 Dec, 2008 1 commit
    • Guido Trotter's avatar
      Add utils.CheckBEParams · 42ce2e13
      Guido Trotter authored
      This function will be used in LUCreateInstance, LUSetInstanceParams,
      LUSetClusterParams and InitCluster to check the backend parameters
      validity and convert the relevant values to integer, without duplicating
      code. It lives in utils as bootstrap.py is calling it too.
      
      Reviewed-by: imsnah
      42ce2e13
  5. 23 Nov, 2008 1 commit
    • Iustin Pop's avatar
      Enable auto-unit formatting in script output · 9fbfbb7b
      Iustin Pop authored
      This patch enables by default the old 'human-readable' option, but in a
      slightly different model.
      
      The option is now called "units" and takes either:
       - 'h' for automatic formatting
       - 'm', 'g' or 't' for mebi/gibi/tebibytes
      
      If 'h' is used, we add a unit suffix, otherwise nothing is added so that
      parsing is easy.
      
      The default value of this unit is:
        - 'h' if a separator is not passed
        - 'm' if a separator is passed
      
      Reviewed-by: ultrotter
      9fbfbb7b
  6. 21 Nov, 2008 2 commits
    • Iustin Pop's avatar
      Move FieldSet class to utils.py · a2d2e1a7
      Iustin Pop authored
      Since we can use the FieldSet class in cli.py to nicely format disk
      sizes and such, we move it to utils.py and also move its associated
      unittest. I didn't remove the cmdlib.py unittest file as that's not the
      good direction :)
      
      Reviewed-by: ultrotter
      a2d2e1a7
    • Michael Hanselmann's avatar
      Get rid of node daemon password · ec17d09c
      Michael Hanselmann authored
      With the new SSL client certificate stuff it's no longer needed.
      
      Reviewed-by: iustinp
      ec17d09c
  7. 12 Nov, 2008 2 commits
    • Michael Hanselmann's avatar
      utils.SetupLogging: Remove previously setup handlers · 6346a9e5
      Michael Hanselmann authored
      If a logging function is called before the logging module is setup
      using utils.SetupLogging, it calls logging.basicConfig, which adds
      a StreamHandler, on its own. If we leave it in, all log output will
      be printed twice on stderr. This patch makes sure to remove all
      handlers before adding our own.
      
      Reviewed-by: iustinp
      6346a9e5
    • Iustin Pop's avatar
      Fix utils.KillProcess · e1bd0072
      Iustin Pop authored
      Rev 1978 introduced a breakage on the SIGKILL finall signal to the
      process, due to mistyped variable.
      
      Reviewed-by: francis.perron
      e1bd0072
  8. 11 Nov, 2008 3 commits
    • Iustin Pop's avatar
      Remove zombie special case from IsProcessAlive · 44bf25ff
      Iustin Pop authored
      Based on the discussion on the mailing list, we remove the special
      casing of zombie processes.
      
      Note we don't use kill -0 since that has a different meaning than "check
      process is alive", so this function is still linux-specific.
      
      Reviewed-by: imsnah
      44bf25ff
    • Iustin Pop's avatar
      Add cleanup of processes to utils.KillProcess · ff5251bc
      Iustin Pop authored
      In case the process we want to signal is our own process, and the signal
      we send is a deadly one, we should also cleanup after the process.
      
      This patch adds a new parameter waitpid to this function that does this,
      and changes its unittest to pass this new parameter.
      
      Reviewed-by: imsnah
      ff5251bc
    • Iustin Pop's avatar
      Implement working directory for utils.RunCmd · 8797df43
      Iustin Pop authored
      In order to replace usage of the shell just for 'cd %s; ...' we need to
      be able to specify the working directory for childs.
      
      The patch also changes the default working directory (when not
      specified) to "/", as opposed to the current dir; since the daemos run
      with cwd=/ anyway, this should not change things.
      
      Reviewed-by: imsnah
      8797df43
  9. 27 Oct, 2008 1 commit
  10. 24 Oct, 2008 1 commit
    • Iustin Pop's avatar
      Modify utils.RunCmd to write output to file · 36117c2b
      Iustin Pop authored
      Currently we launch processes via the shell in a few places only to
      redirect standard output and error to a log file ("&> $file"). It is
      better to do such redirection from within RunCmd itself.
      
      This patch splits RunCmd in two parts, the setup and the execution part,
      the latter being implemented in two different functions depending on
      whether we write to a file or not.
      
      We also update the unittests with this new case.
      
      Reviewed-by: imsnah
      36117c2b
  11. 20 Oct, 2008 1 commit
    • Iustin Pop's avatar
      Remove the logger.py module · 82d9caef
      Iustin Pop authored
      Since now we use only one function from the logger module
      (SetupLogging), we move it to utils.py (which is already imported by all
      users of this function), and we remove the module.
      
      Reviewed-by: imsnah
      82d9caef
  12. 12 Oct, 2008 1 commit
    • Iustin Pop's avatar
      Abstract checking own address into a function · caad16e2
      Iustin Pop authored
      Currently, we check if we have a given ip address (i.e. it's alive on
      one of our interfaces) but manually calling TcpPing(source=localhost).
      This works, but having it spread all over the code makes it hard to
      change the implementation.
      
      The patch abstracts this into a separate utils.OwnIpAddress(addr)
      function. We add a rpc call for it, which we use instead of the
      (single-use of) call_node_tcp_ping. We leave node_tcp_ping in, as seems
      useful and eventually it should be removed in a separate patch.
      
      Reviewed-by: imsnah
      caad16e2
  13. 01 Oct, 2008 1 commit
  14. 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
  15. 17 Sep, 2008 1 commit
  16. 05 Sep, 2008 2 commits
  17. 29 Aug, 2008 1 commit
  18. 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
  19. 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
  20. 13 Aug, 2008 1 commit
  21. 11 Aug, 2008 1 commit
  22. 08 Aug, 2008 1 commit
  23. 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
  24. 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
  25. 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
  26. 28 Jul, 2008 1 commit
  27. 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
  28. 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
  29. 10 Jul, 2008 2 commits