Commit 247837c3 authored by Klaus Aehlig's avatar Klaus Aehlig

Merge branch 'stable-2.11' into stable-2.12

* stable-2.11
  Add missing import
  Fix INicParams to include inicNetwork
  Improve KVM userspace access documentation

* stable-2.10
  Add --no-locks option to gnt-debug dela
  Include design-performance-tests.rst in index
  Document the --force-failover option
  Support group evacuation by failover
  Add an option --force-failover
  Extend OpGroupEvacuate by a ForceFailover paramter
  Mark performance tests design as implemented
  openvswitch fix
  Document the --sequential option
  Support sequential evacuation
  Add an option --sequential
  Extend OpGroupEvacuate by a sequential paramter

* stable-2.9
  Improve haskell style
  check-man-warnings: use C.UTF-8 and set LC_ALL
  Fix passing of ispecs in cluster init during QA

Conflicts:
	doc/design-draft.rst
	lib/client/gnt_debug.py
	lib/cmdlib/test.py
	src/Ganeti/HTools/Program/Harep.hs
	src/Ganeti/HTools/Program/Hspace.hs
	src/Ganeti/JQueue.hs
	src/Ganeti/OpCodes.hs
	src/Ganeti/OpParams.hs
	test/hs/Test/Ganeti/HTools/Instance.hs
Resolution:
	lib/cmdlib/test.py: modify/remove resolved
	  in favor of the remove on stable-2.12
	*/HTools/* and src/Ganeti/Op*: add both new
	  parameters to the delay opcode
	rest: trivial union
Signed-off-by: default avatarKlaus Aehlig <aehlig@google.com>
Reviewed-by: default avatarPetr Pudlak <pudlak@google.com>
parents 5fdd0f88 22b64963
......@@ -20,7 +20,13 @@
set -e
! LANG=en_US.UTF-8 MANWIDTH=80 \
if locale -a | grep -qF 'C.UTF-8'; then
loc="C.UTF-8"
else
loc="en_US.UTF-8"
fi
! LANG="$loc" LC_ALL="$loc" MANWIDTH=80 \
man --warnings --encoding=utf8 --local-file "$1" 2>&1 >/dev/null | \
grep -v -e "cannot adjust line" -e "can't break line" | \
grep .
......@@ -7,6 +7,7 @@ The following design documents have been implemented in Ganeti 2.10.
- :doc:`design-cmdlib-unittests`
- :doc:`design-hotplug`
- :doc:`design-openvswitch`
- :doc:`design-performance-tests`
- :doc:`design-storagetypes`
- :doc:`design-upgrade`
......
......@@ -23,7 +23,6 @@ Design document drafts
design-node-security.rst
design-systemd.rst
design-cpu-speed.rst
design-performance-tests.rst
.. vim: set textwidth=72 :
.. Local Variables:
......
......@@ -118,6 +118,7 @@ Draft designs
design-os.rst
design-ovf-support.rst
design-partitioned
design-performance-tests.rst
design-query2.rst
design-reason-trail.rst
design-restricted-commands.rst
......
......@@ -378,11 +378,13 @@ avoid potential deadlocks_ in low memory scenarios.
.. _deadlocks: http://tracker.ceph.com/issues/3076
To initialize a cluster with support for this feature, use a command
such as::
like the following. Note, that you possibly need to follow the more
general installation instructions before invoking this command (see
`Initializing the cluster`_ ).
$ gnt-cluster init \
--enabled-disk-templates rbd \
--ipolicy-disk-templates rbd \
--enabled-disk-templates=rbd \
--ipolicy-disk-templates=rbd \
--enabled-hypervisors=kvm \
-D rbd:access=userspace
......
......@@ -90,6 +90,7 @@ __all__ = [
"FIELDS_OPT",
"FILESTORE_DIR_OPT",
"FILESTORE_DRIVER_OPT",
"FORCE_FAILOVER_OPT",
"FORCE_FILTER_OPT",
"FORCE_OPT",
"FORCE_VARIANT_OPT",
......@@ -209,6 +210,7 @@ __all__ = [
"IPOLICY_STD_SPECS_OPT",
"IPOLICY_DISK_TEMPLATES",
"IPOLICY_VCPU_RATIO",
"SEQUENTIAL_OPT",
"SPICE_CACERT_OPT",
"SPICE_CERT_OPT",
"SRC_DIR_OPT",
......@@ -875,6 +877,10 @@ PRINT_JOBID_OPT = cli_option("--print-jobid", dest="print_jobid",
help=("Additionally print the job as first line"
" on stdout (for scripting)."))
SEQUENTIAL_OPT = cli_option("--sequential", dest="sequential",
default=False, action="store_true",
help=("Execute all resulting jobs sequentially"))
SYNC_OPT = cli_option("--sync", dest="do_locking",
default=False, action="store_true",
help=("Grab locks while doing the queries"
......@@ -1109,6 +1115,12 @@ ALLOW_FAILOVER_OPT = cli_option("--allow-failover",
help="If migration is not possible fallback to"
" failover")
FORCE_FAILOVER_OPT = cli_option("--force-failover",
dest="force_failover",
action="store_true", default=False,
help="Do not use migration, always use"
" failover")
NONLIVE_OPT = cli_option("--non-live", dest="live",
default=True, action="store_false",
help="Do a non-live migration (this usually means"
......
......@@ -66,7 +66,8 @@ def Delay(opts, args):
on_master=opts.on_master,
on_nodes=opts.on_nodes,
repeat=opts.repeat,
interruptible=opts.interruptible)
interruptible=opts.interruptible,
no_locks=opts.no_locks)
SubmitOrSend(op, opts)
return 0
......@@ -684,6 +685,9 @@ commands = {
action="store_true",
help="Allows the opcode to be interrupted by using a domain "
"socket"),
cli_option("-l", "--no-locks", default=False, dest="no_locks",
action="store_true",
help="Don't take locks while performing the delay"),
DRY_RUN_OPT, PRIORITY_OPT] + SUBMIT_OPTS,
"[opts...] <duration>", "Executes a TestDelay OpCode"),
"submit-job": (
......
......@@ -243,7 +243,9 @@ def EvacuateGroup(opts, args):
op = opcodes.OpGroupEvacuate(group_name=group_name,
iallocator=opts.iallocator,
target_groups=opts.to,
early_release=opts.early_release)
early_release=opts.early_release,
sequential=opts.sequential,
force_failover=opts.force_failover)
result = SubmitOrSend(op, opts, cl=cl)
# Keep track of submitted jobs
......@@ -359,7 +361,9 @@ commands = {
"[--dry-run] <group-name> <new-name>", "Rename a node group"),
"evacuate": (
EvacuateGroup, [ArgGroup(min=1, max=1)],
[TO_GROUP_OPT, IALLOCATOR_OPT, EARLY_RELEASE_OPT] + SUBMIT_OPTS,
[TO_GROUP_OPT, IALLOCATOR_OPT, EARLY_RELEASE_OPT, SEQUENTIAL_OPT,
FORCE_FAILOVER_OPT]
+ SUBMIT_OPTS,
"[-I <iallocator>] [--to <group>]",
"Evacuate all instances within a group"),
"list-tags": (
......
......@@ -28,6 +28,7 @@ from ganeti import constants
from ganeti import errors
from ganeti import locking
from ganeti import objects
from ganeti import opcodes
from ganeti import utils
from ganeti.masterd import iallocator
from ganeti.cmdlib.base import LogicalUnit, NoHooksLU, ResultWithJobs
......@@ -768,6 +769,24 @@ class LUGroupEvacuate(LogicalUnit):
return (run_nodes, run_nodes)
@staticmethod
def _MigrateToFailover(op):
"""Return an equivalent failover opcode for a migrate one.
If the argument is not a failover opcode, return it unchanged.
"""
if not isinstance(op, opcodes.OpInstanceMigrate):
return op
else:
return opcodes.OpInstanceFailover(
instance_name=op.instance_name,
instance_uuid=getattr(op, "instance_uuid", None),
target_node=getattr(op, "target_node", None),
target_node_uuid=getattr(op, "target_node_uuid", None),
ignore_ipolicy=op.ignore_ipolicy,
cleanup=op.cleanup)
def Exec(self, feedback_fn):
inst_names = list(self.owned_locks(locking.LEVEL_INSTANCE))
......@@ -790,6 +809,16 @@ class LUGroupEvacuate(LogicalUnit):
self.LogInfo("Iallocator returned %s job(s) for evacuating node group %s",
len(jobs), self.op.group_name)
if self.op.force_failover:
self.LogInfo("Will insist on failovers")
jobs = [[self._MigrateToFailover(op) for op in job] for job in jobs]
if self.op.sequential:
self.LogInfo("Jobs will be submitted to run sequentially")
for job in jobs[1:]:
for op in job:
op.depends = [(-1, ["error", "success"])]
return ResultWithJobs(jobs)
......
......@@ -113,6 +113,9 @@ class LUTestDelay(NoHooksLU):
if self.op.duration <= 0:
raise errors.OpPrereqError("Duration must be greater than zero")
if not self.op.no_locks and (self.op.on_nodes or self.op.on_master):
self.needed_locks[locking.LEVEL_NODE] = []
self.op.on_node_uuids = []
if self.op.on_nodes:
# _GetWantedNodes can be used here, but is not always appropriate to use
......
......@@ -1267,6 +1267,8 @@ class ConfigWriter(object):
link = "bridge:%s" % nic_link
elif nic_mode == constants.NIC_MODE_ROUTED:
link = "route:%s" % nic_link
elif nic_mode == constants.NIC_MODE_OVS:
link = "ovs:%s" % nic_link
else:
raise errors.ProgrammerError("NIC mode '%s' not handled" % nic_mode)
......
......@@ -187,7 +187,7 @@ options.
EVACUATE
~~~~~~~~
| **evacuate** [\--submit] [\--print-job-id]
| **evacuate** [\--submit] [\--print-job-id] [\--sequential] [\--force-failover]
| [\--iallocator *NAME*] [\--to *GROUP*...] {*group*}
This command will move all instances out of the given node group.
......@@ -197,6 +197,14 @@ the command line or as a cluster default.
If no specific destination groups are specified using ``--to``, all
groups except the evacuated group are considered.
The moves of the individual instances are handled as separate jobs
to allow for maximal parallelism. If the ``--sequential`` option is
given, the moves of the individual instances will be executed sequentially.
This can be usefull if the link between the groups is vulnerable to
congestion. If the ``--force-failover`` option is given, no migrations
will be made. This might be necessary if the group being evacuated is
too different from the other groups in the cluster.
See **ganeti**\(7) for a description of ``--submit`` and other common
options.
......
......@@ -4512,6 +4512,10 @@ builtinDataCollectorVersion = "B"
opcodeReason :: String
opcodeReason = "reason"
-- | The reason trail opcode parameter name
opcodeSequential :: String
opcodeSequential = "sequential"
diskstatsFile :: String
diskstatsFile = "/proc/diskstats"
......
......@@ -428,6 +428,7 @@ doRepair client delay instData (rtype, opcodes) =
, opDelayOnNodeUuids = Nothing
, opDelayRepeat = fromJust $ mkNonNegative 0
, opDelayInterruptible = False
, opDelayNoLocks = False
} : opcodes
else
opcodes
......
......@@ -385,7 +385,7 @@ failureReason = show . fst . head
-- | Sorts the failure reasons.
sortReasons :: [(FailMode, Int)] -> [(FailMode, Int)]
sortReasons = sortBy (flip (comparing snd))
sortReasons = sortBy (flip $ comparing snd)
-- | Runs an allocation algorithm and saves cluster state.
runAllocation :: ClusterData -- ^ Cluster data
......
......@@ -71,7 +71,7 @@ module Ganeti.JQueue
, QueuedJob(..)
) where
import Control.Applicative (liftA2, (<|>))
import Control.Applicative (liftA2, (<|>), (<$>))
import Control.Arrow (first, second)
import Control.Concurrent (forkIO, threadDelay)
import Control.Exception
......@@ -80,7 +80,7 @@ import Control.Monad
import Control.Monad.IO.Class
import Control.Monad.Trans (lift)
import Control.Monad.Trans.Maybe
import Data.Functor ((<$), (<$>))
import Data.Functor ((<$))
import Data.List
import Data.Maybe
import Data.Ord (comparing)
......
......@@ -742,6 +742,8 @@ $(genOpCode "OpCode"
, pEarlyRelease
, pIallocator
, pTargetGroups
, pSequential
, pForceFailover
],
"group_name")
, ("OpOsDiagnose",
......@@ -832,6 +834,7 @@ $(genOpCode "OpCode"
, pDelayOnNodeUuids
, pDelayRepeat
, pDelayInterruptible
, pDelayNoLocks
],
"duration")
, ("OpTestAllocator",
......
......@@ -231,12 +231,14 @@ module Ganeti.OpParams
, pReplaceDisksMode
, pReplaceDisksList
, pAllowFailover
, pForceFailover
, pDelayDuration
, pDelayOnMaster
, pDelayOnNodes
, pDelayOnNodeUuids
, pDelayRepeat
, pDelayInterruptible
, pDelayNoLocks
, pIAllocatorDirection
, pIAllocatorMode
, pIAllocatorReqName
......@@ -273,6 +275,7 @@ module Ganeti.OpParams
, pDependencies
, pComment
, pReason
, pSequential
, pEnabledDiskTemplates
) where
......@@ -362,6 +365,7 @@ $(buildObject "INicParams" "inic"
, optionalField $ simpleField C.inicName [t| NonEmptyString |]
, optionalField $ simpleField C.inicVlan [t| String |]
, optionalField $ simpleField C.inicBridge [t| NonEmptyString |]
, optionalField $ simpleField C.inicNetwork [t| NonEmptyString |]
])
-- | Disk modification definition.
......@@ -503,6 +507,11 @@ pReason =
withDoc "Reason trail field" $
simpleField C.opcodeReason [t| ReasonTrail |]
pSequential :: Field
pSequential =
withDoc "Sequential job execution" $
defaultFalse C.opcodeSequential
-- * Parameters
pDebugSimulateErrors :: Field
......@@ -1349,6 +1358,11 @@ pAllowFailover =
withDoc "Whether we can fallback to failover if migration is not possible" $
defaultFalse "allow_failover"
pForceFailover :: Field
pForceFailover =
withDoc "Disallow migration moves and always use failovers" $
defaultFalse "force_failover"
pMoveTargetNode :: Field
pMoveTargetNode =
withDoc "Target node for instance move" .
......@@ -1592,6 +1606,12 @@ pDelayInterruptible =
defaultField [| False |] $
simpleField "interruptible" [t| Bool |]
pDelayNoLocks :: Field
pDelayNoLocks =
withDoc "Don't take locks during the delay" .
renameField "DelayNoLocks" $
defaultTrue "no_locks"
pIAllocatorDirection :: Field
pIAllocatorDirection =
withDoc "IAllocator test direction" .
......
......@@ -36,8 +36,8 @@ module Test.Ganeti.HTools.Instance
) where
import Control.Arrow ((&&&))
import Control.Applicative ((<$>))
import Control.Monad (liftM)
import Data.Functor ((<$>))
import Test.QuickCheck hiding (Result)
import Test.Ganeti.TestHelper
......
......@@ -87,7 +87,7 @@ instance Arbitrary INicParams where
arbitrary = INicParams <$> genMaybe genNameNE <*> genMaybe genName <*>
genMaybe genNameNE <*> genMaybe genNameNE <*>
genMaybe genNameNE <*> genMaybe genName <*>
genMaybe genNameNE
genMaybe genNameNE <*> genMaybe genNameNE
instance Arbitrary IDiskParams where
arbitrary = IDiskParams <$> arbitrary <*> arbitrary <*>
......@@ -123,7 +123,8 @@ instance Arbitrary OpCodes.OpCode where
case op_id of
"OP_TEST_DELAY" ->
OpCodes.OpTestDelay <$> arbitrary <*> arbitrary <*>
genNodeNamesNE <*> return Nothing <*> arbitrary <*> arbitrary
genNodeNamesNE <*> return Nothing <*> arbitrary <*> arbitrary <*>
arbitrary
"OP_INSTANCE_REPLACE_DISKS" ->
OpCodes.OpInstanceReplaceDisks <$> genFQDN <*> return Nothing <*>
arbitrary <*> arbitrary <*> arbitrary <*> genDiskIndices <*>
......@@ -392,7 +393,7 @@ instance Arbitrary OpCodes.OpCode where
OpCodes.OpGroupRename <$> genNameNE <*> genNameNE
"OP_GROUP_EVACUATE" ->
OpCodes.OpGroupEvacuate <$> genNameNE <*> arbitrary <*>
genMaybe genNameNE <*> genMaybe genNamesNE
genMaybe genNameNE <*> genMaybe genNamesNE <*> arbitrary <*> arbitrary
"OP_OS_DIAGNOSE" ->
OpCodes.OpOsDiagnose <$> genFieldsNE <*> genNamesNE
"OP_EXT_STORAGE_DIAGNOSE" ->
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment