Skip to content
Snippets Groups Projects
  1. Jul 08, 2008
    • Guido Trotter's avatar
      ConfigWriter: synchronize access · f78ede4e
      Guido Trotter authored
      Since we share the ConfigWriter we need somehow to make sure that
      accessing it is properly synchronized. We'll do it using the
      locking.ssynchronized decorator and a module-private shared lock.
      
      This patch also renames a few functions, which were called inside the
      ConfigWriter, to a private version _UnlockedFunctionName, and exports
      the synchronized public ones. The internal callers, which are already
      synchronized, are then changed to use the _Unlocked version, to prevent
      double locking.
      
      Reviewed-by: iustinp
      f78ede4e
    • Guido Trotter's avatar
      Locking: add ssynchronized decorator · 42a999d1
      Guido Trotter authored
      This patch creates a new decorator function ssynchronized in the locking
      library, which takes as input a SharedLock, and synchronizes access to
      the decorated functions using it. The usual SharedLock semantics apply,
      so it's possible to call more than one synchronized function at the same
      time, when the lock is acquired in shared mode, and still protect
      against exclusive access.
      
      The patch also adds a few unit test to check the basic decorator's
      functionality, and to provide an example on how to use it.
      
      Reviewed-by: iustinp
      42a999d1
    • Guido Trotter's avatar
      ConfigWriter: remove _ReleaseLock · 5b4cd1b0
      Guido Trotter authored
      Remove empty function _ReleaseLock and all its calls. Since we only
      have one configwriter per cluster the locking needs to cover all the
      data in the object, and not just the file contents. Locking in
      ConfigWriter will be handled using the ganeti locking library.
      
      Reviewed-by: iustinp
      5b4cd1b0
  2. Jul 04, 2008
  3. Jul 03, 2008
    • Iustin Pop's avatar
      Reuse the luxi client in cli.SubmitOpCode · 2cb687ad
      Iustin Pop authored
      By a mistake, we don't reuse the luxi client. As such, we open and close
      the connection at each poll cycle and spam the server logs.
      
      Reviewed-by: ultrotter
      2cb687ad
    • Iustin Pop's avatar
      Add custom logging setup for daemons · 3b316acb
      Iustin Pop authored
      It's better for daemons if:
        - they log only to one log file
        - the log level is included
        - for debug runs, the filename/line number is included
      
      This patch moves the custom formatter from the watcher to the logging
      module and generalizes it; then it changes the master daemon to use this
      function instead of the generic logging (which might be deprecated
      anyway in the future).
      
      Reviewed-by: imsnah
      3b316acb
  4. Jul 01, 2008
    • Guido Trotter's avatar
      Context: s/GLM/glm/ · 984f7c32
      Guido Trotter authored
      Make the GanetiLockManager instance of GanetiContext lowercase
      
      Reviewed-by: imsnah
      984f7c32
    • Iustin Pop's avatar
      Add a FirstFree function to utils.py · 7b4126b7
      Iustin Pop authored
      This function will return the first unused integer based on a list of
      used integers (e.g. [0, 1, 3] will return 2).
      
      Reviewed-by: imsnah
      7b4126b7
    • Guido Trotter's avatar
      Processor: acquire the BGL for LUs requiring it · 04864530
      Guido Trotter authored
      If a LU required the BGL (all LUs do, right now, by default) we'll
      acquire it in the Processor before starting them. For LUs that don't
      we'll still acquire it, but in a shared fashion, so that they cannot run
      together with LUs that do.
      
      We'll also note down whether we own the BGL exclusively, and if we don't
      and we try to chain a LU that does, we'll fail.
      
      More work will need to be done, of course, to convert LUs not to require
      the BGL, but this basic infrastructure should guarantee the coexistance
      of the old and new world for the time being.
      
      Reviewed-by: iustinp
      04864530
    • Guido Trotter's avatar
      Processor: pass context in and use it. · 1c901d13
      Guido Trotter authored
      The processor used to create a new ConfigWriter when it was initialized.
      We now have one in the context, so we'll just recycle it. First of all
      we'll pass the context in when creating a new Processor object, then
      we'll just use context.cfg, which is granted to be initialized, wherever
      we used self.cfg, and stop checking whether the config is already
      initialized or not.
      
      In the future the Processor will be able to use the context also to
      acquire the BGL for LUs that require it, and to push the context down to
      LUs that don't in order for them to manage their own locking.
      
      Reviewed-by: iustinp
      1c901d13
    • Guido Trotter's avatar
      Add REQ_BGL LogicalUnit run requirement · 7e55040e
      Guido Trotter authored
      When logical units have REQ_BGL set (it is currently the default) they
      need to be the only ganeti operation run on the cluster, and we'll
      guarantee it at the master daemon level. Currently only one thread is
      running at a time, so this requirement is never broken.
      
      Reviewed-by: iustinp
      7e55040e
  5. Jun 30, 2008
    • Guido Trotter's avatar
      Fix sstore handling in Processor · c6868e1d
      Guido Trotter authored
      - no need to keep the sstore as an object member, remove it
      - don't reinitialize sstore only if self.cfg is None
          This is not an issue, as the Processor is recycled for every opcode,
          but in general we know that (a) we might need a different type of
          sstore for different opcodes and (b) initializating them is cheap
      - recreate sstore when chaining opcodes
          Without this fix chaining an opcode which requires a writable sstore
          to one which doesn't would fail. This doesn't happen today, but it's
          better to fix it anyway
      
      These changes are possible because nowadays all opcodes already require
      a working cluster/configuration.
      
      Reviewed-by: iustinp
      c6868e1d
  6. Jun 27, 2008
  7. Jun 26, 2008
    • Guido Trotter's avatar
      When removing a node don't ssh to it · d489ca4f
      Guido Trotter authored
      Even in 1.2 this behaviour is broken, as the rpc call will remove the
      ssh keys before we get a chance to log in. Now the rpc takes care of
      shutting down the node daemon as well, so we definitely can avoid this.
      
      This makes the LURemoveNode operation work again with the threaded
      master daemon.
      
      Reviewed-by: iustinp
      d489ca4f
    • Guido Trotter's avatar
      Add errors.QuitGanetiException · e50bdd68
      Guido Trotter authored
      This exception does not signal an error but serves the purpose of making
      the ganeti daemon shut down after handling a request. Currently it will
      be used by ganeti-noded but in the future ganeti-masterd might make use
      of it as well. Its usage is documented in the docstring.
      
      Reviewed-by: iustinp
      e50bdd68
    • Guido Trotter's avatar
      Add missing empty line in SshKeyError's docstring · b0059682
      Guido Trotter authored
      Reviewed-by: iustinp
      b0059682
    • Guido Trotter's avatar
      Remove spurious check during LUAddNode · 49abbd3e
      Guido Trotter authored
      There is no point in checking whether the cluster VNC password file
      exists as a prerequisite for AddNode, considering the check happens on
      the master node, not the target one. Removing this check.
      
      Reviewed-by: iustinp
      49abbd3e
    • Guido Trotter's avatar
      Improve LURemoveNode BuildHooksEnv docstring · d08869ee
      Guido Trotter authored
      Reviewed-by: iustinp
      d08869ee
  8. Jun 25, 2008
    • Michael Hanselmann's avatar
      Cleanup old DRBD 0.7.x code · 00fb8246
      Michael Hanselmann authored
      Apparently there were still some leftovers. While removing an instance,
      I got the message "unhandled exception 'module' object has no attribute
      'LD_MD_R1'".
      
      Reviewed-by: iustinp
      00fb8246
    • Iustin Pop's avatar
      Cleanup LV status computation · 99e8295c
      Iustin Pop authored
      Currently, when seeing if a LV is degraded or not (i.e. virtual volume),
      we first attach to the device (which does an lvdisplay), then do a lvs
      in order to display the lv_attr. This generates two external commands to
      do (almost) the same thing.
      
      This patch changes the Attach() method for LVs to call lvs and display
      both the major/minor (needed for attach) and the lv_status (needed for
      GetSyncStatus). Thus, later in GetSyncStatus, we don't need to run lvs
      again, and instead just return the value computed in Attach().
      
      Reviewed-by: imsnah
      99e8295c
  9. Jun 23, 2008
  10. Jun 22, 2008
    • Iustin Pop's avatar
      Add a ‘tags’ field to instance and node listing · 130a6a6f
      Iustin Pop authored
      Currently there isn't any easy way to list all nodes or instance and
      their tags; you have to query each node in turn, or list all the tags
      via something like “gnt-cluster search-tags '.*'”. Of course, this is
      not optimal.
      
      The patch adds a new fields to “gnt-instance list” and “gnt-node list”
      called ‘tags’, that will list the tags of the object in comma-separated
      form. This field will be empty if there are no tags (when using a
      separator this output can still be parsed by other scripts).
      
      At opcode level, there is a new fields called ‘tags’ that returns a
      (python) list of the object tags.
      
      Reviewed-by: ultrotter
      130a6a6f
  11. Jun 21, 2008
    • Iustin Pop's avatar
      Implement handling of luxi errors in cli.py · 03a8dbdc
      Iustin Pop authored
      Currently the generic handling of ganeti errors in cli.py (GenericMain
      and FormatError) only handles the core ganeti errors, and not the client
      protocol errors (which live in a separate hierarchy).
      
      This patch adds handling of luxi errors too, and also adds another luxi
      error for the case when the master is not running. This gives us a nice:
      
        gnta1:~# gnt-node list
        Cannot communicate with the master daemon.
        Is it running and listening on '/var/run/ganeti-master.sock'?
      
      error message instead of a traceback.
      
      Reviewed-by: amishchenko
      03a8dbdc
  12. Jun 20, 2008
    • Iustin Pop's avatar
      Add a rpc call for BlockDev.Close() · d61cbe76
      Iustin Pop authored
      This patch adds rpc layer calls (in rpc.py and the equivalent in
      ganeti-noded) to close a list of block devices, and the wrapper in
      backend.py that takes a list of Disk objects, identifies them and
      returns correctly formatted results.
      
      The reason why this very basic call was missing until now from the rpc
      layer is that we usually don't care about device closes (though we
      should, and will do so in the future) as only drbd has a meaningful
      Close() operation; right now we directly do Shutdown().
      
      The patch is clean enough that it's actually independent of the live
      migration implementation.
      
      Reviewed-by: imsnah
      d61cbe76
  13. Jun 19, 2008
  14. Jun 18, 2008
    • Iustin Pop's avatar
      Rework the DRBD8 device status computation · 6b90c22e
      Iustin Pop authored
      Currently, compute the status of a drbd8 device in GetSyncStatus and
      return only the values that we need (and fit in the framework of
      GetSyncStatus). However, the full status details are useful (and needed)
      in other places, so the patch attempts to improve this situation.
      
      We abstract the status of a device outside in a separate class, that
      knows how to parse contents from /proc/drbd and set easily accessible
      attributes. We then simplify the GetSyncStatus to use this and return
      the values that it needs, and add a separate method that returns the
      full status object.
      
      The move to a separate class cleans up a little bit the old
      sync-progress computation from GetSyncStatus, but it's still many
      regexes.
      
      The patch also adds unittests for a few statuses, and modifies one
      BaseDRBD call to accept a custom filename instead of '/proc/drbd' to
      ease unittests.
      
      Reviewed-by: imsnah
      6b90c22e
    • Michael Hanselmann's avatar
      ganeti-watcher: Replace custom exceptions with ganeti.error.* · 7bca53e4
      Michael Hanselmann authored
      Reviewed-by: iustinp
      7bca53e4
    • 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
Loading