示例#1
0
def stop(directory=None):
    sc = settings.cluster
    nodes = common.get_nodes([sc.get("clients"), sc.get("servers"), sc.get("mons"), sc.get("rgws")])
    common.pdsh(nodes, "pkill -SIGINT -f collectl").communicate()
    common.pdsh(nodes, "sudo pkill -SIGINT -f perf_3.6").communicate()
    common.pdsh(sc.get("servers"), "sudo pkill -SIGINT -f blktrace").communicate()
    if directory:
        common.pdsh(nodes, "cd %s/perf;sudo chown %s.%s perf.data" % (directory, sc.get("user"), sc.get("user")))
        make_movies(directory)
示例#2
0
def start(directory):
    sc = settings.cluster
    nodes = common.get_nodes([sc.get("clients"), sc.get("servers"), sc.get("mons"), sc.get("rgws")])
    collectl_dir = "%s/collectl" % directory
    perf_dir = "%s/perf" % directory
    blktrace_dir = "%s/blktrace" % directory

    # collectl
    common.pdsh(nodes, "mkdir -p -m0755 -- %s;collectl -s+mYZ -i 1:10 -F0 -f %s" % (collectl_dir, collectl_dir))
    def test_method(self):
        self.info("Creating new district...")
        (ret, output) = common.create_district(self.district_name)
        self.assert_equal(0, ret, "Unable to create district:%s")

        nodes = common.get_nodes()
        pnodes=[]
        for node in nodes:
            pnodes.append(common.get_public_ip_from_private(node))
        self.assert_true((len(nodes)>=2), "There must be at least 2 ndoes...")
        for node in nodes:
            ret = common.add_node2district(self.district_name,node)
            self.assert_equal(0, ret, "Error during adding node into district")
        #Creating 1st app
        self.info("Creating app#1...")
        (ret, status) = self.config.rest_api.app_create(self.app_name1, 
                        common.app_types[self.test_variant])
        self.assert_equal('Created', ret, "Error during creating app#1 - %s"%self.app_name1)
        self.info("Waiting...")
        common.sleep(90)
        self.info("Creating app#2...")
        (ret,status) = self.config.rest_api.app_create(self.app_name2, 
                       common.app_types[self.test_variant])
        self.assert_equal('Created', ret, "Error during creating app#2 - %s"%self.app_name2)
        (gear_group1, gear_count) = self.config.rest_api.get_gears(self.app_name1)
        app1_gear=gear_group1[0]['gears'][0]['id']
        (gear_group2, gear_count) = self.config.rest_api.get_gears(self.app_name2)
        app2_gear=gear_group2[0]['gears'][0]['id']
        gears={}
        print "*"*80
        for node in pnodes:
            gears[node] = common.get_gears_per_node(node)
            if gears[node].has_key(app1_gear):
                print "\tApp1's gear[%s] is deployed on %s"%(app1_gear, node)
                app1_node=node
            if gears[node].has_key(app2_gear):
                print "\tApp2's gear[%s] is deployed on %s"%(app2_gear, node)
                app2_node=node
        print "*"*80
        self.assert_true((app1_node!=app2_node), "App1 should not reside on the same node as App2")
        '''
        db = brokerdb.BrokerDB(collections = ['district'])
        districts = db.get_collection('district')
        print "DISTRICTS: [UUID | NAME | NODES]"
        for district in districts:
            #print district.keys()
            print "\t",district['uuid'], district['name'], district['server_identities']
        print uuid1,uuid2
        '''
        return self.passed("%s passed" % self.__class__.__name__)
示例#4
0
 def dropcaches(self):
     nodes = common.get_nodes([settings.cluster.get('clients'), settings.cluster.get('servers')])
     common.pdsh(nodes, 'sync').communicate()
     common.pdsh(nodes, 'echo 3 | sudo tee /proc/sys/vm/drop_caches').communicate()