1. 12 Feb, 2009 15 commits
    • Iustin Pop's avatar
      Some command line scripts fixes · f1de3563
      Iustin Pop authored
      This patch changes the gnt-node and gnt-job list commands to accept
      argument and list only the selected items, which is useful when having
      many nodes or jobs.
      
      It also removes the “--units” option from gnt-job list as we don't
      actually use it.
      
      Reviewed-by: imsnah
      f1de3563
    • Iustin Pop's avatar
      Do not check 'None' disk IDs for duplicates · 25ae22e4
      Iustin Pop authored
      In case of 'None' logical or physical IDs, we don't need to check them
      for duplicates. This case can happen for DRBD devices in case of newly
      added disks, for example.
      
      Reviewed-by: imsnah
      25ae22e4
    • Iustin Pop's avatar
      Prevent race condition on MAC addresses · e7d81ba0
      Iustin Pop authored
      This patch adds a temporary set for MACs that have been requested but
      are not yet in the configuration (as part of an instance NIC). The MACs
      of an instance are automatically removed from this set when the instance
      is updated (or first added to the config).
      
      Reviewed-by: ultrotter
      e7d81ba0
    • Iustin Pop's avatar
      Always use the same short option for iallocator · 633b36db
      Iustin Pop authored
      This patch changes the scripts so that the short name for the
      “--iallocator” option is always ‘-I’.
      
      Reviewed-by: ultrotter
      633b36db
    • Iustin Pop's avatar
      Some batcher fixes · 4082e6f9
      Iustin Pop authored
      Currently the batcher hypervisor parameter must be a dict with one
      element (e.g. {"xen-hvm": { "acpi": true }}). This is overly complex and
      hard to validate correctly; the patch splits it in two:
        - one "hypervisor" string parameter, with the name of the hypervisor
        - one "hvparams" dictionary, with the hypervisor parameters
      
      The patch also changes the error handling in parsing the definition file
      - since this is not a long-running file, we are less concerned with safe
      closing of the file, and more with presenting meaningful error
      messages.
      
      Reviewed-by: killerfoxi
      4082e6f9
    • Iustin Pop's avatar
      Some small fixes · 5b460366
      Iustin Pop authored
      This patch removes the admin_ram LUQueryInstances field (is broken
      anyway) and fixes the VNC address checks in the Xen Hypervisor.
      
      Reviewed-by: imsnah
      5b460366
    • Iustin Pop's avatar
      Fix LUQueryInstances fields. · 8aec325c
      Iustin Pop authored
      The query fields are now regular expressions. We need to quote the dots,
      otherwise invalid fields will be accepted but they will lose special
      formatting in the cli scripts.
      
      Reviewed-by: imsnah
      8aec325c
    • Guido Trotter's avatar
      Apply the right permissions to /etc/hosts · 9b977740
      Guido Trotter authored
      In the current Ganeti version when modifying /etc/hosts we mistakenly
      give it the permissions of the temporary file we create to define its
      content, which is by default 0600. This breaks most non-root
      applications, and thus must be corrected. This patch forces the mode to
      be 0644 (but we might decide to just use the mode of the previous
      /etc/hosts, if we want to be more polite against any eventual
      administrative choice). We also add a new assertFileMode() method for
      unit tests and actually check in the SetEtcHostsEntry and
      RemoveEtcHostsEntry tests that the mode is correct, to be sure not to
      reintroduce this bug again. Also, a FIXME is added in the original
      functions stating that it would be nice to use WriteFile+fn() rather
      than reimplementing its functionality again.
      
      Reviewed-by: iustinp
      9b977740
    • Iustin Pop's avatar
      Fix RPC result handling in _AssembleInstanceDisks · 1dff8e07
      Iustin Pop authored
      For (status, data)-style RPC calls, the result data is in the ‘payload’
      attribute. This was missed in the conversion patch, with the only side
      effect that gnt-instance activate-disks didn't show a nice output
      anymore.
      
      Reviewed-by: ultrotter
      1dff8e07
    • Iustin Pop's avatar
      Man page updates for the ganeti daemons. · 320d986d
      Iustin Pop authored
      This patch adds new man pages for the master and RAPI daemons, and
      updates the node daemon and watcher man pages.
      
      Reviewed-by: ultrotter
      320d986d
    • Iustin Pop's avatar
      master daemon: allow skipping the voting process · 5de4474d
      Iustin Pop authored
      This patch introduces a 'force' mode for the master daemon startup where
      the voting process is not done, but the user has to confirm manually the
      startup (before forking, of course).
      
      Reviewed-by: imsnah
      5de4474d
    • Iustin Pop's avatar
      Remove a duplicate line in sed_vars · 7e6411e3
      Iustin Pop authored
      LOCALSTATEDIR is added twice to the sed variables.
      
      Reviewed-by: imsnah
      7e6411e3
    • Iustin Pop's avatar
      ConfigWriter: add checks for duplicate disk IDs · 4b98ac29
      Iustin Pop authored
      This patch adds a safety check for duplicate disk logical/physical IDs,
      in order to prevent possible software bugs.
      
      Reviewed-by: imsnah
      4b98ac29
    • Iustin Pop's avatar
      Switch the instance_shutdown rpc to (status, data) · 1fae010f
      Iustin Pop authored
      This patch changes the return type from this RPC call to include status
      information and renames the backend method to match the RPC call name.
      
      The patch is a little bigger than the reboot one, since this call is
      used in more than one place. However, all the points of call have the
      same usage pattern, so the patch is trivial.
      
      Reviewed-by: ultrotter
      1fae010f
    • Iustin Pop's avatar
      Switch the instance_reboot rpc to (status, data) · 489fcbe9
      Iustin Pop authored
      This small patch changes the return type from this RPC call to include
      status information and renames the backend method to match the RPC call
      name.
      
      Reviewed-by: ultrotter
      489fcbe9
  2. 11 Feb, 2009 6 commits
    • Guido Trotter's avatar
      FileStorage: abort creating over an existing file · aed77cea
      Guido Trotter authored
      In FileStorage there is a TODO:
       decide whether we should check for existing files and
       abort or not
      After Ganeti ate my instance data I decided. Let's abort.
      In general there is no reason we should overwrite existing files, and
      doing it can be very harmful for preexisting files on the host.
      
      Reviewed-by: iustinp
      aed77cea
    • Guido Trotter's avatar
      gnt-instance fix a typo in AddInstance · 6633774e
      Guido Trotter authored
      It's hvparams, not opts.hvparams.
      
      Reviewed-by: iustinp
      6633774e
    • Guido Trotter's avatar
      _GenerateDiskTemplate: correct file disk index · 43e99cff
      Guido Trotter authored
      Currently when adding disks the base for the index is not taken into
      account, and disk 0 is added twice.
      
      Reviewed-by: iustinp
      43e99cff
    • Guido Trotter's avatar
      gnt-cluster, pass hvparams directly to dict() · f8e7ddca
      Guido Trotter authored
      If hvparams is not set it will be [], so dict() will transform it to an
      empty dict, which is safe in all cases.
      
      Reviewed-by: iustinp
      f8e7ddca
    • Guido Trotter's avatar
      ganeti-noded: Create LOCK_DIR if missing · f2ffd244
      Guido Trotter authored
      We need this directory for locks, so if for any reason it's not there
      we'll create it. The permissions are the standard /var/lock permissions.
      
      Reviewed-by: iustinp
      f2ffd244
    • Guido Trotter's avatar
      HTS_USE_VNC, rename and remove KVM · ccd905ac
      Guido Trotter authored
      Currently we use the HTS_USE_VNC constant only to copy the vnc password
      file. While KVM uses vnc it currently has no password support, nor we'll
      be on time making one for 2.0, so renaming the constant to
      HTS_COPY_VNC_PASSWORD and only putting Xen HVM in it. In the future
      (2.1) password handling will need to be reworked anyway.
      
      Reviewed-by: iustinp
      ccd905ac
  3. 10 Feb, 2009 19 commits
    • Iustin Pop's avatar
      Sort instance data in gnt-node info · ae07a1d3
      Iustin Pop authored
      The patch sorts the instance list in gnt-node info output, in order to
      make it more readable (and stable).
      
      Reviewed-by: imsnah
      ae07a1d3
    • Iustin Pop's avatar
      Some fixes to node add and re-add · 82e12743
      Iustin Pop authored
      The patch changes the pre-checks in node-add and re-add:
        - if the node is not already in the cluster, refuse to re-add
        - when re-adding, reuse the secondary IP from the cluster
          configuration
        - when re-adding, reset the offline and drained flags, so that RPC
          calls work (and we can actually upload the keys)
      
      The patch also adds a missing log entry in LUSetNodeParams.
      
      Reviewed-by: imsnah
      82e12743
    • Guido Trotter's avatar
      Instance parameters: force typing · a5728081
      Guido Trotter authored
      We want all the hv/be parameters to have a known type, rather than a
      random mix of empty string, boolean values, and None, so we declare the
      type of each variable and we enforce/convert it.
      
      - Add some new constants for enforceable value types
      - Add new constants dicts HVS_PARAMETER_TYPES and BES_PARAMETER_TYPES
        holding not only the valid parameters but also their types
      - Drop the old HVS_PARAMETERS and BES_PARAMETERS constants and calculate
        the values from the type dict
      - Convert all the default parameters to a valid type value
      - Create a new ForceDictType utils function, to check/enforce a dict's
        element value types, with relevant unit tests
      - Drop a few custom functions to check/convert the BE param types in
        utils and cli, in favor of ForceDictType
      - Double-check the parameter types using ForceDictType in both scripts
        and LogicalUnits, when possible.
      
      As a bonus:
      - Remove some old commented-out code in gnt-instance
      - Remove some already fixed FIXME
      - Fix a bug which prevented VALUE_DEFAULT to be applied to BE parameters
        in SetInstanceParams because the value was checked for validity before
        that transformation was made
      - Fix a bug which prevented initing a cluster and passing hvparams to
        work at all
      - ForceDictType allows an allowed_values for exceptions, which makes us
        able to do the checking even when some values must not be
        converted/typechecked (for example the 'default' string in
        SetInstanceParameters)
      
      Reviewed-by: iustinp
      a5728081
    • Iustin Pop's avatar
      Implement modification of the drained flag · c9d443ea
      Iustin Pop authored
      This patch adds LU and cli-level support for modification of the node
      drained flag. It is similar to the offline changes.
      
      Reviewed-by: imsnah
      c9d443ea
    • Iustin Pop's avatar
      Prevent allocations on drained nodes · 733a2b6a
      Iustin Pop authored
      This patch adds checks for drained nodes in the logical units that
      allocate or move instances around. We also update an error message (not
      style-compliant).
      
      Reviewed-by: imsnah
      733a2b6a
    • Iustin Pop's avatar
      cluster verify: show correctly drained nodes · 22f0f71d
      Iustin Pop authored
      This patch changes slightly the output of gnt-cluster verify for drained
      nodes, and also adds a note with the total number of drained nodes
      (similar to the offline nodes note).
      
      Reviewed-by: imsnah
      22f0f71d
    • Iustin Pop's avatar
      ConfigWriter: handle the drained node flag · 5bf07049
      Iustin Pop authored
      This patch changes the master candidate pool computations in
      ConfigWriter to properly handle drained nodes. They are now excluded
      from counting towards the reachable number of candidates.
      
      The patch also adds verification of consistency for the node status.
      
      Reviewed-by: imsnah
      5bf07049
    • Iustin Pop's avatar
      burnin: do not use drained nodes · e8d47209
      Iustin Pop authored
      This patch updates burnin not to use drained nodes (similar to the
      handling of offline nodes).
      
      Reviewed-by: imsnah
      e8d47209
    • Iustin Pop's avatar
      dumb allocator: do not use drained nodes · 7d26425f
      Iustin Pop authored
      This patch changes the dumb allocator not to use drained nodes (similar
      to offline nodes).
      
      Reviewed-by: imsnah
      7d26425f
    • Iustin Pop's avatar
      Allow query of the drained node attribute · 0b2454b9
      Iustin Pop authored
      This patch exports the drained attribute:
        - LUQueryNodes accepts now the drained field
        - RAPI exports it for node objects
        - gnt-node info shows it now (along newly-added master_candidate and
          offline flags)
        - gnt-node list can list it (but not by default)
        - to the iallocator scripts
      
      Reviewed-by: imsnah
      0b2454b9
    • Iustin Pop's avatar
      Add a ‘drained’ attribute to node objects · af64c0ea
      Iustin Pop authored
      This attribute will be used to prevent any allocation on the node (any
      of replace-disks with new secondary this node, failover to the node,
      migration to the node).
      
      The patch adds the attribute and initializes it correctly in cluster
      init and for new nodes.
      
      Reviewed-by: imsnah
      af64c0ea
    • Iustin Pop's avatar
      Some error message cleanups · 33bc6f01
      Iustin Pop authored
      Reviewed-by: imsnah
      33bc6f01
    • Iustin Pop's avatar
      Cleanup of DRBD8._CheckMetaSize · 9c793cfb
      Iustin Pop authored
      This patch converts the _CheckMetaSize method to raise exceptions
      instead of logging and returning False. This fits now in the new rpc
      return types, so it's a cheap change.
      
      Reviewed-by: ultrotter
      9c793cfb
    • Iustin Pop's avatar
      Change the disk assembly to raise exceptions · 1063abd1
      Iustin Pop authored
      This big patch converts the bdev Assemble() methods and the supporting
      functions to raise exceptions instead of returning False. This is a big
      patch, since the assembly functions touch other functions: add children,
      creation, etc. However, the patch does not add much new code, rather it
      reworks existing code.
      
      One of the biggest changes is in the rework of the DRBD8._SlowAssemble()
      method (one of the most complicated/ugly ones). Hopefully the new
      version is a little bit more readable.
      
      Reviewed-by: ultrotter
      1063abd1
    • Iustin Pop's avatar
      Change BlockDev.Remove() failure result · 0c6c04ec
      Iustin Pop authored
      Currently, the Remove() methods of block devices return True/False.
      This doesn't permit any error detail reporting.
      
      This patch changes the return type to None for success, and raises
      BlockDeviceError in case of failure. This permits the details to be
      passed up the stack.
      
      The patch also simplifies a little the Remove method of file-based
      devices (no stat first, just try unlink).
      
      Reviewed-by: ultrotter
      0c6c04ec
    • Iustin Pop's avatar
      Switch the blockdev_remove rpc to (status, data) · e1bc0878
      Iustin Pop authored
      This converts the backend and cmdlib modules to a (status, data)
      implementation of the blockdev_remove rpc call. bdev.py is not yet
      converted, so we don't actually have error information.
      
      We also fix a bug in _RemoveDisks by not reusing a variable.
      
      Reviewed-by: ultrotter
      e1bc0878
    • Iustin Pop's avatar
      Change BlockDev.Shutdown() failure result · 746f7476
      Iustin Pop authored
      Currently, the Shutdown() methods of block devices return True/False.
      This doesn't permit any error detail reporting.
      
      This patch changes the return type to None for success, and raises
      BlockDeviceError in case of failure. This permits the details to be
      passed up the stack.
      
      For LVM and file-backed devices, this is a simple change. For DRBD, we
      first remove the shutdown of disks in case of network activation
      failures (since with static minors the minor is used anyway, we don't
      gain anything by clearing it), and the we simply change _ShutdownAll()
      to raise an exception.
      
      Reviewed-by: ultrotter
      746f7476
    • Iustin Pop's avatar
      Switch the blockdev_shutdown rpc to (status, data) · cacfd1fd
      Iustin Pop authored
      This converts the backend and cmdlib modules to a (status, data)
      implementation of the blockdev_shutdown rpc call. bdev.py is not yet
      converted, so we don't actually have error information.
      
      We also fix a bug in _ShutdownInstanceDisks by not reusing a variable.
      
      Reviewed-by: ultrotter
      cacfd1fd
    • Iustin Pop's avatar
      Convert blockdev_assemble rpc to (status, data) · 53c14ef1
      Iustin Pop authored
      This converts the RPC call blockdev_assemble to the new-style result
      format. Note that we won't usually have error information, but it's the
      first step toward it.
      
      Reviewed-by: ultrotter
      53c14ef1