Example #1
0
 def __init__(self, ip_addr, syncer=None, notifier=None, passive=False, **kwargs):
     """
     Init the CMConnection and then init the SyncCMResources.
     :param ip_addr: IP address to use.
     :param syncer: Barrier object to sync between all the test processes.
     :param notifier: Queue object to pass objects between the connection
                      sides.
     :param passive: Indicate if it's a passive side.
     :param kwargs: Arguments used to initialize the CM resources. For more
                    info please check CMResources.
     """
     super(CMSyncConnection, self).__init__(syncer=syncer, notifier=notifier)
     self.cm_res = SyncCMResources(addr=ip_addr, passive=passive, **kwargs)
Example #2
0
class CMSyncConnection(CMConnection):
    """
    Implement RDMACM connection management for synchronous CMIDs. It includes
    connection establishment, disconnection and other methods such as traffic.
    """
    def __init__(self,
                 ip_addr,
                 syncer=None,
                 notifier=None,
                 passive=False,
                 **kwargs):
        """
        Init the CMConnection and then init the SyncCMResources.
        :param ip_addr: IP address to use.
        :param syncer: Barrier object to sync between all the test processes.
        :param notifier: Queue object to pass objects between the connection
                         sides.
        :param passive: Indicate if it's a passive side.
        :param kwargs: Arguments used to initialize the CM resources. For more
                       info please check CMResources.
        """
        super(CMSyncConnection, self).__init__(syncer=syncer,
                                               notifier=notifier)
        self.create_cm_res(ip_addr, passive=passive, **kwargs)

    def create_cm_res(self, ip_addr, passive, **kwargs):
        self.cm_res = SyncCMResources(addr=ip_addr, passive=passive, **kwargs)
        self.cm_res.create_cmid()

    def establish_connection(self):
        """
        Establish RDMACM connection between two Sync CMIDs.
        """
        if self.cm_res.passive:
            self.cm_res.cmid.listen()
            self.syncer.wait()
            self.cm_res.create_child_id()
            self.cm_res.child_id.accept()
            self.cm_res.create_mr()
        else:
            self.syncer.wait()
            self.cm_res.cmid.connect()
            self.cm_res.create_mr()

    def disconnect(self):
        """
        Disconnect the connection.
        """
        if self.cm_res.port_space == ce.RDMA_PS_TCP:
            if self.cm_res.passive:
                self.cm_res.child_id.disconnect()
            else:
                self.cm_res.cmid.disconnect()
Example #3
0
 def create_cm_res(self, ip_addr, passive, **kwargs):
     self.cm_res = SyncCMResources(addr=ip_addr, passive=passive, **kwargs)
     self.cm_res.create_cmid()