Skip to content
Snippets Groups Projects
  1. Jan 28, 2008
    • Iustin Pop's avatar
      Improve the documentation of query output fields · d8a4b51d
      Iustin Pop authored
      The gnt-node and gnt-instance list commands have a customizable list of
      output fields, but the list is not up to date (in the man page) and not
      easily understandable from the ‘--help’ output.
      
      This patch updates the man pages and adds the available fields and
      default fields in the ‘--help’ output, as part of the description.
      
      Example:
      Usage
      =====
        gnt-node list
      
      Lists the nodes in the cluster. The available fields are (see the man page for
      details): name, pinst_cnt, pinst_list, sinst_cnt, sinst_list, pip, sip,
      dtotal, dfree, mtotal, mnode, mfree, bootid. The default field list is (in
      order): name, dtotal, dfree, mtotal, mnode, mfree, pinst_cnt, sinst_cnt.
      
      Reviewed-by: imsnah,ultrotter
      d8a4b51d
  2. Jan 25, 2008
  3. Jan 21, 2008
    • Guido Trotter's avatar
      Add support for command aliases · de47cf8f
      Guido Trotter authored
      Passing a new aliases dict to generic main we can easily support aliases for
      compatibility reasons or simply useability.
      
      Reviewed-by: iustinp
      de47cf8f
  4. Dec 12, 2007
    • Iustin Pop's avatar
      Handle ^C while trying to acquire the lock · 36c68ff1
      Iustin Pop authored
      When waiting for the lock and pressing ^C, the user will get a backtrace
      as the KeyboardInterrupt exception is not handled. The patch adds a
      simple method of handling it.
      
      Note that this is not about ^C in any other place.
      
      Reviewed-by: schreiberal,imsnah
      36c68ff1
  5. Nov 29, 2007
  6. Nov 06, 2007
  7. Nov 05, 2007
  8. Oct 29, 2007
  9. Oct 10, 2007
    • Iustin Pop's avatar
      Some small fixes to utils.GenerateTable · 01ca31ae
      Iustin Pop authored
      This adds:
        - fix the case when a dumb caller didn't stringify its values
        - explicitly raise a ProgrammerError in case a field is missing from
          the headers dictionary
      
      Reviewed-by: imsnah
      01ca31ae
    • Iustin Pop's avatar
      Fix AskUser to not die on extra input · 3023170f
      Iustin Pop authored
      Currently, AskUser dies with -ESPIPE if the user gives more than one
      character plus newline. This is because the python library, while
      returning only two chars from the readline(2) call, will cache the rest
      of the input, and when we do a write, it will try to seek back to just
      after the last returned char. This fails on /dev/tty, so an exception is
      raised. However, then opening the file descriptor in O_APPEND mode,
      python will not issue such seeks, thereby fixing this problem.
      
      The other alternative, opening in unbuffered mode, is not as good, since
      then python will issue one-byte reads at a time, but the tty will read
      the entire line, so at the next readline call, whatever remained in the
      descriptor buffer is returned from the kernel to python, and the user
      doesn't get a chance to enter something at all.
      
      Reviewed-by: imsnah
      3023170f
    • Iustin Pop's avatar
      Remove the shebang from modules · 2f31098c
      Iustin Pop authored
      Since modules are not directly executables, remove the shebang from
      them. This helps with lintian warnings.
      
      Also make the autogenerated _autoconf.py contain two comment lines at
      the beginning, like the other modules.
      
      Reviewed-by: ultrotter
      2f31098c
  10. Oct 09, 2007
    • Iustin Pop's avatar
      Fix a wrong exception name · 0c434948
      Iustin Pop authored
      This was introduced in rev 208.
      
      Reviewed-by: imsnah
      0c434948
    • Iustin Pop's avatar
      Separate error formatting out of cli.GenericMain · 73702ee7
      Iustin Pop authored
      This patch moves the error formatting into a separate function that will
      be exported so that scripts that execute multiple opcodes can create the
      same output as for GenericMain. Also, GenericMain becomes more readable.
      
      Reviewed-by: imsnah
      73702ee7
    • Iustin Pop's avatar
      Enhance cli.SubmitOpcode to use custom parameters · 9f33ef86
      Iustin Pop authored
      This patch allows the SubmitOpcode function to take a pre-created
      Processor instance and a different feedback function. This is helpful
      when submitting more than one opcode from a shell script.
      
      Reviewed-by: imsnah
      9f33ef86
  11. Oct 08, 2007
  12. Sep 21, 2007
    • Iustin Pop's avatar
      Remove requirement that host names are FQDN · 89e1fc26
      Iustin Pop authored
      We currently require that hostnames are FQDN not short names
      (node1.example.com instead of node1). We can allow short names as long
      as:
        - we always resolve the names as returned by socket.gethostname()
        - we rely on having a working resolver
      
      These issues are not as big as may seem, as we only did gethostname() in
      a few places in order to check for the master; we already required
      working resolver all over the code for the other nodes names (and thus
      requiring the same for the current node name is normal).  The patch
      moves some resolver calls from within execution path to the checking
      path (which can abort without any problems). It is important that after
      this patch is applied, no name resolving is called from the execution
      path (LU.Exec() or other code that is called from within those methods)
      as in this case we get much better code flow.
      
      This patch also changes the functions for doing name lookups and
      encapsulates all functionality in a single class.
      
      The final change is that, by requiring working resolver at all times, we
      can change the 'return None' into an exception and thus we don't have to
      check manually each time; only some special cases will check
      (ganeti-daemon and ganeti-watcher which are not covered by the
      generalized exception handling in cli.py). The code is cleaner this way.
      
      Reviewed-by: imsnah
      89e1fc26
  13. Sep 19, 2007
    • Iustin Pop's avatar
      Improve the cli.AskUser() function · 47988778
      Iustin Pop authored
      This patch improves the AskUser function by allowing it to:
       - choose from multiple choices (instead of only y/n)
       - give help to the user
       - preserve line breaks and whitespace formatting in the message
      
      With this patch, an instance removal looks like this:
      root@xen-test1-4:~# gnt-instance remove tsetest1
      This will remove the volumes of the instance tsetest1 (including
      mirrors), thus removing all the data of the instance. Continue?
      y/[n]/?: ?
       y - Perform the operation
       n - Do not perform the operation
      
      This will remove the volumes of the instance tsetest1 (including
      mirrors), thus removing all the data of the instance. Continue?
      y/[n]/?: y
      
      The patch also removed the _ask_user member of the opts argument, since
      external code was using it (and thus it makes no sense for it to be a
      private member); now gnt-* scripts are using the AskUser function
      directly.
      
      Reviewed-by: ultrotter
      47988778
  14. Aug 17, 2007
    • Iustin Pop's avatar
      Change cli.OutputTable to cli.GenerateTable · 16be8703
      Iustin Pop authored
      Since the table generation might be useful elsewhere, let's change it to
      return the data instead of directly printing it.
      
      Its callers have also been updated.
      
      Reviewed-by: imsnah
      16be8703
  15. Aug 14, 2007
    • Iustin Pop's avatar
      Style changes for pep-8 and python-3000 compliance. · 3ecf6786
      Iustin Pop authored
      This changes the raising of exceptions from:
        raise Exception, value
      to
        raise Exception(value)
      
      as the first form will be removed in python-3000 and the second form is
      preferred now.
      
      The changes also involve a few cases of changing from raising standard
      exceptions and use our own ones.
      
      The new version also fixes many pylint-generated warnings, especially in
      ganeti-noded where I changed many methods to @staticmethod.
      
      There is no functionality changed (barring any bugs).
      3ecf6786
  16. Jul 26, 2007
  17. Jul 24, 2007
  18. Jul 16, 2007
Loading