Ejemplo n.º 1
0
    def open_volume_server(self, server, params=None):
        key, security = self.determine_security(params)

        verbose("Trying volserver ", server.addr(), "\n")
        vol_conn = kafs.rx_new_connection(str(server.addr()),
                                          kafs.VOLSERVICE_PORT,
                                          kafs.VOLSERVICE_ID, key, security)
        return vol_conn
Ejemplo n.º 2
0
    def open_bos_server(self, server, params=None):
        key, security = self.determine_security(params)

        verbose("Trying bosserver ", server.addr(), "\n")
        bos_conn = kafs.rx_new_connection(str(server.addr()),
                                          kafs.BOSSERVICE_PORT,
                                          kafs.BOSSERVICE_ID, key, security)
        return bos_conn
Ejemplo n.º 3
0
    def open_pt_server(self, params=None):
        if self.__ptserver_index == None:
            self.__ptservers = self.query_vl_addrs()
            self.__ptserver_index = 0

        if self.__ptserver_index >= len(self.__ptservers):
            raise CellError("Couldn't connect to a PT server")
        server = self.__ptservers[self.__ptserver_index]

        key, security = self.determine_security(params)

        verbose("Trying ptserver ", server, "\n")

        pt_conn = kafs.rx_new_connection(str(server), kafs.PR_PORT,
                                         kafs.PR_SERVICE, key, security)
        return pt_conn
Ejemplo n.º 4
0
    def open_vl_server(self, params=None):
        if self.__vlconn:
            return

        key, security = self.determine_security(params)

        for vladdr in self.query_vl_addrs():
            verbose("Trying vlserver ", vladdr, "\n")

            z_conn = kafs.rx_new_connection(str(vladdr), kafs.VL_PORT,
                                            kafs.VL_SERVICE, key, security)
            try:
                ret = kafs.VL_Probe(z_conn)
                self.__vlconn = z_conn
                break
            except ConnectionRefusedError:
                pass
            del z_conn
        else:
            raise CellError("Couldn't connect to a VL server")

        return self.__vlconn
Ejemplo n.º 5
0
    for AFSDB in dns.resolver.query(cell, "AFSDB"):
        for A in dns.resolver.query(AFSDB.hostname, 'A'):
            vladdrs.add(A.address);
        print("AFSDB:", AFSDB.hostname, ":", vladdrs);
except dns.resolver.NoAnswer:
    print("Couldn't find any AFSDB records");

if not vladdrs:
    raise RuntimeError("Couldn't find any VL server addresses");

# Go through the list of VLDB servers until one answers a probe request
print("-- Probe for live VLDB servers --");
for vlserver in vladdrs:
    print("Trying", vlserver);

    z_conn = kafs.rx_new_connection(vlserver, kafs.VL_PORT, kafs.VL_SERVICE);

    try:
        ret = kafs.VL_Probe(z_conn);
        break;
    except ConnectionRefusedError:
        pass;
    del z_conn;

if not z_conn:
    raise RuntimeError("Couldn't connect to a server");

# Look up each of the volumes in the list
print("-- Look up the named volumes --");
for vol in volumes:
    ret = kafs.VL_GetEntryByName(z_conn, vol);