1. 11 Feb, 2009 1 commit
    • 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
  2. 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
          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
      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
      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
      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
    • 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
  3. 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
      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
      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
      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
    • 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
      4978db17
  4. 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
      bc8e4a1a
    • 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
          opcodes
        - 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
      ec79568d
  5. 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
      26f15862
    • 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
      bafc1d90
  6. 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
      a1b805fb
  7. 01 Feb, 2009 1 commit
  8. 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
      group.
      
      Reviewed-by: iustinp
      2928f08d
    • 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
      5431b2e4
    • 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
      e9ce0a64
    • 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
      a7f5dc98
  9. 28 Jan, 2009 1 commit
  10. 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
      6ec66eae
  11. 23 Jan, 2009 4 commits
    • Iustin Pop's avatar
      Fix batcher for 2.0-style disks and nics · 9939547b
      Iustin Pop authored
      This patch fixes the gnt-instance batch-create command, and in doing so
      also slightly changes two other functions:
        - we change utils.ParseUnit so that it accepts integer values also
          (both ParseUnit(5) and ParseUnit("5") return the same value)
        - a bridge 'None' in LUCreateInstance will be converted to the default
          bridge; currently only missing bridges will be accepted to mean the
          default one
      
      The main changes to batcher were the change to variable number of disks
      and NICs.
      
      The patch also adds a batcher-instances.json example file copied from
      the 1.2 branch and properly modified.
      
      Reviewed-by: imsnah, killerfoxi
      9939547b
    • Iustin Pop's avatar
      Make iallocator work with offline nodes · 1325da74
      Iustin Pop authored
      This patch changes the iallocator framework to work with and properly
      export to plugins offline nodes. It does this by only exporting the
      static configuration data for those nodes, and not attempting to parse
      the runtime data.
      
      The patch also fixes bugs in iallocator related to the RpcResult
      conversion, changes the should_run to admin_up attribute name (as per
      the internals change), and adds “-I” as a short option for
      “--iallocator” in gnt-instance, gnt-backup and burnin.
      
      Reviewed-by: ultrotter
      1325da74
    • Iustin Pop's avatar
      Remove checking of DRBD metadata for validity · 3b559640
      Iustin Pop authored
      Currently the DRBD code checks that the metadata devices are valid
      before creation, initial disk attachment and add children.
      
      However, the process for checking validity requires a free DRBD minor,
      and this conflict with parallel checking.
      
      There are at least three possible solutions:
        - serialize all checks, which means we reduce parallelism and need
          extra locks
        - don't pass a valid minor number, but one like “/dev/drbd256” (which
          is invalid); this works for current version of DRBD, but since it's
          not guaranteed to remain so it doesn't look nice
        - don't do the checking at all, and rely on “drbdsetup ... disk ...”
          to fail by itself
      
      The reason for checking metadata was that in 1.2, this was much cheaper
      than trying to activate devices (and the subsequent iteration over the
      minors). However, in 2.0, they have the same cost, so we can choose
      option 3: just remove the explicit checking and rely on drbdsetup and
      the kernel to fail.
      
      Since DRBD8._InitMeta still requires a minor number, the two places
      where this is run are handled as follows:
        - Create: we just use our own (unused currently) minor number
        - AddChildren: we keep using FindUnusedMinor, with the caveat that
          this function (used by replace-disks -n ...) cannot be yet
          parallelized
      
      Reviewed-by: ultrotter
      3b559640
    • Iustin Pop's avatar
      A couple of small fixes to iallocator · 8901997e
      Iustin Pop authored
      This removes some constraints:
        - only two disks supported, this is no longer true as the underlying
          functions can now compute size for a variable number of disks
        - error when the hypervisor was not being passed
        - typo error
      
      Reviewed-by: imsnah
      8901997e
  12. 21 Jan, 2009 3 commits
    • Iustin Pop's avatar
      Automatically release DRBD minors on success · 61cf6b5e
      Iustin Pop authored
      This patch converts the DRBD minors reservation protocol from explicit
      release to automatic release on the success paths. On the errors paths,
      it's still needed to manual release.
      
      The patch doesn't bring much by itself, but is needed for a future patch
      which enhances the automatic verification of configuration consistency.
      
      Reviewed-by: ultrotter
      61cf6b5e
    • Iustin Pop's avatar
      Change the instance status attribute to boolean · 0d68c45d
      Iustin Pop authored
      Due to historic reasons, the “should run or not” attribute of an
      instance was denoted by its “status” attribute having a string value of
      either ‘up’ or ‘down’. Checking this is in code was done via hardcoding
      of the strings.
      
      This was long done for a redo, and this patch changes this attribute to
      “admin_up” having a boolean value. The patch is in fact shorter than I
      expected, and passes burnin.
      
      The patch also fixes an error in BuildInstanceHookEnvByObject where the
      instance.os was passed as the status value.
      
      Reviewed-by: ultrotter
      0d68c45d
    • Guido Trotter's avatar
      Add calls in the intra-node migration protocol · 6906a9d8
      Guido Trotter authored
      Currently the hypervisor is expected to do all the migration from the
      source side. With this patch we also add the option of passing some
      information to the target side, and starting some operation there.
      
      As a bonus, a function to cleanup any started operation is included.
      
      Reviewed-by: iustinp
      6906a9d8
  13. 20 Jan, 2009 3 commits
    • Iustin Pop's avatar
      Convert RenameInstance to (status, data) · 96841384
      Iustin Pop authored
      This allows the rename failures to show the ouput of OS scripts.
      
      Reviewed-by: ultrotter
      96841384
    • Iustin Pop's avatar
      Fix adding of disks to an instance · 32388e6d
      Iustin Pop authored
      The ConfigWriter.AllocateDRBDMinor requires the instance name, not the
      instance object. The LUSetInstanceParms is passing wrongly the instance
      object, which can cause breakage.
      
      The patch also adds asserts to check for this mismatch in ConfigWriter.
      
      Reviewed-by: ultrotter
      32388e6d
    • Iustin Pop's avatar
      Make cluster-verify check the drbd minors space · 6d2e83d5
      Iustin Pop authored
      This patch adds support for verification of drbd minors space in cluster
      verify: minors which belong to running instances and should be online
      but are not, and minors which do not belong to any instace but are in
      use.
      
      The patch requires exposing some methods from bdev.DRBD8 and
      config.ConfigWriter which were until now private methods.
      
      Reviewed-by: ultrotter
      6d2e83d5