Пример #1
0
import of_util
import os
import sys
import tempfile

of_util.check_python_version()


def process_is_running(pid):
    try:
        subprocess_check_output(["ps", "-p", str(pid)])
        return True
    except:
        return False


parser = OptionParser()
(opts, args, node_list) = of_util.parse_deploy_opts(parser)
for d in of_node.OfNodeIter(node_list, ["daemon"]):
    try:
        pid = d.run_with_output("cat " + d.get_pid_path(), {})
        if (process_is_running(int(pid))):
            print "error: daemon " + d.get_short_name(
            ) + " is still running as process " + pid
            continue
        else:
            os.unlink(d.get_pid_path())
    except CalledProcessError, e:
        pass
    d.run(d.bin_path + " -c " + d.conf_path + " -k " + str(d.id), {})
Пример #2
0
import sys
import tempfile

of_util.check_python_version()
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)

# If we've configured ssh connection sharing, create the ssh control sockets
# here
of_node.kill_ssh_connection_sharing_daemons(node_list)
of_node.create_ssh_connection_sharing_daemons(node_list)

# Build the binaries to install
install_dir = os.path.join(tempfile.gettempdir(), str(os.getpid()))
install_dir = install_dir + "/"
os.mkdir(install_dir)
os.chdir(opts.bld_dir)
subprocess.check_call(["make", "install", ("DESTDIR=" + install_dir)])

for n in of_node.OfNodeIter(node_list, []):
    print "installing " + n.get_short_name()
    # Create base_dir where logs and configuration will go
    n.run("mkdir -p '" + n.base_dir + "'", {})
    # Upload configuration file
    n.upload_conf(opts.conf_json)
    # upload system binaries
    n.upload(install_dir, n.base_dir)
Пример #3
0
# 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)
    ]
Пример #4
0
#!/usr/bin/python

from optparse import OptionParser
import json
import of_daemon
import of_node
import of_util
import os
import subprocess
import sys
import tempfile

of_util.check_python_version()
parser = OptionParser()
(opts, args, node_list) = of_util.parse_deploy_opts(parser)

stests = []

for d in of_node.OfNodeIter(node_list, ["test_client"]):
    print "starting tests on " + d.get_short_name()
    stests.append(d.start_stest({"test": "st_startup"}))
    stests.append(d.start_stest({"test": "st_trivial"}))
    stests.append(d.start_stest({"test": "st_write_then_read"}))
    stests.append(d.start_stest({"test": "st_mkdirs"}))
    stests.append(d.start_stest({"test": "st_unlink"}))
    stests.append(d.start_stest({"test": "st_rename1"}))

for d in of_node.OfNodeIter(node_list, ["test_client"]):
    d.join_stests_expect_success()
print "tests completed successfully."
Пример #5
0
#!/usr/bin/python

from optparse import OptionParser
from subprocess import *
import json
import of_daemon
import of_node
import of_util
import os
import sys
import tempfile

of_util.check_python_version()
parser = OptionParser()
(opts, args, node_list) = of_util.parse_deploy_opts(parser)

diter = of_node.OfNodeIter(node_list, ["daemon"])
for d in diter:
    try:
        pid = d.run_with_output("cat " + d.get_pid_path(), {})
        print d.get_short_name() + " is running as process " + pid
    except CalledProcessError, e:
        print d.get_short_name() + " is NOT running."