def run_with_output(self, cmd, opts): ssh_cmd = get_ssh_cmd(self.host) ssh_cmd.append(self.host) ssh_cmd.append(self.get_ssh_prefix(opts.get("env")) + cmd) return of_util.subprocess_check_output(ssh_cmd)
cid = cid + (os.getpid() << 32) # create input file input_file = opts.bld_dir + "/hello.in" f = open(input_file, "w") try: print >> f, "hello, world!" finally: f.close() output_file = opts.bld_dir + "/hello.out" for d in of_node.OfNodeIter(node_list, ["osd"]): print "writing chunk to " + d.get_short_name() tool_cmd = [ opts.bld_dir + "/tool/fishtool", "chunk_write", "-i", input_file, "-k", str(d.id), hex(cid) ] of_util.subprocess_check_output(tool_cmd) for d in of_node.OfNodeIter(node_list, ["osd"]): print "reading chunk from " + d.get_short_name() tool_cmd = [ opts.bld_dir + "/tool/fishtool", "chunk_read", "-o", output_file, "-k", str(d.id), hex(cid) ] of_util.subprocess_check_output(tool_cmd) filecmp.cmp(input_file, output_file)
parser = OptionParser() (opts, args, node_list) = of_util.parse_deploy_opts(parser) if opts.bld_dir == None: sys.stderr.write("you must give a Redfish build directory\n") sys.exit(1) # get a chunk ID that we think will be unique cid = int(time.clock()) cid = cid + (os.getpid() << 32) # create input file input_file = opts.bld_dir + "/hello.in" f = open(input_file, "w") try: print >> f, "hello, world!" finally: f.close() output_file = opts.bld_dir + "/hello.out" for d in of_node.OfNodeIter(node_list, ["osd"]): print "writing chunk to " + d.get_short_name() tool_cmd = [opts.bld_dir + "/tool/fishtool", "chunk_write", "-i", input_file, "-k", str(d.id), hex(cid)] of_util.subprocess_check_output(tool_cmd) for d in of_node.OfNodeIter(node_list, ["osd"]): print "reading chunk from " + d.get_short_name() tool_cmd = [opts.bld_dir + "/tool/fishtool", "chunk_read", "-o", output_file, "-k", str(d.id), hex(cid)] of_util.subprocess_check_output(tool_cmd) filecmp.cmp(input_file, output_file)