commit 711fbc08fd895b826d63c1ffc7cb75f35dc4331e Merge: 703e23e da3f300 Author: Brian Foley <bpfo...@google.com> Date: Fri Dec 16 16:01:48 2016 +0000
Merge branch 'stable-2.15' into stable-2.16 Merge forward patches from stable-2.15 * stable-2.15 Fix gnt-instance console instance unpausing for xl toolstack Disable pylint too-many-nested-blocks in _RunCmdPipe Reduce nesting in import-export ProcessChildIO Reduce nesting in LUOobCommand.Exec Reduce nesting in LUInstanceCreate.RunOsScripts Reduce nesting in RemoveNodeSshKeyBulk key calculation Reduce nesting in RemoveNodeSshKeyBulk ssh logic Reduce nesting in gnt-cluster VerifyDisks missing disk loop Reduce nesting in _CheckVLANArguments Reduce nesting in StartDaemon Disable pylint bad-continuation warning Disable pylint superfluous-parens warning Disable pylint redefined-variable-type warning Disable pylint too-many-branches warnings Disable pylint broad-except warnings Disable incorrect pylint assigning-non-slot warning Quell pylint unbalanced-tuple-unpacking warning Cleanup: Use new-style classes everywhere Quell pylint socket.timeout warning Quell the pylint wrong-import-order warnings Quell cell-var-from-loop warning Use default value lambda param to avoid cell-var-from-loop Quell too-many-boolean-expressions Remove pylint tests removed in pylint 2.0 Quell trailing newline Quell bad-whitespace warning Quell consider-using-enumerate warning Disable pylint unsubscriptable-object warning Disable pylint bare-except warning Disable unwanted pylint wrong-import-position warnings Disable pylint unused-wildcard-import warning Disable incorrect pylint not-callable warning Disable pylint unpacking-non-sequence warning Disable pylint misplaced-comparison-constant warning Disable incorect pylint simplify-if-statement warning Disable pylint eval-used warning Disable pylint invalid-name warning Disable pylint import-self warning Disable some pylint unused-import warnings Replace deprecated pylint >=0.27 pragma with new form Delete old warning disables removed from pylint 1.6 Fix pylint >1.4 pycurl no-member warnings Cleanup: Remove unused/duplicate module/fn import Cleanup: Fix unidiomatic-typecheck Cleanup: Remove some unneeded pylint disables Cleanup: Iterate dict rather than key list Cleanup: Remove unused format key Cleanup: StartInstance and RebootInstance return None Cleanup: Fix for/else with no break in AddAuthorizedKeys Cleanup: Replace map/filters with list comprehensions Cleanup: del is a statement not a function Cleanup: Use FOO not in BAR instead of not FOO in BAR Cleanup: Simplify boolean assignment Cleanup: Remove some unnecessary if (...) parens Fix invalid variable error for file-based disks FIX: Refactor DiagnoseOS to use a loop, not an inner fn FIX: Set INSTANCE_NICn_NETWORK_NAME only if net is defined Fix for incorrect parsing of DRBD versions Change a few errors to report names, not UUIDs Give atomicWriteFile temp filenames a more distinct pattern LV check failure should print instance name Disable logging CallRPCMethod timings in non-debug configs 568 Update hv_kvm to handle output from qemu >= 1.6.0 Trivial merge conflicts: lib/cli.py -- whitespace lib/cmdlib/cluster/verify.py -- code previously removed from 2.16 lib/hypervisor/hv_xen.py -- tuple vs list lib/luxi.py -- whitespace lib/server/masterd.py -- code cleaned up in 2.15 and previously removed in 2.16 lib/storage/filestorage.py -- whitespace & generator instead of list lib/tools/node_cleanup.py -- whitespace Signed-off-by: Brian Foley <bpfo...@google.com> diff --cc lib/client/gnt_cluster.py index f834d2b,e23fb50..8b99c2c --- a/lib/client/gnt_cluster.py +++ b/lib/client/gnt_cluster.py @@@ -299,19 -296,8 +301,16 @@@ def InitCluster(opts, args) default_ialloc_params = opts.default_iallocator_params - if opts.enabled_user_shutdown: - enabled_user_shutdown = True - else: - enabled_user_shutdown = False + enabled_user_shutdown = bool(opts.enabled_user_shutdown) + if opts.ssh_key_type: + ssh_key_type = opts.ssh_key_type + else: + ssh_key_type = constants.SSH_DEFAULT_KEY_TYPE + + ssh_key_bits = ssh.DetermineKeyBits(ssh_key_type, opts.ssh_key_bits, None, + None) + bootstrap.InitCluster(cluster_name=args[0], secondary_ip=opts.secondary_ip, vg_name=vg_name, diff --cc lib/jqueue/__init__.py index 9384f55,d996461..d78625c --- a/lib/jqueue/__init__.py +++ b/lib/jqueue/__init__.py @@@ -1141,9 -1168,118 +1141,9 @@@ class _JobProcessor(object) return self.DEFER finally: assert job.writable, "Job became read-only while being processed" - queue.release() - - -def _EvaluateJobProcessorResult(depmgr, job, result): - """Looks at a result from L{_JobProcessor} for a job. - - To be used in a L{_JobQueueWorker}. - - """ - if result == _JobProcessor.FINISHED: - # Notify waiting jobs - depmgr.NotifyWaiters(job.id) - - elif result == _JobProcessor.DEFER: - # Schedule again - raise workerpool.DeferTask(priority=job.CalcPriority()) - - elif result == _JobProcessor.WAITDEP: - # No-op, dependency manager will re-schedule - pass - - else: - raise errors.ProgrammerError("Job processor returned unknown status %s" % - (result, )) - - -class _JobQueueWorker(workerpool.BaseWorker): - """The actual job workers. - - """ - def RunTask(self, job): # pylint: disable=W0221 - """Job executor. - - @type job: L{_QueuedJob} - @param job: the job to be processed - - """ - assert job.writable, "Expected writable job" - - # Ensure only one worker is active on a single job. If a job registers for - # a dependency job, and the other job notifies before the first worker is - # done, the job can end up in the tasklist more than once. - job.processor_lock.acquire() - try: - return self._RunTaskInner(job) - finally: - job.processor_lock.release() - - def _RunTaskInner(self, job): - """Executes a job. - - Must be called with per-job lock acquired. - - """ - queue = job.queue - assert queue == self.pool.queue - - setname_fn = lambda op: self.SetTaskName(self._GetWorkerName(job, op)) - setname_fn(None) - - proc = mcpu.Processor(queue.context, job.id) - - # Create wrapper for setting thread name - wrap_execop_fn = compat.partial(self._WrapExecOpCode, setname_fn, - proc.ExecOpCode) - - _EvaluateJobProcessorResult(queue.depmgr, job, - _JobProcessor(queue, wrap_execop_fn, job)()) - - @staticmethod - def _WrapExecOpCode(setname_fn, execop_fn, op, *args, **kwargs): - """Updates the worker thread name to include a short summary of the opcode. - - @param setname_fn: Callable setting worker thread name - @param execop_fn: Callable for executing opcode (usually - L{mcpu.Processor.ExecOpCode}) - - """ - setname_fn(op) - try: - return execop_fn(op, *args, **kwargs) - finally: - setname_fn(None) - - @staticmethod - def _GetWorkerName(job, op): - """Sets the worker thread name. - - @type job: L{_QueuedJob} - @type op: L{opcodes.OpCode} - - """ - parts = ["Job%s" % job.id] - - if op: - parts.append(op.TinySummary()) - - return "/".join(parts) - - -class _JobQueueWorkerPool(workerpool.WorkerPool): - """Simple class implementing a job-processing workerpool. - - """ - def __init__(self, queue): - super(_JobQueueWorkerPool, self).__init__("Jq", - JOBQUEUE_THREADS, - _JobQueueWorker) - self.queue = queue - class _JobDependencyManager: + class _JobDependencyManager(object): """Keeps track of job dependencies. """