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


Python remote_util.RemoteMachineShellConnection类代码示例

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


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

示例1: customize_xdcr_settings

    def customize_xdcr_settings(self):
        """Set custom XDCR environment variables"""
        max_concurrent_reps_per_doc = self.param('max_concurrent_reps_per_doc', None)
        xdcr_doc_batch_size_kb = self.param('xdcr_doc_batch_size_kb', None)
        xdcr_checkpoint_interval = self.param('xdcr_checkpoint_interval', None)
        xdcr_latency_optimization = self.param('xdcr_latency_optimization', None)

        if max_concurrent_reps_per_doc:
            env_var = 'MAX_CONCURRENT_REPS_PER_DOC'
            value = max_concurrent_reps_per_doc
        elif xdcr_doc_batch_size_kb:
            env_var = 'XDCR_DOC_BATCH_SIZE_KB'
            value = xdcr_doc_batch_size_kb
        elif xdcr_checkpoint_interval:
            env_var = 'XDCR_CHECKPOINT_INTERVAL'
            value = xdcr_checkpoint_interval
        elif xdcr_latency_optimization:
            env_var = 'XDCR_LATENCY_OPTIMIZATION'
            value = xdcr_latency_optimization
        else:
            return

        self.log.info("changing {0} to {1}".format(env_var, value))

        for server in self.input.servers:
            rc = RemoteMachineShellConnection(server)
            rc.set_environment_variable(env_var, value)
开发者ID:jason-hou,项目名称:testrunner,代码行数:27,代码来源:perf.py

示例2: convert_to_hostname

 def convert_to_hostname(self, servers_with_hostnames):
     try:
         hostname = []
         for server in servers_with_hostnames:
             shell = RemoteMachineShellConnection(server)
             info = shell.extract_remote_info()
             domain = ''.join(info.domain[0])
             hostname.append(info.hostname[0] + "." + domain)
             master_rest = RestConnection(server)
             var = master_rest.get_nodes_self().hostname
             flag = True if server.ip in var else False
             self.log.info("get_node_self function returned : {0}".format(var))
             if flag:
                 self.log.info("Node {0} is referred via IP. Need to be referred with hostname. Changing the name of the node!!".format(server.ip))
                 version = RestConnection(server).get_nodes_self().version
                 if version.startswith("1.8.1") or version.startswith("2.0.0") or version.startswith("2.0.1"):
                     RemoteUtilHelper.use_hostname_for_server_settings(server)
                     obj = RestConnection(server)
                     obj.init_cluster()
                 else:
                     obj = RestConnection(server)
                     obj.init_cluster()
                     var = master_rest.rename_node(username='Administrator', password='password', port='', hostname=hostname[-1])
             else:
                 self.log.info("Node {0} already referred via hostname. No need to convert the name".format(server.ip))
     finally:
         shell.disconnect()
     return hostname
开发者ID:arunapiravi,项目名称:testrunner,代码行数:28,代码来源:hostnameTests.py

示例3: run

    def run(self):
        remote_client = RemoteMachineShellConnection(self.server)
        now = datetime.now()
        day = now.day
        month = now.month
        year = now.year
        hour = now.timetuple().tm_hour
        minute = now.timetuple().tm_min
        file_name = "%s-%s%s%s-%s%s-couch.tar.gz" % (self.server.ip, month, day, year, hour, minute)
        print "Collecting data files from %s\n" % self.server.ip

        remote_client.extract_remote_info()
        data_path = self.__get_data_path(os_type=remote_client.info.type.lower())
        output, error = remote_client.execute_command(
            "tar -zcvf {0} '{1}' >/dev/null 2>&1".format(file_name, data_path)
        )
        print "\n".join(output)
        print "\n".join(error)

        user_path = "/home/"
        if self.server.ssh_username == "root":
            user_path = "/"
        remote_path = "%s%s" % (user_path, self.server.ssh_username)
        status = remote_client.file_exists(remote_path, file_name)
        if not status:
            raise Exception("%s doesn't exists on server" % file_name)
        status = remote_client.get_file(remote_path, file_name, "%s/%s" % (self.path, file_name))
        if not status:
            raise Exception("Fail to download zipped logs from %s" % self.server.ip)
        remote_client.execute_command("rm -f %s" % os.path.join(remote_path, file_name))
        remote_client.disconnect()
开发者ID:DavidAlphaFox,项目名称:couchbase,代码行数:31,代码来源:collect_data_files.py

示例4: test_partial_rollback

    def test_partial_rollback(self):
        kv_node = self.get_nodes_from_services_map(service_type="kv", get_all_nodes=True)
        log.info("kv nodes:{0}".format(kv_node))
        for node in kv_node:
            mem_client = MemcachedClientHelper.direct_client(node, self.src_bucket_name)
            mem_client.stop_persistence()
        body = self.create_save_function_body(self.function_name, self.handler_code,
                                              worker_count=3)
        try:
            task = self.cluster.async_load_gen_docs(self.master, self.src_bucket_name, self.gens_load,
                                                    self.buckets[0].kvs[1], 'create', compression=self.sdk_compression)
        except Exception as e:
            log.info("error while loading data")
        self.deploy_function(body,wait_for_bootstrap=False)
        # Kill memcached on Node A
        self.log.info("Killing memcached on {0}".format(kv_node[1]))
        shell = RemoteMachineShellConnection(kv_node[1])
        shell.kill_memcached()

        # Start persistence on Node B
        self.log.info("Starting persistence on {0}".
                      format(kv_node[0]))
        mem_client = MemcachedClientHelper.direct_client(kv_node[0],
                                                         self.src_bucket_name)
        mem_client.start_persistence()
        # Wait for bootstrap to complete
        self.wait_for_bootstrap_to_complete(body['appname'])
        stats_src = RestConnection(self.master).get_bucket_stats(bucket=self.src_bucket_name)
        log.info(stats_src)
        self.verify_eventing_results(self.function_name, stats_src["curr_items"], skip_stats_validation=True)
开发者ID:arod1987,项目名称:testrunner,代码行数:30,代码来源:eventing_recovery.py

示例5: convert_to_hostname

 def convert_to_hostname(self, servers_with_hostnames, username='Administrator', password='password'):
     try:
         hostname = []
         for server in servers_with_hostnames:
             shell = RemoteMachineShellConnection(server)
             info = shell.extract_remote_info()
             domain = ''.join(info.domain[0])
             if not domain:
                 output = shell.execute_command_raw('nslookup %s' % info.hostname[0])
                 print output
                 self.fail("Domain is not defined, couchbase cannot be configured correctly. NOT A BUG. CONFIGURATION ISSUE")
             hostname.append(info.hostname[0] + "." + domain)
             master_rest = RestConnection(server)
             current_hostname = master_rest.get_nodes_self().hostname
             self.log.info("get_node_self function returned : {0}".format(current_hostname))
             if server.ip in current_hostname:
                 self.log.info("Node {0} is referred via IP. Need to be referred with hostname. Changing the name of the node!!".format(server.ip))
                 version = RestConnection(server).get_nodes_self().version
                 if version.startswith("1.8.1") or version.startswith("2.0.0") or version.startswith("2.0.1"):
                     RemoteUtilHelper.use_hostname_for_server_settings(server)
                     master_rest.init_cluster()
                 else:
                     master_rest.init_cluster()
                     master_rest.rename_node(username=username, password=password, port='', hostname=hostname[-1])
             else:
                 self.log.info("Node {0} already referred via hostname. No need to convert the name".format(server.ip))
     finally:
         shell.disconnect()
     return hostname
开发者ID:DavidAlphaFox,项目名称:couchbase,代码行数:29,代码来源:hostnameTests.py

示例6: _save_snapshot

    def _save_snapshot(self, server, bucket, file_base=None):
        """Save data files to a snapshot"""

        src_data_path = os.path.dirname(server.data_path or
                                        testconstants.COUCHBASE_DATA_PATH)
        dest_data_path = "{0}-snapshots".format(src_data_path)

        self.log.info("server={0}, src_data_path={1}, dest_data_path={2}"
                      .format(server.ip, src_data_path, dest_data_path))

        shell = RemoteMachineShellConnection(server)

        build_name, short_version, full_version = \
            shell.find_build_version("/opt/couchbase/", "VERSION.txt", "cb")

        dest_file = self._build_tar_name(bucket, full_version, file_base)

        self._exec_and_log(shell, "mkdir -p {0}".format(dest_data_path))

        # save as gzip file, if file exsits, overwrite
        # TODO: multiple buckets
        zip_cmd = "cd {0}; tar -cvzf {1}/{2} {3} {3}-data _*"\
            .format(src_data_path, dest_data_path, dest_file, bucket)
        self._exec_and_log(shell, zip_cmd)

        shell.disconnect()
        return True
开发者ID:,项目名称:,代码行数:27,代码来源:

示例7: set_ep_compaction

 def set_ep_compaction(self, comp_ratio):
     """Set up ep_engine side compaction ratio"""
     for server in self.input.servers:
         shell = RemoteMachineShellConnection(server)
         cmd = "/opt/couchbase/bin/cbepctl localhost:11210 "\
               "set flush_param db_frag_threshold {0}".format(comp_ratio)
         self._exec_and_log(shell, cmd)
         shell.disconnect()
开发者ID:,项目名称:,代码行数:8,代码来源:

示例8: start_atop

 def start_atop(self):
     """Start atop collector"""
     for node in self.nodes:
         shell = RemoteMachineShellConnection(node)
         cmd = "killall atop; rm -fr /tmp/*.atop;" + \
             "atop -w /tmp/{0}.atop -a 15".format(node.ip) + \
             " > /dev/null 2> /dev.null < /dev/null &"
         shell.execute_command(cmd)
开发者ID:mschoch,项目名称:testrunner,代码行数:8,代码来源:stats.py

示例9: stop_atop

 def stop_atop(self):
     """Stop atop collector"""
     for node in self.nodes:
         try:
             shell = RemoteMachineShellConnection(node)
         except SystemExit:
             log.error("can't establish SSH session with {0}".format(node.ip))
         else:
             shell.execute_command("killall atop")
开发者ID:xiejunyi,项目名称:testrunner,代码行数:9,代码来源:stats.py

示例10: reboot_server

 def reboot_server(self, server):
     remote_client = RemoteMachineShellConnection(server)
     remote_client.reboot_node()
     remote_client.disconnect()
     # wait for restart and warmup on all node
     self.sleep(self.wait_timeout * 5)
     # disable firewall on these nodes
     self.stop_firewall_on_node(server)
     # wait till node is ready after warmup
     ClusterOperationHelper.wait_for_ns_servers_or_assert([server], self, wait_if_warmup=True)
开发者ID:membase,项目名称:testrunner,代码行数:10,代码来源:eventing_base.py

示例11: tearDown

 def tearDown(self):
     server = self.master
     shell = RemoteMachineShellConnection(server)
     shell.execute_command(
         """curl -X DELETE -u Administrator:password http://{0}:8091/pools/default/buckets/beer-sample""".format(
             server.ip
         )
     )
     self.sleep(20)
     super(TokenTests, self).tearDown()
开发者ID:prasanna135,项目名称:testrunner,代码行数:10,代码来源:tuq_tokens.py

示例12: set_up_proxy

    def set_up_proxy(self, bucket=None):
        """Set up and start Moxi"""

        if self.input.moxis:
            self.log.info("setting up proxy")

            bucket = bucket or self.param('bucket', 'default')

            shell = RemoteMachineShellConnection(self.input.moxis[0])
            shell.start_moxi(self.input.servers[0].ip, bucket,
                             self.input.moxis[0].port)
            shell.disconnect()
开发者ID:,项目名称:,代码行数:12,代码来源:

示例13: set_ep_param

    def set_ep_param(self, type, param, value):
        """
        Set ep-engine specific param, using cbepctl

        type: paramter type, e.g: flush_param, tap_param, etc
        """
        bucket = Bucket(name=self.buckets[0], authType="sasl", saslPassword="")
        for server in self.input.servers:
            shell = RemoteMachineShellConnection(server)
            shell.execute_cbepctl(bucket,
                                  "", "set %s" % type, param, value)
            shell.disconnect()
开发者ID:,项目名称:,代码行数:12,代码来源:

示例14: start_atop

 def start_atop(self):
     """Start atop collector"""
     for node in self.nodes:
         try:
             shell = RemoteMachineShellConnection(node)
         except SystemExit:
             log.error("can't establish SSH session with {0}".format(node.ip))
         else:
             cmd = "killall atop; rm -fr /tmp/*.atop;" + \
                 "atop -w /tmp/{0}.atop -a 15".format(node.ip) + \
                 " > /dev/null 2> /dev.null < /dev/null &"
             shell.execute_command(cmd)
开发者ID:xiejunyi,项目名称:testrunner,代码行数:12,代码来源:stats.py

示例15: load_sample_buckets

    def load_sample_buckets(self, bucketName="beer-sample" ):
        """
        Load the specified sample bucket in Couchbase
        """
        #self.cluster.bucket_delete(server=self.master, bucket="default")
        server = self.master
        shell = RemoteMachineShellConnection(server)
        shell.execute_command("""curl -v -u Administrator:password \
                             -X POST http://{0}:8091/sampleBuckets/install \
                          -d '["{1}"]'""".format(server.ip, bucketName))
        self.sleep(30)

        shell.disconnect()
开发者ID:bharath-gp,项目名称:testrunner,代码行数:13,代码来源:tuq_tokens.py


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