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


Python RestConnection.get_zone_names方法代码示例

本文整理汇总了Python中membase.api.rest_client.RestConnection.get_zone_names方法的典型用法代码示例。如果您正苦于以下问题:Python RestConnection.get_zone_names方法的具体用法?Python RestConnection.get_zone_names怎么用?Python RestConnection.get_zone_names使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在membase.api.rest_client.RestConnection的用法示例。


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

示例1: cluster_server_groups_write

# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import get_zone_names [as 别名]
    def cluster_server_groups_write(self,username,password,host,port=8091, servers=None,cluster=None,httpCode=None,user_role=None):
        _cluster_server_groups_write = {
            "create_server_group":"pools/default/serverGroups;POST",
            "delete_server_group":"pools/default/serverGroups/<uuid>;DELETE",
            "edit_server_group":"pools/default/serverGroups;PUT",
            "edit_server_group_id":"pools/default/serverGroups/<uuid>;PUT"
        }

        rest = RestConnection(servers[0])
        try:
            rest.delete_zone('rbacNewGroup')
            rest.delete_zone('rbackGroup')
            rest.delete_zone('rbacNewGroupUpdated')

            create_server_group = {"create_server_group":"pools/default/serverGroups;POST;" + "{'name':'rbacGroup'}"}
            result = self._return_http_code(create_server_group,username,password,host=host,port=port, httpCode=httpCode, user_role=user_role)

            zones = rest.get_zone_names()
            create_server_group = {"delete_server_group":"pools/default/serverGroups/" + zones['rbacGroup'] + ";DELETE"}
            result = self._return_http_code(create_server_group,username,password,host=host,port=port, httpCode=httpCode, user_role=user_role)

            rest.add_zone('rbacNewGroup')
            zones = rest.get_zone_names()
            create_server_group = {"create_server_group":"pools/default/serverGroups/" + zones['rbacNewGroup'] + ";PUT;" + "{'name':'rbacNewGroupUpdated'}"}
            result = self._return_http_code(create_server_group,username,password,host=host,port=port, httpCode=httpCode, user_role=user_role)

        except:
            print "Issues with Server Group add test case"
开发者ID:mihirkamdarcouchbase,项目名称:testrunner,代码行数:30,代码来源:rbacPermissionList.py

示例2: tearDown

# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import get_zone_names [as 别名]
 def tearDown(self):
     if not self.input.param("skip_cleanup", True):
         if self.times_teardown_called > 1 :
             self.shell.disconnect()
     if self.input.param("skip_cleanup", True):
         if self.case_number > 1 or self.times_teardown_called > 1:
             self.shell.disconnect()
     self.times_teardown_called += 1
     serverInfo = self.servers[0]
     rest = RestConnection(serverInfo)
     zones = rest.get_zone_names()
     for zone in zones:
         if zone != "Group 1":
             rest.delete_zone(zone)
     self.clusters_dic = self.input.clusters
     if self.clusters_dic:
         if len(self.clusters_dic) > 1:
             self.dest_nodes = self.clusters_dic[1]
             self.dest_master = self.dest_nodes[0]
             if self.dest_nodes and len(self.dest_nodes) > 1:
                 self.log.info("======== clean up destination cluster =======")
                 rest = RestConnection(self.dest_nodes[0])
                 rest.remove_all_remote_clusters()
                 rest.remove_all_replications()
                 BucketOperationHelper.delete_all_buckets_or_assert(self.dest_nodes, self)
                 ClusterOperationHelper.cleanup_cluster(self.dest_nodes)
         elif len(self.clusters_dic) == 1:
             self.log.error("=== need 2 cluster to setup xdcr in ini file ===")
     else:
         self.log.info("**** If run xdcr test, need cluster config is setup in ini file. ****")
     super(CliBaseTest, self).tearDown()
开发者ID:arod1987,项目名称:testrunner,代码行数:33,代码来源:cli_base.py

示例3: tearDown

# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import get_zone_names [as 别名]
 def tearDown(self):
     """ Some test involve kill couchbase server.  If the test steps failed
         right after kill erlang process, we need to start couchbase server
         in teardown so that the next test will not be false failed """
     for server in self.servers:
         shell = RemoteMachineShellConnection(server)
         shell.start_couchbase()
     super(RackzoneBaseTest, self).tearDown()
     serverInfo = self.servers[0]
     rest = RestConnection(serverInfo)
     zones = rest.get_zone_names()
     for zone in zones:
         if zone != "Group 1":
             rest.delete_zone(zone)
     super(RackzoneBaseTest, self).tearDown()
开发者ID:ketakigangal,项目名称:testrunner,代码行数:17,代码来源:rackzone_base.py

示例4: tearDown

# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import get_zone_names [as 别名]
 def tearDown(self):
     """ Some test involve kill couchbase server.  If the test steps failed
         right after kill erlang process, we need to start couchbase server
         in teardown so that the next test will not be false failed """
     super(RackzoneBaseTest, self).tearDown()
     ClusterOperationHelper.cleanup_cluster(self.servers, master=self.master)
     for server in self.servers:
         shell = RemoteMachineShellConnection(server)
         shell.start_couchbase()
         self.sleep(7, "Time needed for couchbase server starts completely.")
     serverInfo = self.servers[0]
     rest = RestConnection(serverInfo)
     zones = rest.get_zone_names()
     for zone in zones:
         if zone != "Group 1":
             rest.delete_zone(zone)
开发者ID:arod1987,项目名称:testrunner,代码行数:18,代码来源:rackzone_base.py

示例5: test_settingsCluster

# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import get_zone_names [as 别名]

#.........这里部分代码省略.........
                               "view_fragmentation_threshold:percentage":50,
                               "view_fragmentation_threshold:size":10,
                               "purge_interval":3,
                               "source":"ns_server",
                               "user":"Administrator",
                               'source':source,
                               "user":user,
                               'ip':self.ipAddress,
                               'port':1234}
            rest.set_auto_compaction(dbFragmentThresholdPercentage=50,
                                     viewFragmntThresholdPercentage=50,
                                     dbFragmentThreshold=10,
                                     viewFragmntThreshold=10)

        elif (ops == 'modifyCompactionSettingsTime'):
            expectedResults = {"parallel_db_and_view_compaction":False,
                               "database_fragmentation_threshold:percentage":50,
                               "database_fragmentation_threshold:size":10,
                               "view_fragmentation_threshold:percentage":50,
                               "view_fragmentation_threshold:size":10,
                               "allowed_time_period:abort_outside":True,
                               "allowed_time_period:to_minute":15,
                               "allowed_time_period:from_minute":12,
                               "allowed_time_period:to_hour":1,
                               "allowed_time_period:from_hour":1,
                               "purge_interval":3,
                               "source":"ns_server",
                               "user":"Administrator",
                               'source':source,
                               "user":user,
                               'ip':self.ipAddress,
                               'port':1234,
                               }
            rest.set_auto_compaction(dbFragmentThresholdPercentage=50,
                                     viewFragmntThresholdPercentage=50,
                                     dbFragmentThreshold=10,
                                     viewFragmntThreshold=10,
                                     allowedTimePeriodFromHour=1,
                                     allowedTimePeriodFromMin=12,
                                     allowedTimePeriodToHour=1,
                                     allowedTimePeriodToMin=15,
                                     allowedTimePeriodAbort='true')

        elif (ops == "AddGroup"):
            expectedResults = {'group_name':'add group', 'source':source, 'user':user, 'ip':self.ipAddress, 'port':1234}
            rest.add_zone(expectedResults['group_name'])
            tempStr = rest.get_zone_uri()[expectedResults['group_name']]
            tempStr = (tempStr.split("/"))[4]
            expectedResults['uuid'] = tempStr

        elif (ops == "UpdateGroup"):
            expectedResults = {'group_name':'upGroup', 'source':source, 'user':user, 'ip':self.ipAddress, 'port':1234, 'nodes':[]}
            rest.add_zone(expectedResults['group_name'])
            rest.rename_zone(expectedResults['group_name'], 'update group')
            expectedResults['group_name'] = 'update group'
            tempStr = rest.get_zone_uri()[expectedResults['group_name']]
            tempStr = (tempStr.split("/"))[4]
            expectedResults['uuid'] = tempStr

        elif (ops == "UpdateGroupAddNodes"):
            sourceGroup = "Group 1"
            destGroup = 'destGroup'
            expectedResults = {'group_name':destGroup, 'source':source, 'user':user, 'ip':self.ipAddress, 'port':1234, 'nodes':['[email protected]' + self.master.ip], 'port':1234}
            #rest.add_zone(sourceGroup)
            rest.add_zone(destGroup)
            self.sleep(30)
            rest.shuffle_nodes_in_zones([self.master.ip], sourceGroup, destGroup)
            tempStr = rest.get_zone_uri()[expectedResults['group_name']]
            tempStr = (tempStr.split("/"))[4]
            expectedResults['uuid'] = tempStr

        elif (ops == "DeleteGroup"):
            expectedResults = {'group_name':'delete group', 'source':source, 'user':user, 'ip':self.ipAddress, 'port':1234}
            rest.add_zone(expectedResults['group_name'])
            tempStr = rest.get_zone_uri()[expectedResults['group_name']]
            tempStr = (tempStr.split("/"))[4]
            expectedResults['uuid'] = tempStr
            rest.delete_zone(expectedResults['group_name'])

        elif (ops == "regenCer"):
            expectedResults = {'source':source, 'user':user, 'ip':self.ipAddress, 'port':1234}
            rest.regenerate_cluster_certificate()

        elif (ops == 'renameNode'):
            rest.rename_node(self.master.ip, user, password)
            expectedResults = {"hostname":self.master.ip, "node":"[email protected]" + self.master.ip, "source":source, "user":user, "ip":self.ipAddress, "port":56845}

        try:
            self.checkConfig(self.eventID, self.master, expectedResults)
        finally:
            if (ops == "UpdateGroupAddNodes"):
                sourceGroup = "Group 1"
                destGroup = 'destGroup'
                rest.shuffle_nodes_in_zones([self.master.ip], destGroup, sourceGroup)

            rest = RestConnection(self.master)
            zones = rest.get_zone_names()
            for zone in zones:
                if zone != "Group 1":
                    rest.delete_zone(zone)
开发者ID:pkdevboxy,项目名称:testrunner,代码行数:104,代码来源:audittest.py

示例6: test_replica_distribution_in_zone

# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import get_zone_names [as 别名]

#.........这里部分代码省略.........
        nodes_in_zone = {}
        nodes_in_zone["Group 1"] = [serverInfo.ip]
        """ Create zone base on params zone in test"""
        try:
            if int(self.zone) > 1:
                for i in range(1,int(self.zone)):
                    a = "Group "
                    zone_name = a + str(i + 1)
                    zones.append(zone_name)
                    rest.add_zone(zone_name)
            servers_rebalanced = []
            self.user = serverInfo.rest_username
            self.password = serverInfo.rest_password
            if len(self.servers)%int(self.zone) != 0:
                msg = "unbalance zone.  Recaculate to make balance ratio node/zone"
                raise Exception(msg)
            """ Add node to each zone """
            k = 1
            for i in range(0, self.zone):
                if "Group 1" in zones[i]:
                    total_node_per_zone = int(len(self.servers))/int(self.zone) - 1
                else:
                    nodes_in_zone[zones[i]] = []
                    total_node_per_zone = int(len(self.servers))/int(self.zone)
                for n in range(0,total_node_per_zone):
                    nodes_in_zone[zones[i]].append(self.servers[k].ip)
                    rest.add_node(user=self.user, password=self.password, \
                        remoteIp=self.servers[k].ip, port='8091', zone_name=zones[i])
                    k += 1
            otpNodes = [node.id for node in rest.node_statuses()]
            """ Start rebalance and monitor it. """
            started = rest.rebalance(otpNodes, [])

            if started:
                try:
                    result = rest.monitorRebalance()
                except RebalanceFailedException as e:
                    self.log.error("rebalance failed: {0}".format(e))
                    return False, servers_rebalanced
                msg = "successfully rebalanced cluster {0}"
                self.log.info(msg.format(result))
            """ Verify replica of one node should not in same zone of active. """
            self._verify_replica_distribution_in_zones(nodes_in_zone, "tap")

            """ Simulate entire nodes down in zone(s) by killing erlang process"""
            shutdown_nodes = []
            if self.shutdown_zone >= 1 and self.zone >=2:
                self.log.info("Start to shutdown nodes in zone to failover")
                for down_zone in range(1, self.shutdown_zone + 1):
                    down_zone = "Group " + str(down_zone + 1)
                    for sv in nodes_in_zone[down_zone]:
                        for si in self.servers:
                            if si.ip == sv:
                                server = si
                                shutdown_nodes.append(si)

                        shell = RemoteMachineShellConnection(server)
                        shell.kill_erlang(self.os_name)
                        """ Failover down node(s)"""
                        self.log.info("----> start failover node %s" % server.ip)
                        failed_over = rest.fail_over("[email protected]" + server.ip)
                        if not failed_over:
                            self.log.info("unable to failover the node the first time. \
                                           try again in 75 seconds..")
                            time.sleep(75)
                            failed_over = rest.fail_over("[email protected]" + server.ip)
                        self.assertTrue(failed_over,
                                        "unable to failover node after erlang was killed")
            otpNodes = [node.id for node in rest.node_statuses()]
            self.log.info("----> start rebalance after failover.")
            """ Start rebalance and monitor it. """
            started = rest.rebalance(otpNodes, [])
            if started:
                try:
                    result = rest.monitorRebalance()
                except RebalanceFailedException as e:
                    self.log.error("rebalance failed: {0}".format(e))
                    return False, servers_rebalanced
                msg = "successfully rebalanced in selected nodes from the cluster ? {0}"
                self.log.info(msg.format(result))
            """ Compare current keys in bucekt with initial loaded keys count. """
            self._verify_total_keys(self.servers[0], self.num_items)
        except Exception as e:
            self.log.error(e)
            raise
        finally:
            self.log.info("---> remove all nodes in all zones")
            if shutdown_nodes:
                for node in shutdown_nodes:
                    conn = RemoteMachineShellConnection(node)
                    self.log.info("---> re-start nodes %s after erlang killed " % node.ip)
                    conn.start_couchbase()
                    time.sleep(5)
            BucketOperationHelper.delete_all_buckets_or_assert(self.servers, self)
            ClusterOperationHelper.cleanup_cluster(self.servers, master=self.master)
            self.log.info("---> remove all zones in cluster")
            rm_zones = rest.get_zone_names()
            for zone in rm_zones:
                if zone != "Group 1":
                    rest.delete_zone(zone)
开发者ID:arod1987,项目名称:testrunner,代码行数:104,代码来源:rackzonetests.py


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