1. 10 Feb, 2009 23 commits
    • 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
    • Iustin Pop's avatar
      RAPI: fix a pylint warning · 7a6b9510
      Iustin Pop authored
      Child classes of _R_TAGS must define TAG_LEVEL, but for good style let's
      define it also here to at least ensure we don't get a 'Unknown
      attribute' exception.
      
      Of course, this also silences a pylint warning.
      
      Reviewed-by: amishchenko
      7a6b9510
    • Guido Trotter's avatar
      LUSetInstanceParams: use the correct hvparams · 12649e35
      Guido Trotter authored
      In LUSetInstanceParam we used to save the dict without defaults for the
      instance params as hv_inst, but to use the populated one for the
      instance (hv_new). Fixing this leads to instances without all the
      parameters set.
      
      Reviewed-by: iustinp
      12649e35
    • Guido Trotter's avatar
      KVM: Correct CheckParameterSyntax docstring · 5c418644
      Guido Trotter authored
      The comment is not really true anymore, as we have a lot of parameters
      nowadays.
      
      Reviewed-by: iustinp
      5c418644
    • Guido Trotter's avatar
      KVM: Fix _CallMonitorCommand error message · 9798fcae
      Guido Trotter authored
      1) Only instance_name is available
      2) There was a missing string parameter
      
      Reviewed-by: iustinp
      9798fcae
    • Iustin Pop's avatar
      Fix one more RAPI QA test · 68289c75
      Iustin Pop authored
      This was skipped in the previous QA patch.
      
      Reviewed-by: imsnah
      68289c75
  2. 09 Feb, 2009 17 commits
    • Guido Trotter's avatar
      KVM: Add usb mouse type parameter · 11344a50
      Guido Trotter authored
      In some cases 'mouse' may work better than 'tablet', so we'll handle
      both by allowing the user to specify a parameter. By default no mouse is
      used.
      
      Reviewed-by: iustinp
      11344a50
    • Guido Trotter's avatar
      KVM: allow netboot · 8745c3d7
      Guido Trotter authored
      With this patch we allow KVM instances to be booted off the network.
      The only issue is that this is not compatible with virtio nics, so
      we disallow them, when booting from the net.
      
      Reviewed-by: iustinp
      8745c3d7
    • Guido Trotter's avatar
      KVM: actually support different nic types · 37f88dc6
      Guido Trotter authored
      When executing the KVM runtime we load the nic type from the runtime
      hvparams and use it to specify the nic model type. As for the disk we
      translate the DEV_PARAVIRTUAL type to 'virtio'.
      
      Reviewed-by: iustinp
      37f88dc6
    • Guido Trotter's avatar
      KVM: export hvparams in the runtime · c2672466
      Guido Trotter authored
      They'll be used to set the nic type when we execute the runtime, since
      the nics are processed later. We need to save the hvparams because we
      want to use the same one as when we saved the runtime, rather than use
      the current instance ones, to avoid applying only some changed
      parameters when the runtime is loaded.
      
      Reviewed-by: iustinp
      c2672466
    • Guido Trotter's avatar
      KVM: actually support different disk types · 1213604d
      Guido Trotter authored
      By passing the relevant if= value to the disk we support different disk
      types. The only change is that we'll translate "paravirtual" to
      "virtio" to keep only one "paravirtualized" value, around ganeti. The
      if= value is calculated outside the disks loop, as it's the same for all
      disks (as currently ganeti doesn't support per-disk params).
      
      Reviewed-by: iustinp
      1213604d
    • Guido Trotter's avatar
      Xen-HVM: Improve the invalid disk/nic type error · 5155ede7
      Guido Trotter authored
      Copy the message from the KVM one, adding a missing 'the' and a list of
      possible values, to help the user in his decision.
      
      Reviewed-by: iustinp
      5155ede7
    • Guido Trotter's avatar
      KVM: parameters for different disk and nic types · 43440815
      Guido Trotter authored
      - Add a bunch of NICs and DISKs types
      - Specify which one are valid disks and nics for KVM (the new ones
        toghether with some of the old ones)
      - Add the default values (paravirtual)
      - Allow the disk and nic types as parameters and check their validity
      
      Reviewed-by: iustinp
      43440815
    • Guido Trotter's avatar
      Rename the device type constants · d08f6067
      Guido Trotter authored
      These are not HVM specific, so have been given an HT generic name.
      
      Reviewed-by: iustinp
      d08f6067
    • Guido Trotter's avatar
      s/HT_HVM_VNC_BASE_PORT/VNC_BASE_PORT/g · 377d74c9
      Guido Trotter authored
      The VNC base port has nothing to do with HVM itself, and is general to
      VNC itself, so we're removing the HT_HVM prefix to the constant.
      
      Reviewed-by: iustinp
      377d74c9
    • Iustin Pop's avatar
      Add a new instance query flag ‘disk_usage’ · 024e157f
      Iustin Pop authored
      This patch adds a new instance query flag called disk_usage that
      retrieves the overall space used by an instance on each of its nodes.
      This can be used when balancing the cluster or checking N+1 status.
      
      The flag is also exported in RAPI. Note the flag is currently broken for
      file-based instances, as it represents the amount of space in the
      cluster volume group.
      
      Reviewed-by: ultrotter
      024e157f
    • Iustin Pop's avatar
      Uniformize some function names in backend.py · 821d1bd1
      Iustin Pop authored
      Currently, the names of the functions in backend.py that are actually
      RPC procedures and are called from ganeti-noded are not corresponding to
      the RPC names. This makes it hard to actually see which functions are
      exported and which functions are internal to backend.
      
      This patch renames all blockdevice-related functions in backend.py match
      the name of the RPC call (without the ‘call’ or ‘perspective’ prefix).
      This should make it easier to grep for a given function called in
      cmdlib, without having to open and check in ganet-inoded what backend
      function it corresponds to.
      
      The patch also does two minor extra cleanups (rename a variable and
      change a logging level).
      
      Reviewed-by: ultrotter
      821d1bd1
    • Iustin Pop's avatar
      bdev: add and use two utility functions · 82463074
      Iustin Pop authored
      This patch adds two utility functions for raising BlockDeviceError
      exceptions and for running functions while ignoring this error. Most of
      the manual “raise errors.BlockDeviceError” cases are converted to
      _ThrowError, as this makes the code clearer.
      
      We also change most of the DRBD error messages to include the minor
      number because with the parallel execution of commands it's not longer
      possible to identify the failed DRBD just from the timestamp, and the
      minor number can be mapped back to the instance easier.
      
      Reviewed-by: ultrotter
      82463074
    • Iustin Pop's avatar
      rpc.call_blockdev_find: convert to (status, data) · 23829f6f
      Iustin Pop authored
      This patch converts the call_blockdev_find - which searches for block
      devices and returns their status - to the (status, data) format. We also
      modify the backend function name to match the rpc call.
      
      Reviewed-by: ultrotter
      23829f6f
    • Iustin Pop's avatar
      Export the cpu nodes and sockets from Xen · 0105bad3
      Iustin Pop authored
      This is a hand-picked forward patch of commit 1755 on the 1.2 branch
      (hand-picked since the trees diverged too much since then):
      
          The patch changed the xen hypervisor to compute the number of cpu
          sockets/nodes and enables the command line and the RAPI to show this
          information (for RAPI is enabled by default in node details, for gnt-one
          one can use the new “cnodes” and “csockets” fields).
      
          Originally-Reviewed-by: ultrotter
      
      For the KVM and fake hypervisors, the patch just exports 1 for both
      nodes and sockets. This can be fixed, by looking at the
      /sys/devices/system/cpu/cpuN/topology directories, and computing the
      actual information, but that should be done in a separate patch.
      
      Reviewed-by: imsnah
      0105bad3
    • Iustin Pop's avatar
      Fix handling OS errors in AddOSToInstance · 1268d6fd
      Iustin Pop authored
      This patch fixes the error handling in the add OS to instance function
      with regard to invalid OSes. Previously, we didn't handle any such
      errors, with the end result that the user would have to look in the node
      daemon log.
      
      The patch also renames the name of the function to match the RPC call
      name.
      
      Reviewed-by: ultrotter
      1268d6fd
    • Iustin Pop's avatar
      backend.DrbdAttachNet: don't ignore Open() errors · d3da87b8
      Iustin Pop authored
      Currently the return value or errors from the block device Open() method
      are ignored. This patch catches any BlockDeviceErrors and returns a
      well-formatted result.
      
      Reviewed-by: ultrotter
      d3da87b8
    • Iustin Pop's avatar
      cmdlib: simplify some rpc error handling cases · 0959c824
      Iustin Pop authored
      By using the RemoteFailMsg() or the payload field of RpcResult, we can
      simplify a few functions in cmdlib.
      
      Reviewed-by: ultrotter
      0959c824