当前位置: 首页>>代码示例>>Python>>正文


Python remote.create_guest_client函数代码示例

本文整理汇总了Python中trove.common.remote.create_guest_client函数的典型用法代码示例。如果您正苦于以下问题:Python create_guest_client函数的具体用法?Python create_guest_client怎么用?Python create_guest_client使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了create_guest_client函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: guest_log_list

 def guest_log_list(self, req, tenant_id, id):
     """Return all information about all logs for an instance."""
     LOG.debug("Listing logs for tenant %s" % tenant_id)
     context = req.environ[wsgi.CONTEXT_KEY]
     client = create_guest_client(context, id)
     guest_log_list = client.guest_log_list()
     return wsgi.Result({'logs': guest_log_list}, 200)
开发者ID:paramtech,项目名称:tesora-trove,代码行数:7,代码来源:service.py

示例2: update_attributes

    def update_attributes(cls, context, instance_id, username, hostname,
                          user_attrs):
        load_and_verify(context, instance_id)
        client = create_guest_client(context, instance_id)

        user_changed = user_attrs.get('name')
        host_changed = user_attrs.get('host')

        validate = guest_models.MySQLUser()
        if host_changed:
            validate.host = host_changed
        if user_changed:
            validate.name = user_changed

        user = user_changed or username
        host = host_changed or hostname
        userhost = "%[email protected]%s" % (user, host)
        if user_changed or host_changed:
            existing_users, _nadda = Users.load_with_client(
                client,
                limit=1,
                marker=userhost,
                include_marker=True)
            if (len(existing_users) > 0 and
                    existing_users[0].name == user and
                    existing_users[0].host == host):
                raise exception.UserAlreadyExists(name=user,
                                                  host=host)
        client.update_attributes(username, hostname, user_attrs)
开发者ID:cretta,项目名称:trove,代码行数:29,代码来源:models.py

示例3: create

    def create(cls, context, instance_id, user, root_password, cluster_instances_list=None):
        load_and_verify(context, instance_id)
        if root_password:
            root = create_guest_client(context, instance_id).enable_root_with_password(root_password)
        else:
            root = create_guest_client(context, instance_id).enable_root()

        root_user = guest_models.RootUser()
        root_user.deserialize(root)

        # if cluster_instances_list none, then root create is called for
        # single instance, adding an RootHistory entry for the instance_id
        if cluster_instances_list is None:
            RootHistory.create(context, instance_id, user)

        return root_user
开发者ID:magictour,项目名称:trove,代码行数:16,代码来源:models.py

示例4: create

 def create(cls, context, instance_id, user):
     load_and_verify(context, instance_id)
     root = create_guest_client(context, instance_id).enable_root()
     root_user = guest_models.RootUser()
     root_user.deserialize(root)
     RootHistory.create(context, instance_id, user)
     return root_user
开发者ID:cretta,项目名称:trove,代码行数:7,代码来源:models.py

示例5: load_guest_info

def load_guest_info(instance, context, id):
    if instance.status not in AGENT_INVALID_STATUSES:
        guest = create_guest_client(context, id)
        try:
            instance.volume_used = guest.get_volume_info()['used']
        except Exception as e:
            LOG.error(e)
    return instance
开发者ID:pabelanger,项目名称:trove,代码行数:8,代码来源:models.py

示例6: load_via_context

def load_via_context(cls, context, instance_id):
    """Creates guest and fetches pagination arguments from the context."""
    load_and_verify(context, instance_id)
    limit = utils.pagination_limit(context.limit, cls.DEFAULT_LIMIT)
    client = create_guest_client(context, instance_id)
    # The REST API standard dictates that we *NEVER* include the marker.
    return cls.load_with_client(client=client, limit=limit,
                                marker=context.marker, include_marker=False)
开发者ID:Hopebaytech,项目名称:trove,代码行数:8,代码来源:models.py

示例7: access

 def access(cls, context, instance_id, username, hostname):
     load_and_verify(context, instance_id)
     client = create_guest_client(context, instance_id)
     databases = client.list_access(username, hostname)
     dbs = []
     for db in databases:
         dbs.append(Schema(name=db["_name"], collate=db["_collate"], character_set=db["_character_set"]))
     return UserAccess(dbs)
开发者ID:neetugrewal,项目名称:trove,代码行数:8,代码来源:models.py

示例8: change_password

 def change_password(cls, context, instance_id, users):
     load_and_verify(context, instance_id)
     client = create_guest_client(context, instance_id)
     change_users = []
     for user in users:
         change_user = {"name": user.name, "host": user.host, "password": user.password}
         change_users.append(change_user)
     client.change_passwords(change_users)
开发者ID:neetugrewal,项目名称:trove,代码行数:8,代码来源:models.py

示例9: check_rpl_delay

def check_rpl_delay(slave_id):
    LOG.info("\n\n\n============= check rpl delay ====================== %s" % slave_id)      
    guestagent_api = create_guest_client(get_context(),slave_id)
    _obj = guestagent_api.ksc_rpl_delay()
    if int(_obj) <=1:
        LOG.info('master-slave rpl ok')
    else:
        msg = 'master-slave rpl occur delay'
        raise Exception(msg)
开发者ID:zhujzhuo,项目名称:trove-1.0.10.4,代码行数:9,代码来源:utils.py

示例10: create

 def create(cls, context, instance_id, schemas):
     load_and_verify(context, instance_id)
     client = create_guest_client(context, instance_id)
     for schema in schemas:
         schema_name = schema["_name"]
         existing_schema, _nadda = Schemas.load_with_client(client, limit=1, marker=schema_name, include_marker=True)
         if len(existing_schema) > 0 and str(existing_schema[0].name) == str(schema_name):
             raise exception.DatabaseAlreadyExists(name=schema_name)
     return client.create_database(schemas)
开发者ID:neetugrewal,项目名称:trove,代码行数:9,代码来源:models.py

示例11: guest_log_list

 def guest_log_list(self, req, tenant_id, id):
     """Return all information about all logs for an instance."""
     LOG.debug("Listing logs for tenant %s" % tenant_id)
     context = req.environ[wsgi.CONTEXT_KEY]
     instance = models.Instance.load(context, id)
     if not instance:
         raise exception.NotFound(uuid=id)
     client = create_guest_client(context, id)
     guest_log_list = client.guest_log_list()
     return wsgi.Result({'logs': guest_log_list}, 200)
开发者ID:Hopebaytech,项目名称:trove,代码行数:10,代码来源:service.py

示例12: change_password

 def change_password(cls, context, instance_id, users):
     load_and_verify(context, instance_id)
     client = create_guest_client(context, instance_id)
     change_users = []
     for user in users:
         change_user = {'name': user.name,
                        'host': user.host,
                        'password': user.password,
                        }
         change_users.append(change_user)
     client.change_passwords(change_users)
开发者ID:cretta,项目名称:trove,代码行数:11,代码来源:models.py

示例13: load

 def load(cls, context, instance_id, username, hostname):
     load_and_verify(context, instance_id)
     validate = guest_models.MySQLUser()
     validate.name = username
     validate.host = hostname
     client = create_guest_client(context, instance_id)
     found_user = client.get_user(username=username, hostname=hostname)
     if not found_user:
         return None
     database_names = [{"name": db["_name"]} for db in found_user["_databases"]]
     return cls(found_user["_name"], found_user["_host"], found_user["_password"], database_names)
开发者ID:neetugrewal,项目名称:trove,代码行数:11,代码来源:models.py

示例14: check_rpl_consist

def check_rpl_consist(master_id,slave_ids,master_ip,slave_ips):
    global is_check_rpl_consit
    if is_check_rpl_consit:
        LOG.info("\n\n\n============= check rpl consistense ======================") 
        username = "rpltest"
        password = "kingsoft"     
        guestagent_api = create_guest_client(get_context(),master_id)
        guestagent_api.admin_create_replica_checking_user(chkUser = username, chkPsw = password)
        
        for _id in slave_ids:
            guestagent_api = create_guest_client(get_context(),_id)
            guestagent_api.admin_create_replica_checking_user(chkUser = username, chkPsw = password)
        #print _obj
        mysqlip = "mysql://%s:%[email protected]%s:3306/"
        rplcheck = ReplicaChecker(
                                  mysqlip % (username,password,master_ip),
                                 [mysqlip % (username,password,ip) for ip in slave_ips])
        _ret_dict = rplcheck.replica_consistence_check_by_master_slave()
        for k,v in _ret_dict.iteritems():
            LOG.info("%s %s" % (k,v))
        for k,v in _ret_dict.iteritems():
            if v>0:
                raise Exception("replica consistence find error on %s" % k)
开发者ID:zhujzhuo,项目名称:trove-1.0.10.4,代码行数:23,代码来源:utils.py

示例15: module_remove

 def module_remove(self, req, tenant_id, id, module_id):
     """Remove module from an instance."""
     context = req.environ[wsgi.CONTEXT_KEY]
     instance = models.Instance.load(context, id)
     if not instance:
         raise exception.NotFound(uuid=id)
     module = module_models.Module.load(context, module_id)
     module_info = module_views.DetailedModuleView(module).data()
     client = create_guest_client(context, id)
     client.module_remove(module_info)
     instance_module = module_models.InstanceModule.load(
         context, instance_id=id, module_id=module_id)
     if instance_module:
         module_models.InstanceModule.delete(context, instance_module)
     return wsgi.Result(None, 200)
开发者ID:Hopebaytech,项目名称:trove,代码行数:15,代码来源:service.py


注:本文中的trove.common.remote.create_guest_client函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。