1. 24 Apr, 2009 2 commits
    • Iustin Pop's avatar
      Fix verify-disks with broken volume groups · ea9ddc07
      Iustin Pop authored
      When a remote node returns invalid LVM data, we check it, but we don't
      stop and continue with the rest of the checks (which require a valid
      volume group). This raises an internal error and breaks verify disks.
      
      This seems unchanged for a long while, I don't know why it surfaced just
      recently.
      
      Reviewed-by: ultrotter
      ea9ddc07
    • Iustin Pop's avatar
      Prevent errors when xenvg is broken cluster verify · 9a198532
      Iustin Pop authored
      When vg_name is not returned at all, we currently abort with an internal
      error. This is because we don't catch KeyError.
      
      This patch adds a custom message for this case, and also adds KeyError
      to the list of catched exceptions, just for safety.
      
      On the other hand, we could also just remove this piece of code since
      it's not used at all the ["dfree"] value.
      
      Reviewed-by: ultrotter
      9a198532
  2. 15 Apr, 2009 1 commit
    • Iustin Pop's avatar
      A bunch of doc and other small fixes · 949bdabe
      Iustin Pop authored
      This patch adds a couple of both externally and internally reported
      issues:
        - missing SGML tags (Issue 54), report and patch by superdupont
        - wrong variable used in the init.d script, report and patch by
          Karsten Keil <karsten-keil@t-online.de>
        - man page for gnt-instance reinstall needs clarification (Issue 56)
        - gnt-instance man page missing --disks documentation for
          replace-disks
        - gnt-node modify help output is unclear about the -C/-D/-O input
          format, and the man page doesn't document this command at all
        - “gnt-node modify -C yes” for offline or drained nodes had wrong
          error message
        - “gnt-instance reinstall --select-os” has wrong prompt, we only
          accept a number for the OS and not the template name
      
      Reviewed-by: ultrotter
      949bdabe
  3. 09 Mar, 2009 2 commits
    • Iustin Pop's avatar
      Handle ghost instances in temp DRBD map · c614e5fb
      Iustin Pop authored
      Currently cluster-verify doesn't handle the (admitedly invalid) case where we
      have reservation for instances that were removed in the meantime.
      
      This patch adds a check for this and prevents code errors in cluster-verify in
      this case:
       * Verifying node node4.example.com (master candidate)
         - ERROR: ghost instance \'instance3.example.com\' in temporary DRBD map
      
      Reviewed-by: imsnah
      c614e5fb
    • Iustin Pop's avatar
      Fix error handling in replace-disks with new node · 82759cb1
      Iustin Pop authored
      Currently the _CreateSingleBlockDev function only raises OpExecError and not
      BlockDeviceError. This means that we don't release the instance's temporary
      minors properly, and this creates problems later if the instance is removed
      without master restart.
      
      We could just use OpExecError, but adding it and leaving
      BlockDeviceError in seems safer.
      
      Reviewed-by: imsnah
      82759cb1
  4. 02 Mar, 2009 2 commits
    • Iustin Pop's avatar
      Export tags to cluster verify hooks · 35e994e9
      Iustin Pop authored
      This patch export the cluster and node tags to the cluster verify hook
      scripts. The tags are exported as a space-separated list, which allows
      easy parsing from the shell (e.g. “for tag in $GANETI_CLUSTER_TAGS; do
      ...”) and therefore requires the previous “Don't allow spaces in tag
      names” patch.
      
      The patch also fixes a minor line length style problem.
      
      Reviewed-by: ultrotter
      35e994e9
    • Iustin Pop's avatar
      Update the iallocator documentation · 77031881
      Iustin Pop authored
      This updates the iallocator documentation to 2.0, bumps up the
      iallocator version (and moves a constants to lib/constants.py), and
      fixes a style on install.rst.
      
      Reviewed-by: ultrotter
      77031881
  5. 27 Feb, 2009 2 commits
    • Guido Trotter's avatar
      LUVerifyCluster: Handle the "no volume group" case · cc9e1230
      Guido Trotter authored
      If we're only file based and out volume group is set to "None" there's
      no point in asking nodes for their volume groups, logical volumes, and
      drbd devices, and checking those.
      
      Reviewed-by: iustinp
      cc9e1230
    • Iustin Pop's avatar
      Fix some epydoc style issues · 5fcc718f
      Iustin Pop authored
      99% of the epydoc return tags are "@return:", but each of the modified files
      had one "@returns:" line. We fix this for consistency.
      
      Reviewed-by: imsnah
      5fcc718f
  6. 25 Feb, 2009 1 commit
    • Iustin Pop's avatar
      Update some hooks settings · 2c2690c9
      Iustin Pop authored
      While reviewing the hooks document, I realised we are not correctly
      exporting the instance properties.
      
      This patch fixes:
        - export the disk and disk template in all LUs, not only (hardcoded)
          in the instance create
        - removes the instance create INSTANCE_ prefix on some non-instance
          variables (those are LU-related, not instance-related)
        - adds a couple of more variables to other LUs
      
      The hook document will be updated in a separate patch.
      
      Reviewed-by: ultrotter
      2c2690c9
  7. 24 Feb, 2009 2 commits
    • Iustin Pop's avatar
      Remove the extra_args parameter in instance start · 07813a9e
      Iustin Pop authored
      This patch removes the extra_args parameter and instead switches the
      instance to the HV_KERNEL_ARGS hypervisor option.
      
      This is a big change, but it's a needed cleanup, this extra parameter on
      all RPC calls is not generic and we also need to have a persistent value
      here.
      
      Reviewed-by: imsnah
      07813a9e
    • Iustin Pop's avatar
      Make gnt-instance info work with offline nodes · 9854f5d0
      Iustin Pop authored
      This simply makes LUQueryInstanceData return the same information as for
      a static query when one or both of the nodes are down.
      
      Reviewed-by: imsnah
      9854f5d0
  8. 16 Feb, 2009 2 commits
    • Iustin Pop's avatar
      Fix some bugs in reboot · ae48ac32
      Iustin Pop authored
      There are two issues fixed in this patch:
        - first, the recent RPC changes caused loss of data in hard reboot
          type; we weren't reporting any results from the stop/start instance
          calls;
        - second, in soft or hard reboots, we didn't initialized the disk
          physical ID; based on the last state of the instance's disks, this
          can create a failure in identifying the disks
      
      After this patch, burnin works again with reboot, and reports errors
      correctly.
      
      Reviewed-by: imsnah
      ae48ac32
    • 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
      f6eaed12
  9. 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
      d8dcf3c9
  10. 12 Feb, 2009 7 commits
    • Guido Trotter's avatar
      LUSetInstanceParams: Fix nic handling · 5c44da6a
      Guido Trotter authored
      CheckArguments:
        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
      
      CheckPrereq:
        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
      
      Exec:
        Do not generate nics and macs
      
      Reviewed-by: iustin
      5c44da6a
    • 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
      295728df
    • 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
    • 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
      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
  11. 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
      43e99cff
    • 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
  12. 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
  13. 09 Feb, 2009 5 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