1. 16 Feb, 2009 1 commit
    • Iustin Pop's avatar
      Convert IOErrors for /proc/drbd into our errors · f6eaed12
      Iustin Pop authored
      If /proc/drbd can't be opened, this raises an IOError, but all the
      error-handling behaviour in backend treats only BlockDeviceErrors. This
      creates a plain failure in cluster verify and in other RPC calls.
      This patch simply converts EnvironmentErrors into BlockDeviceErrors, and
      also changes the RPC result for NV_DRBDLIST and its handling to be able
      to show the error. The other RPC calls work by default now, due the
      existing error handling.
      Reviewed-by: ultrotter
  2. 13 Feb, 2009 1 commit
    • Guido Trotter's avatar
      SetInstanceParams: export nic changes to hooks · d8dcf3c9
      Guido Trotter authored
      Currently we export the old instance "as is" and any nic changes get
      lost, so hooks won't know of a different ip, bridge, or mac address.
      This patch fixes it by putting the nics in the override dict, if any
      changes are done.
      Reviewed-by: iustinp
  3. 12 Feb, 2009 7 commits
    • Guido Trotter's avatar
      LUSetInstanceParams: Fix nic handling · 5c44da6a
      Guido Trotter authored
        Use constants.VALUE_NONE rather than hardcoding the string "none"
        If we're adding a nic fill the nic_dict with default values
        Check if the mac is syntactically valid, if we have one
        Don't allow the mac to be 'auto' when modifying a nic
        Check that bridge and mac if present in the dict are not None
          (before this wasn't handled at all)
        Generate the nic mac address here if demanded
        Do not generate nics and macs
      Reviewed-by: iustin
    • Guido Trotter's avatar
      Instance Creation: generate nics earlier · 295728df
      Guido Trotter authored
      We want the real nic to be shown to the hooks and the allocators, so
      we'll generate them in CheckPrereq. We also write a comment about the
      race condition we generate. This race condition existed even before, so
      moving this generation will just lenghen it a bit. A separate patch
      mitigates its effects.
      This patch also adds an ENDIF comment for a very long if, and removes a
      double empty line inside the CheckPrereq function of LUCreateInstance.
      Reviewed-by: iustin
    • 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
    • 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
    • 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
      Reviewed-by: ultrotter
    • 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
    • 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
      Reviewed-by: ultrotter
  4. 11 Feb, 2009 2 commits
    • 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
    • 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
  5. 10 Feb, 2009 11 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
        - 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
    • 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
      Reviewed-by: iustinp
    • 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
    • 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
      Reviewed-by: imsnah
    • 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
    • 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
    • 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
    • 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
    • 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
    • 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
    • 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
  6. 09 Feb, 2009 6 commits
    • 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
    • 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
    • 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
    • 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
    • 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
    • Iustin Pop's avatar
      LUCreateInstance: only set running flag at the end · 4978db17
      Iustin Pop authored
      In lockless queries, it's better if we see the instance in ADMIN_down
      rather than ERROR_down during the time it's installed. As such, we
      change the LU to only mark the instance 'up' at the time we are ready to
      start it.
      Reviewed-by: ultrotter
  7. 04 Feb, 2009 2 commits
    • Iustin Pop's avatar
      Enable lockless node queries · bc8e4a1a
      Iustin Pop authored
      Similar to the instance list, this patch enables lockless node queris.
      “gnt-node list” accepts now the “--sync” flag which enables locking, the
      default is lockless.
      Reviewed-by: imsnah
    • Iustin Pop's avatar
      Implement lockless query operations · ec79568d
      Iustin Pop authored
      This patch adds the framework for, and enables lockless OpQueryInstances. This
      means that instances will be shown in ERROR_up or ERROR_down state, even though
      this is not an error (but just an in-progress job).
      The framework is implemented as follows:
        - the OpQueryInstances, OpQueryNodes and OpQueryExports opcodes take
          an additional “use_locking” flag which will denote whether to lock
          or not; this patch only implements this for LUQueryInstances
        - the luxi query functions take an additional argument use_locking
          which is passed to the master daemon, and then passed to the above
        - cli.py export a new SYNC_OPT command line options which implement
          setting this flag to true
        - except for gnt-instance list, which uses this option, and for
          name-only queries (e.g. QueryNodes(fields=["names"])), all other
          callers are setting this flag to True
        - RAPI also sets the flag to True
      The patch was tested with a continuous (0.2s sleep in-between)
      gnt-instance list during a burnin, and no problems were observed.
      Reviewed-by: ultrotter
  8. 03 Feb, 2009 2 commits
    • Iustin Pop's avatar
      An attempt at fixing some encoding issues · 26f15862
      Iustin Pop authored
      This patch unifies the hardcoded re-encoding attempts into a single
      function in utils.py. This function is used to take either an unicode or
      str object and convert it to a ASCII-only str object which can be safely
      displayed and transmitted.
      We replace then the current manual re-encodings with this function. In
      mcpu we stop re-encoding the hooks output and instead we do it right at
      the hook generation in backend.py.
      This passes on my 'custom' lvs output with non-ASCII chars. But there
      are probably other places we will need to fix.
      Reviewed-by: ultrotter
    • Iustin Pop's avatar
      Small patch for handling errors in node add · bafc1d90
      Iustin Pop authored
      This small path hopefully fixes the handling of ssh verify errors in
      node add (note: untested).
      Reviewed-by: ultrotter
  9. 02 Feb, 2009 1 commit
    • Iustin Pop's avatar
      Return error messages in node add ssh handling · a1b805fb
      Iustin Pop authored
      When the rpc call node_add fails, we don't have any error message. This
      patch changes the call to return (status, data) so that the user can see
      the correct error message.
      Reviewed-by: imsnah
  10. 01 Feb, 2009 1 commit
  11. 29 Jan, 2009 4 commits
    • Guido Trotter's avatar
      LUAddNode: copy the vnc password file also for KVM · 2928f08d
      Guido Trotter authored
      Before we used to copy the file if xen-hvm was enabled on the cluster,
      no we'll do that if any enabled hypervisor is in the new HTS_USE_VNC
      Reviewed-by: iustinp
    • Guido Trotter's avatar
      GetShellCommand: get hvparams and beparams · 5431b2e4
      Guido Trotter authored
      Sometimes the hypervisor will use the instance hv and/or be parameters
      to determine the best shell command. This is not possible, though,
      currently, as the instance hv/beparams are not filled, so we have to
      pass the filled versions separately.
      Reviewed-by: iustinp
    • Iustin Pop's avatar
      Implement software release version checks too · e9ce0a64
      Iustin Pop authored
      Currently the LUVerifyCluster only reports the protocol version changes,
      not software ones. This is useful to know/monitor, so we add this too as
      a warning.
      Reviewed-by: ultrotter
    • Iustin Pop's avatar
      LUQueryInstances: keep the given order of names · a7f5dc98
      Iustin Pop authored
      Currently LUQueryInstances keeps the ordering of instances only in some cases,
      and in others it will reorder the list. This patch fixes this by more clearly
      separating the various cases (names passed or not and locking or not locking),
      so that the output list is in the same order as always.
      Of course, this disables the sorting when arguments are passed.
      Reviewed-by: ultrotter
  12. 28 Jan, 2009 1 commit
  13. 27 Jan, 2009 1 commit
    • Iustin Pop's avatar
      Fix the mode attribute of newly-created disks · 6ec66eae
      Iustin Pop authored
      Currently, only the LUSetInstanceParams correctly sets up the mode
      attribute via a manual operation. We remove this and instead do the
      correct setting in the generic _GenerateDiskTemplate function, so that
      we set the mode correctly for all disk creations.
      Reviewed-by: ultrotter