1. 16 Nov, 2012 3 commits
  2. 15 Nov, 2012 4 commits
    • Michael Hanselmann's avatar
      Move gnt_cluster.SHOW_MACHINE_OPT to cli · f92ed8ab
      Michael Hanselmann authored
      
      
      This allows the option to be re-used in other places.
      Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
      Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
      f92ed8ab
    • Guido Trotter's avatar
      Add ganeti-node-role ocf example file · 17071597
      Guido Trotter authored
      
      
      This allows offlining nodes that don't respond if they are part of a
      linux-HA cluster.
      Signed-off-by: default avatarGuido Trotter <ultrotter@google.com>
      Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
      17071597
    • Guido Trotter's avatar
      Add ganeti-master-role.ocf example file · aa75500a
      Guido Trotter authored
      
      
      This allows controlling the cluster master role if the nodes are part of
      a linux-HA cluster.
      Signed-off-by: default avatarGuido Trotter <ultrotter@google.com>
      Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
      aa75500a
    • Iustin Pop's avatar
      Cleanup THH function use from built module namespace · 32a569fe
      Iustin Pop authored
      
      
      Currently, THH.hs "injects" into the built code names of library
      functions like Text.JSON.makeObj, Ganeti.JSON.fromObj, etc. built
      directly from strings, via (e.g.)
      
        varE (mkName "makeObj")
      
      This means that the "makeObj" name must exist in the target module,
      i.o.w. must be imported there. This leads to the strange case of
      having to have imports that do not appear at all in the used
      (template) code, but are needed to satisfy this "hidden" dependency;
      look at Ganeti/Jobs.hs before this patch, for example.
      
      This is also not very obvious, because we usually import Text.JSON
      anyway; I only stumbled upon it while doing some cleanup work.
      
      So to clean this up, the current patch changes the THH.hs to use not
      string-derived, but identifier-derived names («'identifier» versus
      «mkName "identifier"»); this is better, as the names must be
      resolvable when compiling THH itself (once), and not when compiling
      the multiple derived modules. As you can see, this allows removal of
      extraneous imports from various modules.
      
      Background information: an `mkName "foo"` results in a name of flavour
      NameS (“An unqualified name; dynamically bound”) or alternatively to a
      qualified name, but still dynamically bound. Whereas what we want is a
      statically bound name: `'foo` results in a NameG flavour, “Global name
      bound outside of the TH AST: An original name”.
      
      One more explanation: the change is similar to going from 'x = eval
      "map"' to 'x = map'; the name is no longer dynamically evaluated, but
      statically when the module is compiled. In our case, previously names
      were bound at target module compile time, now they are bound at THH.hs
      compile time.
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
      32a569fe
  3. 14 Nov, 2012 9 commits
  4. 13 Nov, 2012 14 commits
  5. 12 Nov, 2012 10 commits
    • Michael Hanselmann's avatar
      RunCmd: Expose "postfork" callback · 09b72783
      Michael Hanselmann authored
      
      
      The “_postfork_fn” parameter was only used for tests until now. To
      implement a good locking scheme, remote commands must also make use of
      this callback to release a lock when the command was successfully
      started (but did not yet finish).
      Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
      Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
      09b72783
    • Iustin Pop's avatar
      Merge branch 'devel-2.6' into master · 551a29df
      Iustin Pop authored
      
      
      * devel-2.6:
        Improve error message when migration status fail
        Fix type error in kvm/GetMigrationStatus
        Fix PID file writing in Haskell daemons
      
      Conflicts (both trivial):
              htools/Ganeti/Daemon.hs (_writePidFile rename)
              lib/hypervisor/hv_kvm.py (master fixed an indentation issue)
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
      551a29df
    • Iustin Pop's avatar
      Merge branch 'stable-2.6' into devel-2.6 · 112b6e89
      Iustin Pop authored
      
      
      * stable-2.6:
        Improve error message when migration status fail
        Fix type error in kvm/GetMigrationStatus
        Fix PID file writing in Haskell daemons
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
      112b6e89
    • Iustin Pop's avatar
      Improve error message when migration status fail · 4041a4e3
      Iustin Pop authored
      Commit 6a1434d7
      
       (“Make migration RPC non-blocking”) changed the API
      for reporting migration status, but has a small cosmetic bug: if the
      migration status if failure, but the RPC itself to get the status
      didn't fail, it shows the following error message:
      
        Could not migrate instance instance2: None
      
      since it always uses result.fail_msg, irrespective of which part of
      the if condition failed.
      
      This patch simply updates the msg if not already set, leading to:
      
        Could not migrate instance instance2: hypervisor returned failure
      
      Proper error display can be done once the migration status objects can
      return failure information as well, beside status.
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarHelga Velroyen <helgav@google.com>
      4041a4e3
    • Iustin Pop's avatar
      Fix type error in kvm/GetMigrationStatus · 62457f51
      Iustin Pop authored
      Commit 6a1434d7
      
       (“Make migration RPC non-blocking”) changed from
      raising HypervisorErrors to returning MigrationStatus
      objects. However, these objects don't have an "info" attribute, so
      they can't pass a reason back (which is in itself a bug); but the KVM
      hypervisor code attempts to do so, and fails at runtime with:
      
        Failed to get migration status: 'MigrationStatus' object has no attribute 'info'
      
      instead of the intended:
      
        Migration failed, aborting: too many broken 'info migrate' answers
      
      For now (on stable-2.6), let's just remove the "info" reason, and
      later we can add it back properly once we have a way to correctly
      represent migration status failures in the LU.
      
      This fixes issue 297.
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
      62457f51
    • Iustin Pop's avatar
      Fix PID file writing in Haskell daemons · a4c0fe1e
      Iustin Pop authored
      
      
      Currently, the code uses createFile, which has the effect of always
      truncating the file. This is bad, as the content of the PID file is
      wiped even when we wouldn't be able to lock it!
      
      We switch to openFd (createFile is just a wrapper over that), and we
      use an explicit set of flags; defaultFileFlags is already safe
      (trunc=False), but I prefer to set it explicitly with our desired
      flags.
      
      Note that this bug doesn't manifest in normal usage, as daemon-util
      won't try to start the daemon if already running. But if anyone or
      anything does call ganeti-confd explicitly, the pid file will be
      emptied and the daemon will keep trying to be restarted forever…
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
      a4c0fe1e
    • Iustin Pop's avatar
      Remove unsafePerformIO usage · 29a30533
      Iustin Pop authored
      
      
      We need to change a few things, most importantly CLI options defaults,
      but otherwise we already used the path to files from functions which
      were already in the I/O monad, so we don't have to change much of the
      code flow.
      
      Additionally, Path.hs now has an explicit export list, to stop
      accidental leakage of symbols.
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarHelga Velroyen <helgav@google.com>
      29a30533
    • Iustin Pop's avatar
      Change keyToFilename/readSSconfFile interaction · 37904802
      Iustin Pop authored
      
      
      Currently, keyToFilename uses itself the default config path. In the
      light of making that an function in the IO monad, let's remove the
      "default" path functionality from this function and make it always
      require the config path; its caller, readSSConfFile, can then do the
      maybe/default path change.
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
      37904802
    • Iustin Pop's avatar
      Change type of program options to 'IO [Options]' · d66aa238
      Iustin Pop authored
      
      
      Some options have defaults that depend on the environment, and we
      could handle these in two ways:
      
      - use a place-holder value (e.g. data X a = Default | Custom a) that
        is later read from the environment
      - move the options list to IO monad, where it can read the
        environment, etc.
      
      The second option allows also displaying the actual defaults in the
      `--help' output, even though it's not as nice, so I went with it.
      
      This patch only changes the option types, without actually changing
      any options yet.
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarHelga Velroyen <helgav@google.com>
      d66aa238
    • Iustin Pop's avatar
      Two small logging improvements · 48483a2e
      Iustin Pop authored
      
      
      The "starting" message is changed to match the Python one, and in case
      the preparation fails, we also log the error (beside printing it on
      stderr or writing it to the error reporting pipe), as at this time
      logging is usually set up.
      Signed-off-by: default avatarIustin Pop <iustin@google.com>
      Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
      48483a2e