Exemplo n.º 1
0
    def _find_roots(self):
        """
        Retrieves root disks
        """
        print "Finding root disks..."

        # Query MicroSAN disks
        fd_pkt = uSanProto.FindDisks()

        # Send packet
        bs = BroadcastSocket()
        bs.send_data(fd_pkt)
        while True:
            try:
                bs.recv_data()
            except:
                break

        bs.close()

        # Parse root disks
        disks = []
        for reply_info in bs.buf:
            pkt = reply_info[0]
            addr = reply_info[1]
            pkt_data = uSanProto.FindDisks.parse_reply(pkt)
            ipaddr = pkt_data[0]
            print 'Found root disk: %s' % ipaddr
            disks.append(ipaddr)

        return disks
Exemplo n.º 2
0
    def name_res(self, uid):
        """
        Resolve partition IP address by UID
        """
        bs = BroadcastSocket()

        rp_pkt = uSanProto.Resolve(uid)
        bs.send_data(rp_pkt)

        while True:
            try:
                bs.recv_data()
            except:
                break

        rp_reply = bs.buf[0]
        bs.close()

        rp_reply_data = uSanProto.Resolve.parse(rp_reply[0])

        return rp_reply_data