Stop a node ("pulling the plug").

    CLI Example:

    .. code-block:: bash

        salt-cloud -a stop mymachine
5329
def stop(name, vmid=None, call=None):
    '''
    
    '''
    if call != 'action':
        raise SaltCloudSystemExit(
            'The stop action must be called with -a or --action.'
        )

    if not set_vm_status('stop', name, vmid=vmid):
        log.error('Unable to bring VM %s (%s) down..', name, vmid)
        raise SaltCloudExecutionFailure

    # xxx: TBD: Check here whether the status was actually changed to 'stopped'

    return {'Stopped': '{0} was stopped.'.format(name)}
1287269
def stop(instance_id, force=False, call=None):
    '''
    
    '''
    if call != 'action':
        raise SaltCloudSystemExit(
            'The stop action must be called with -a or --action.'
        )

    log.info('Stopping instance %s', instance_id)

    params = {
        'action': 'StopInstances',
        'zone': _get_specified_zone(provider=get_configured_provider()),
        'instances.1': instance_id,
        'force': int(force),
    }
    result = query(params)

    return result
163513
def _stop_instance(self):
        """"""
        instance = self._get_instance()
        self.compute_driver.ex_stop_node(instance)
        self._wait_on_instance('stopped', timeout=self.timeout)
1230221
def stop(self, kill=False, timeout=15):
        
        super(AbstractDcsController, self).stop(kill=kill, timeout=timeout)
        if self._work_directory:
            shutil.rmtree(self._work_directory)
406660
def stop(self, timeout=None):
        
        ioloop = getattr(self, 'ioloop', None)
        if not ioloop:
            raise RuntimeError('Call start() before stop()')
        if timeout:
            if get_thread_ident() == self.ioloop_thread_id:
                raise RuntimeError('Cannot block inside ioloop')
            self._running.wait_with_ioloop(self.ioloop, timeout)

        def _cleanup():
            self._running.clear()
            self._disconnect()
        self._ioloop_manager.stop(timeout=timeout, callback=_cleanup)
736588
def stop(self):
        
        for sock in self.workers:
            os.kill(sock.pid, signal.SIGTERM)
        return 'WorkerPool %s stopped' % self.ctrl_url
685039
def stop(self, force=False, wait=False):
        
        log.debug("Stopping cluster `%s` ...", self.name)

        failed = self._stop_all_nodes(wait)

        if failed:
            if force:
                self._delete_saved_data()
                log.warning(
                    "Not all cluster nodes have been terminated."
                    " However, as requested, data about the cluster"
                    " has been removed from local storage.")
            else:
                self.repository.save_or_update(self)
                log.warning(
                    "Not all cluster nodes have been terminated."
                    " Fix errors above and re-run `elasticluster stop %s`",
                    self.name)
        else:
            self._delete_saved_data()
1273103
def stop(self):
        

        if not self._is_running:
            return

        pushcenter_logger.debug("[NURESTPushCenter] Stopping...")

        self._thread.stop()
        self._thread.join()

        self._is_running = False
        self._current_connection = None
        self._start_time = None
        self._timeout = None
476527
async def stop(self):
        
        await self.node.stop(self.channel.guild.id)
        self.queue = []
        self.current = None
        self.position = 0
        self._paused = False
1142841
def stop(self):
        
        if self.server.eio.async_mode == 'threading':
            func = flask.request.environ.get('werkzeug.server.shutdown')
            if func:
                func()
            else:
                raise RuntimeError('Cannot stop unknown web server')
        elif self.server.eio.async_mode == 'eventlet':
            raise SystemExit
        elif self.server.eio.async_mode == 'gevent':
            self.wsgi_server.stop()
449540
def stop(ctx, rm=False):
    ''''''
    with ctx.cd(ROOT):
        compose(ctx, 'stop')
        if rm:
            compose(ctx, 'rm --force')
965190
def stop(name, call=None):
    '''
    
    '''
    datacenter_id = get_datacenter_id()
    conn = get_conn()
    node = get_node(conn, name)

    conn.stop_server(datacenter_id=datacenter_id, server_id=node['id'])

    return True
157768
def stop(state, host, ctid):
    '''
    
    '''

    args = ['{0}'.format(ctid)]

    yield 'vzctl stop {0}'.format(' '.join(args))
105072
def destroy(name, call=None):
    '''
    
    '''
    if call == 'function':
        raise SaltCloudSystemExit(
            'The destroy action must be called with -d, --destroy, '
            '-a or --action.'
        )

    __utils__['cloud.fire_event'](
        'event',
        'destroying instance',
        'salt/cloud/{0}/destroying'.format(name),
        args={'name': name},
        sock_dir=__opts__['sock_dir'],
        transport=__opts__['transport']
    )

    vmobj = _get_vm_by_name(name)
    if vmobj is not None:
        # stop the vm
        if get_vm_status(vmid=vmobj['vmid'])['status'] != 'stopped':
            stop(name, vmobj['vmid'], 'action')

        # wait until stopped
        if not wait_for_state(vmobj['vmid'], 'stopped'):
            return {'Error': 'Unable to stop {0}, command timed out'.format(name)}

        # required to wait a bit here, otherwise the VM is sometimes
        # still locked and destroy fails.
        time.sleep(3)

        query('delete', 'nodes/{0}/{1}'.format(
            vmobj['node'], vmobj['id']
        ))
        __utils__['cloud.fire_event'](
            'event',
            'destroyed instance',
            'salt/cloud/{0}/destroyed'.format(name),
            args={'name': name},
            sock_dir=__opts__['sock_dir'],
            transport=__opts__['transport']
        )
        if __opts__.get('update_cachedir', False) is True:
            __utils__['cloud.delete_minion_cachedir'](
                name, __active_provider_name__.split(':')[0], __opts__)

        return {'Destroyed': '{0} was destroyed.'.format(name)}
788336
def stop(self, sig=signal.SIGINT):
        ''''''
        for cpid in self.sandboxes:
            logger.warn('Stopping %i...' % cpid)
            try:
                os.kill(cpid, sig)
            except OSError:  # pragma: no cover
                logger.exception('Error stopping %s...' % cpid)

        # While we still have children running, wait for them
        # We edit the dictionary during the loop, so we need to copy its keys
        for cpid in list(self.sandboxes):
            try:
                logger.info('Waiting for %i...' % cpid)
                pid, status = os.waitpid(cpid, 0)
                logger.warn('%i stopped with status %i' % (pid, status >> 8))
            except OSError:  # pragma: no cover
                logger.exception('Error waiting for %i...' % cpid)
            finally:
                self.sandboxes.pop(cpid, None)
982170
@Override
    public void stop()
    {
        synchronized (killHook)
        {
            jqmlogger.info("JQM engine " + this.node.getName() + " has received a stop order");

            // Kill hook should be removed
            try
            {
                if (!Runtime.getRuntime().removeShutdownHook(killHook))
                {
                    jqmlogger.error("The engine could not unregister its shutdown hook");
                }
            }
            catch (IllegalStateException e)
            {
                // This happens if the stop sequence is initiated by the shutdown hook itself.
                jqmlogger.info("Stop order is due to an admin operation (KILL/INT)");
            }
        }

        // Stop pollers
        int pollerCount = pollers.size();
        for (QueuePoller p : pollers.values())
        {
            p.stop();
        }

        // Scheduler
        this.scheduler.stop();

        // Jetty is closed automatically when all pollers are down

        // Wait for the end of the world
        if (pollerCount > 0)
        {
            try
            {
                this.ended.acquire();
            }
            catch (InterruptedException e)
            {
                jqmlogger.error("interrupted", e);
            }
        }

        // Send a KILL signal to remaining job instances, and wait some more.
        if (this.getCurrentlyRunningJobCount() > 0)
        {
            this.runningJobInstanceManager.killAll();
            try
            {
                Thread.sleep(10000);
            }
            catch (InterruptedException e)
            {
                jqmlogger.error("interrupted", e);
            }
        }

        jqmlogger.debug("Stop order was correctly handled. Engine for node " + this.node.getName() + " has stopped.");
    }
455704
def stop(self):  # pylint: disable=no-self-use
        
        cherrypy.log("Stopping CherryPy engine (current state: %s)..." % cherrypy.engine.state)
        try:
            cherrypy.engine.exit()
        except RuntimeWarning:
            pass
        except SystemExit:
            cherrypy.log('SystemExit raised: shutting down bus')
        cherrypy.log("Stopped")