Reboot a virtual machine
        :param str userid: the id of the virtual machine to be reboot
        :returns: None
503936
def guest_reboot(self, userid):
        
        action = "reboot guest '%s'" % userid
        with zvmutils.log_and_reraise_sdkbase_error(action):
            self._vmops.guest_reboot(userid)
178431
def resume(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.unpause(vm_uuid)
            return True
        except Exception:
            return False
1317117
def reboot(name, call=None):
    '''
    
    '''
    if call != 'action':
        raise SaltCloudSystemExit(
            'The stop action must be called with -a or --action.'
        )

    log.info('Rebooting node %s', name)

    instance_id = _get_node(name)['InstanceId']

    params = {'Action': 'RebootInstance',
              'InstanceId': instance_id}
    result = query(params)

    return result
736326
def reboot(self, devices):
        
        for device in devices:
            self.logger.info('Rebooting: %s', device.id)
            try:
                device.reboot()
            except packet.baseapi.Error:
                raise PacketManagerException('Unable to reboot instance "{}"'.format(device.id))
16565
def reboot(name, call=None):
    '''
    
    '''
    instance_id = _get_node(name)['instanceId']
    params = {'Action': 'RebootInstances',
              'InstanceId.1': instance_id}

    result = aws.query(params,
                       setname='tagSet',
                       location=get_location(),
                       provider=get_provider(),
                       opts=__opts__,
                       sigver='4')

    if result == []:
        log.info('Complete')

    return {'Reboot': 'Complete'}
983685
def set_system_id(self, system_id):
        

        yield from self._hypervisor.send('{platform} set_system_id "{name}" {system_id}'.format(platform=self._platform,
                                                                                                name=self._name,
                                                                                                system_id=system_id))

        log.info('Router "{name}" [{id}]: system ID updated from {old_id} to {new_id}'.format(name=self._name,
                                                                                              id=self._id,
                                                                                              old_id=self._system_id,
                                                                                              new_id=system_id))
        self._system_id = system_id
250510
def delete_guest(userid):
    
    # Check if the guest exists.
    guest_list_info = client.send_request('guest_list')
    # the string 'userid' need to be coded as 'u'userid' in case of py2 interpreter.
    userid_1 = (unicode(userid, "utf-8") if sys.version[0] == '2' else userid)

    if userid_1 not in guest_list_info['output']:
        RuntimeError("Userid %s does not exist!" % userid)


    # Delete the guest.
    guest_delete_info = client.send_request('guest_delete', userid)

    if guest_delete_info['overallRC']:
        print("\nFailed to delete guest %s!" % userid)
    else:
        print("\nSucceeded to delete guest %s!" % userid)
842175
def get_smt_userid():
    """"""
    cmd = ["sudo", "/sbin/vmcp", "query userid"]
    try:
        userid = subprocess.check_output(cmd,
                                         close_fds=True,
                                         stderr=subprocess.STDOUT)
        userid = bytes.decode(userid)
        userid = userid.split()[0]
        return userid
    except Exception as err:
        msg = ("Could not find the userid of the smt server: %s") % err
        raise exception.SDKInternalError(msg=msg)
922064
def delete_vm(self, userid):
        """"""
        LOG.info("Begin to delete vm %s", userid)
        self._smtclient.delete_vm(userid)

        # remove userid from smapi namelist
        self._smtclient.namelist_remove(self._namelist, userid)
        LOG.info("Complete delete vm %s", userid)
1055613
def resume(env, identifier):
    """"""

    vsi = SoftLayer.VSManager(env.client)
    vs_id = helpers.resolve_id(vsi.resolve_ids, identifier, 'VS')
    env.client['Virtual_Guest'].resume(id=vs_id)
601983
def set_vm_status(self, device='FLOPPY',
                      boot_option='BOOT_ONCE', write_protect='YES'):
        
        return self._call_method('set_vm_status', device, boot_option,
                                 write_protect)
95999
def convert_to_openid(self, user_id, agent_id=None):
        
        data = optionaldict(
            userid=user_id,
            agentid=agent_id
        )
        return self._post('user/convert_to_openid', data=data)
1058574
def get_user(self, user_id):
        
        user_model = get_user_model()
        try:
            return user_model.objects.get(id=user_id)
        except user_model.DoesNotExist:
            return None
1035834
def guest_get_console_output(self, userid):
        
        action = "get the console output of guest '%s'" % userid
        with zvmutils.log_and_reraise_sdkbase_error(action):
            output = self._vmops.get_console_output(userid)

        return output
1015002
def is_instance_running(self, instance_id):
        
        self._restore_from_storage(instance_id)
        if self._start_failed:
            raise Exception('is_instance_running for node %s: failing due to'
                            ' previous errors.' % instance_id)
        try:
            v_m = self._qualified_name_to_vm(instance_id)
            if not v_m:
                raise Exception("Can't find instance_id %s" % instance_id)
        except Exception:
            log.error(traceback.format_exc())
            raise
        return v_m._power_state == 'Started'
1166685
async def _get_user_id(self, user, *, asdict=False):
        
        uid = self.config.user_id()
        if isinstance(user, dict):
            user_id = user.get(uid)
        elif hasattr(user, "to_dict"):
            _to_dict = await utils.call(user.to_dict)
            user_id = _to_dict.get(uid)
        else:
            raise exceptions.InvalidRetrieveUserObject()

        if asdict:
            return {uid: user_id}

        return user_id
810103
def restart_user(self, subid):
    '''
    '''        
    if os.path.exists(self.data_base): # /scif/data/<study_id>
        data_base = "%s/%s" %(self.data_base, subid)
        for ext in ['revoked','finished']:
            folder = "%s_%s" % (data_base, ext)
            if os.path.exists(folder):
                os.rename(folder, data_base)
                self.logger.info('Restarting %s, folder is %s.' % (subid, data_base))

        self.logger.warning('%s does not have revoked or finished folder, no changes necessary.' % (subid))
        return data_base    

    self.logger.warning('%s does not exist, cannot restart. %s' % (self.database, subid))