示例#1
0
class TNThreadedVirtualMachine (Thread):
    """
    This class is used to run L{ArchipelVirtualMachine} main loop
    in a thread.
    """

    def __init__(self, jid, password, hypervisor, configuration, name, organizationInfo):
        """
        The contructor of the class.
        @type jid: string
        @param jid: the jid of the L{TNArchipelVirtualMachine}
        @type password: string
        @param password: the password associated to the JID
        @type hypervisor: L{TNArchipelHypervisor}
        @param hypervisor: the hypervisor of the VM
        @type name: string
        @param name: the name of the VM
        @type organizationInfo: Dict
        @param organizationInfo: Dict containing locality, company name, company unit and owner
        """
        Thread.__init__(self)
        self.jid = jid
        self.password = password
        self.xmppvm = TNArchipelVirtualMachine(self.jid, self.password, hypervisor, configuration, name, organizationInfo)

    def get_instance(self):
        """
        This method returns the current L{TNArchipelVirtualMachine} instance.
        @rtype: ArchipelVirtualMachine
        @return: the L{ArchipelVirtualMachine} instance
        """
        return self.xmppvm

    def run(self):
        """
        Overiddes super class method. Do the L{TNArchipelVirtualMachine} main loop.
        """
        self.xmppvm.connect()
        self.xmppvm.loop()
class TNThreadedVirtualMachine(Thread):
    """
    this class is used to run L{ArchipelVirtualMachine} main loop
    in a thread.
    """

    def __init__(self, jid, password, hypervisor, configuration, name):
        """
        the contructor of the class
        @type jid: string
        @param jid: the jid of the L{TNArchipelVirtualMachine}
        @type password: string
        @param password: the password associated to the JID
        @type hypervisor: L{TNArchipelHypervisor}
        @param hypervisor: the hypervisor of the VM
        @type name: string
        @param name: the name of the VM
        """
        Thread.__init__(self)
        self.jid = jid
        self.password = password
        self.xmppvm = TNArchipelVirtualMachine(self.jid, self.password, hypervisor, configuration, name)

    def get_instance(self):
        """
        this method return the current L{TNArchipelVirtualMachine} instance
        @rtype: ArchipelVirtualMachine
        @return: the L{ArchipelVirtualMachine} instance
        """
        return self.xmppvm

    def run(self):
        """
        overiddes sur super class method. do the L{TNArchipelVirtualMachine} main loop
        """
        self.xmppvm.connect()
        self.xmppvm.loop()
示例#3
0
class TNThreadedVirtualMachine(Thread):
    """
    This class is used to run L{ArchipelVirtualMachine} main loop
    in a thread.
    """
    def __init__(self, jid, password, hypervisor, configuration, name):
        """
        The contructor of the class.
        @type jid: string
        @param jid: the jid of the L{TNArchipelVirtualMachine}
        @type password: string
        @param password: the password associated to the JID
        @type hypervisor: L{TNArchipelHypervisor}
        @param hypervisor: the hypervisor of the VM
        @type name: string
        @param name: the name of the VM
        """
        Thread.__init__(self)
        self.jid = jid
        self.password = password
        self.xmppvm = TNArchipelVirtualMachine(self.jid, self.password,
                                               hypervisor, configuration, name)

    def get_instance(self):
        """
        This method returns the current L{TNArchipelVirtualMachine} instance.
        @rtype: ArchipelVirtualMachine
        @return: the L{ArchipelVirtualMachine} instance
        """
        return self.xmppvm

    def run(self):
        """
        Overiddes super class method. Do the L{TNArchipelVirtualMachine} main loop.
        """
        self.xmppvm.connect()
        self.xmppvm.loop()