本文整理汇总了Python中membase.api.rest_client.RestConnection.is_zone_exist方法的典型用法代码示例。如果您正苦于以下问题:Python RestConnection.is_zone_exist方法的具体用法?Python RestConnection.is_zone_exist怎么用?Python RestConnection.is_zone_exist使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类membase.api.rest_client.RestConnection
的用法示例。
在下文中一共展示了RestConnection.is_zone_exist方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_delete_empty_defautl_zone
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import is_zone_exist [as 别名]
def test_delete_empty_defautl_zone(self):
zone_name ="test1"
default_zone = "Group 1"
moved_node = []
serverInfo = self.servers[0]
moved_node.append(serverInfo.ip)
rest = RestConnection(serverInfo)
try:
self.log.info("create zone {0}".format(zone_name))
rest.add_zone(zone_name)
if rest.is_zone_exist(zone_name):
self.log.info("Move node {0} from zone {1} to zone {2}" \
.format(moved_node, default_zone, zone_name))
status = rest.shuffle_nodes_in_zones(moved_node, default_zone, zone_name)
if status:
rest.delete_zone(default_zone)
else:
self.fail("Failed to move node {0} from zone {1} to zone {2}" \
.format(moved_node, default_zone, zone_name))
if not rest.is_zone_exist(default_zone):
self.log.info("successful delete default zone")
else:
raise Exception("Failed to delete default zone")
rest.rename_zone(zone_name, default_zone)
except Exception,e :
print e
示例2: _verify_zone
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import is_zone_exist [as 别名]
def _verify_zone(self, name):
serverInfo = self.servers[0]
rest = RestConnection(serverInfo)
if rest.is_zone_exist(name.strip()):
self.log.info("verified! zone '{0}' is existed".format(name.strip()))
else:
raise Exception("There is not zone with name: %s in cluster" % name)
示例3: tearDown
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import is_zone_exist [as 别名]
def tearDown(self):
super(RebalanceBaseTest, self).tearDown()
""" Delete the new zones created if zone > 1. """
if self.input.param("zone", 1) > 1:
rest = RestConnection(self.servers[0])
for i in range(1, int(self.input.param("zone", 1))):
a = "Group "
if rest.is_zone_exist(a + str(i + 1)):
rest.delete_zone(a + str(i + 1))
示例4: shuffle_nodes_between_zones_and_rebalance
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import is_zone_exist [as 别名]
def shuffle_nodes_between_zones_and_rebalance(self, to_remove=None):
"""
Shuffle the nodes present in the cluster if zone > 1. Rebalance the nodes in the end.
Nodes are divided into groups iteratively i.e. 1st node in Group 1, 2nd in Group 2, 3rd in Group 1 and so on, when
zone=2.
:param to_remove: List of nodes to be removed.
"""
if not to_remove:
to_remove = []
serverinfo = self.servers[0]
rest = RestConnection(serverinfo)
zones = ["Group 1"]
nodes_in_zone = {"Group 1": [serverinfo.ip]}
# Create zones, if not existing, based on params zone in test.
# Shuffle the nodes between zones.
if int(self.zone) > 1:
for i in range(1, int(self.zone)):
a = "Group "
zones.append(a + str(i + 1))
if not rest.is_zone_exist(zones[i]):
rest.add_zone(zones[i])
nodes_in_zone[zones[i]] = []
# Divide the nodes between zones.
nodes_in_cluster = [node.ip for node in self.get_nodes_in_cluster()]
nodes_to_remove = [node.ip for node in to_remove]
for i in range(1, len(self.servers)):
if self.servers[i].ip in nodes_in_cluster and self.servers[i].ip not in nodes_to_remove:
server_group = i % int(self.zone)
nodes_in_zone[zones[server_group]].append(self.servers[i].ip)
# Shuffle the nodesS
for i in range(1, self.zone):
node_in_zone = list(set(nodes_in_zone[zones[i]]) -
set([node for node in rest.get_nodes_in_zone(zones[i])]))
rest.shuffle_nodes_in_zones(node_in_zone, zones[0], zones[i])
otpnodes = [node.id for node in rest.node_statuses()]
nodes_to_remove = [node.id for node in rest.node_statuses() if node.ip in [t.ip for t in to_remove]]
# Start rebalance and monitor it.
started = rest.rebalance(otpNodes=otpnodes, ejectedNodes=nodes_to_remove)
if started:
result = rest.monitorRebalance()
msg = "successfully rebalanced cluster {0}"
self.log.info(msg.format(result))
# Verify replicas of one node should not be in the same zone as active vbuckets of the node.
if self.zone > 1:
self._verify_replica_distribution_in_zones(nodes_in_zone)
示例5: RestConnection
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import is_zone_exist [as 别名]
pass
serverInfo = self.servers[1]
rest = RestConnection(serverInfo)
self.user = serverInfo.rest_username
self.password = serverInfo.rest_password
if not rest.is_enterprise_edition():
raise Exception("Test failed to upgrade cluster from CE to EE")
self.log.info("try to create zone {0} when cluster {1} is completely EE".format(zone_name, serverInfo.ip))
result = rest.add_zone(zone_name)
self.log.info("sleep 5 seconds")
time.sleep(5)
if result:
self.log.info("Zone feature is available in this cluster")
else:
raise Exception("Could not create zone with name: %s in cluster. It's a bug" % zone_name)
if rest.is_zone_exist(zone_name.strip()):
self.log.info("verified! zone '{0}' is existed".format(zone_name.strip()))
else:
raise Exception("There is not zone with name: %s in cluster. It's a bug" % zone_name)
""" re-install enterprise edition for next test if there is any """
InstallerJob().parallel_install([self.servers[0]], params)
""" reset master node to new node to teardown cluster """
self.log.info("Start to clean up cluster")
self.master = self.servers[1]
self.servers = self.servers[1:]
def _verify_zone(self, name):
serverInfo = self.servers[0]
rest = RestConnection(serverInfo)