diff --git a/htools/Ganeti/Daemon.hs b/htools/Ganeti/Daemon.hs index 33a9f1c6ff52d2b7187b5c215911741d3931fa40..8ad7387964a96857a260672b48eb7256c332de5d 100644 --- a/htools/Ganeti/Daemon.hs +++ b/htools/Ganeti/Daemon.hs @@ -201,14 +201,19 @@ parseArgs cmd options = do parseOpts defaultOptions cmd_args cmd (options ++ genericOpts) [] -- * Daemon-related functions + -- | PID file mode. pidFileMode :: FileMode pidFileMode = unionFileModes ownerReadMode ownerWriteMode +-- | PID file open flags. +pidFileFlags :: OpenFileFlags +pidFileFlags = defaultFileFlags { noctty = True, trunc = False } + -- | Writes a PID file and locks it. writePidFile :: FilePath -> IO Fd writePidFile path = do - fd <- createFile path pidFileMode + fd <- openFd path ReadWrite (Just pidFileMode) pidFileFlags setLock fd (WriteLock, AbsoluteSeek, 0, 0) my_pid <- getProcessID _ <- fdWrite fd (show my_pid ++ "\n") diff --git a/lib/cmdlib.py b/lib/cmdlib.py index 18c54e32180f1cd4f136a0c3893ad213d0697bd0..53b41296cfcb8676ba4375f0c7f11297a559d6d4 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -8631,6 +8631,8 @@ class TLMigrateInstance(Tasklet): self.feedback_fn("Migration failed, aborting") self._AbortMigration() self._RevertDiskStatus() + if not msg: + msg = "hypervisor returned failure" raise errors.OpExecError("Could not migrate instance %s: %s" % (instance.name, msg)) diff --git a/lib/hypervisor/hv_kvm.py b/lib/hypervisor/hv_kvm.py index 064c755030157f305abeb731ab587791d6394ca9..52a9fc27ba30399bb0fa66e91aeedc3846b252c8 100644 --- a/lib/hypervisor/hv_kvm.py +++ b/lib/hypervisor/hv_kvm.py @@ -1788,9 +1788,7 @@ class KVMHypervisor(hv_base.BaseHypervisor): time.sleep(self._MIGRATION_INFO_RETRY_DELAY) - return objects.MigrationStatus(status=constants.HV_MIGRATION_FAILED, - info="Too many 'info migrate'" - " broken answers") + return objects.MigrationStatus(status=constants.HV_MIGRATION_FAILED) def BalloonInstanceMemory(self, instance, mem): """Balloon an instance memory to a certain value.