Terminate VM
         :arg vm_id: string
3811
async def terminate_vm(self, vm_id):
        '''
         
        '''
        try:
            await self.nova.servers.force_delete(vm_id)
        except JSONDecodeError as exc:
            logging.info("nova sent 'content-type: application/json' but no content appeared, whatever")
            pass
        except Exception:
            raise
273077
def _control_vm(self, params):
        

        args = shlex.split(params)
        result = yield from self.manager.execute("controlvm", [self._vmname] + args)
        return result
11914
def stop(name, call=None):
    '''
    
    '''
    conn = get_conn()
    node = get_node(conn, name)  # pylint: disable=not-callable
    log.debug('Node of Cloud VM: %s', node)

    status = conn.ex_shutdown_graceful(node)
    log.debug('Status of Cloud VM: %s', status)

    return status
606943
def _stop(self):
        
        engine = self.current_engine()
        if "vm" in self._controller.computes:
            yield from self._controller.delete_compute("vm")
        if engine.running:
            log.info("")
            yield from engine.stop()
864217
def close(self):
        
        if self.handle:
            cl = lvm_vg_close(self.handle)
            if cl != 0:
                raise HandleError("Failed to close VG handle after init check.")
            self.__vgh = None
            self.lvm.close()
1069519
def terminate(cls, cluster_id_label):
        
        conn = Qubole.agent(version=Cluster.api_version)
        data = {"state": "terminate"}
        return conn.put(cls.element_path(cluster_id_label) + "/state", data)
423816
def stop(name, call=None):
    '''
    
    '''
    if call == 'function':
        raise SaltCloudSystemExit(
            'The stop action must be called with -a or --action.'
        )

    compconn = get_conn(client_type='compute')

    resource_group = config.get_cloud_config_value(
                         'resource_group',
                         get_configured_provider(), __opts__, search_global=False
                     )

    ret = {}
    if not resource_group:
        groups = list_resource_groups()
        for group in groups:
            try:
                instance = compconn.virtual_machines.deallocate(
                    vm_name=name,
                    resource_group_name=group
                )
                instance.wait()
                vm_result = instance.result()
                ret = vm_result.as_dict()
                break
            except CloudError as exc:
                if 'was not found' in exc.message:
                    continue
                else:
                    ret = {'error': exc.message}
        if not ret:
            __utils__['azurearm.log_cloud_error']('compute', 'Unable to find virtual machine with name: {0}'.format(name))
            ret = {'error': 'Unable to find virtual machine with name: {0}'.format(name)}
    else:
        try:
            instance = compconn.virtual_machines.deallocate(
                    vm_name=name,
                    resource_group_name=resource_group
                )
            instance.wait()
            vm_result = instance.result()
            ret = vm_result.as_dict()
        except CloudError as exc:
            __utils__['azurearm.log_cloud_error']('compute', 'Error attempting to stop {0}: {1}'.format(name, exc.message))
            ret = {'error': exc.message}

    return ret
227055
def CloseHandle(self):
        ''''''
        if hasattr(self, 'handle'):
            ret = vmGuestLib.VMGuestLib_CloseHandle(self.handle.value)
            if ret != VMGUESTLIB_ERROR_SUCCESS: raise VMGuestLibException(ret)
            del(self.handle)
441626
def _terminate_instance(self):
        
        try:
            self.resource.resource_groups.delete(self.running_instance_id)
        except Exception as error:
            raise AzureCloudException(
                'Unable to terminate resource group: {0}.'.format(error)
            )
488154
def stop(vm_):
    '''
    
    '''
    with _get_xapi_session() as xapi:
        vm_uuid = _get_label_uuid(xapi, 'VM', vm_)
        if vm_uuid is False:
            return False
        try:
            xapi.VM.hard_shutdown(vm_uuid)
            return True
        except Exception:
            return False
1270552
def _erase_vm_info(name):
    '''
    
    '''
    try:
        # delete the machine record
        vm_ = get_vm_info(name)
        if vm_['machine']:
            key = _build_machine_uri(vm_['machine'], vm_.get('cwd', '.'))
            try:
                __utils__['sdb.sdb_delete'](key, __opts__)
            except KeyError:
                # no delete method found -- load a blank value
                __utils__['sdb.sdb_set'](key, None, __opts__)
    except Exception:
        pass

    uri = _build_sdb_uri(name)
    try:
        # delete the name record
        __utils__['sdb.sdb_delete'](uri, __opts__)
    except KeyError:
        # no delete method found -- load an empty dictionary
        __utils__['sdb.sdb_set'](uri, {}, __opts__)
    except Exception:
        pass
228638
def close(self):
        

        yield from self.send("hypervisor close")
        self._writer.close()
        self._reader, self._writer = None
1305619
def get_vm_id(kwargs=None, call=None):
    '''
    
    '''
    if call == 'action':
        raise SaltCloudSystemExit(
            'The get_vm_id function must be called with -f or --function.'
        )

    if kwargs is None:
        kwargs = {}

    name = kwargs.get('name', None)
    if name is None:
        raise SaltCloudSystemExit(
            'The get_vm_id function requires a name.'
        )

    try:
        ret = list_nodes()[name]['id']
    except KeyError:
        raise SaltCloudSystemExit(
            'The VM \'{0}\' could not be found.'.format(name)
        )

    return ret
786502
def destroy
      #disks = vm_object.config.hardware.device.grep(RbVmomi::VIM::VirtualDisk)
      unless host.free_license
        vm_object.Destroy_Task.wait_for_completion
      else
        host.remote_command "vim-cmd vmsvc/power.off #{vmid}"
        host.remote_command "vim-cmd vmsvc/destroy #{vmid}"
      end
    end
810708
def stop_instance(self, instance_id):
        
        self._restore_from_storage(instance_id)
        if self._start_failed:
            raise Exception('stop_instance for node %s: failing due to'
                            ' previous errors.' % instance_id)

        with self._resource_lock:
            try:
                v_m = self._qualified_name_to_vm(instance_id)
                if not v_m:
                    err = "stop_instance: can't find instance %s" % instance_id
                    log.error(err)
                    raise Exception(err)
                v_m._cloud_service._stop_vm(v_m)
                # note: self._n_instances is a derived property, doesn't need
                # to be updated
                if self._n_instances == 0:
                    log.debug('last instance deleted, destroying '
                              'global resources')
                    self._delete_global_reqs()
                    self._delete_cloud_provider_storage()
            except Exception as exc:
                log.error(traceback.format_exc())
                log.error("error stopping instance %s: %s", instance_id, exc)
                raise
        log.debug('stopped instance %s', instance_id)
1314181
def stop(vm_name, call=None):
    '''
    
    '''
    if call != 'action':
        raise SaltCloudSystemExit(
            'The stop action must be called with -a or --action.'
        )

    conn = get_conn()

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

    result = conn.ex_stop_node(
        conn.ex_get_node(vm_name)
    )

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

    return result
1093725
def exit(self, pub_id, *node_ids):
        ''''''
        try:
            pub = self['pubs'][pub_id]
        except KeyError:
            raise ValueError('Pub {} is not available'.format(pub_id))
        for node_id in node_ids:
            node = self.get_agent(node_id)
            if pub_id == node['pub']:
                del node['pub']
                pub['occupancy'] -= 1