Пример #1
0
 def testZombie(self):
     args = [EXT_SLEEP, "0"]
     sproc = commands.start(args)
     sproc.kill()
     try:
         test = lambda: self.assertEqual(utils.getCmdArgs(sproc.pid), tuple(
         ))
         function.retry(AssertionError, test, tries=10, sleep=0.1)
     finally:
         sproc.wait()
Пример #2
0
    def _connect(self):
        self._manager = _SuperVdsmManager(address=ADDRESS, authkey=b'')
        self._manager.register('instance')
        self._manager.register('open')
        self._log.debug("Trying to connect to Super Vdsm")
        try:
            function.retry(
                self._manager.connect, Exception, timeout=60, tries=3)
        except Exception as ex:
            msg = "Connect to supervdsm service failed: %s" % ex
            panic(msg)

        # pylint: disable=no-member
        self._svdsm = self._manager.instance()
Пример #3
0
    def _connect(self):
        self._manager = _SuperVdsmManager(address=ADDRESS, authkey='')
        self._manager.register('instance')
        self._manager.register('open')
        self._log.debug("Trying to connect to Super Vdsm")
        try:
            function.retry(self._manager.connect,
                           Exception,
                           timeout=60,
                           tries=3)
        except Exception as ex:
            msg = "Connect to supervdsm service failed: %s" % ex
            panic(msg)

        # pylint: disable=no-member
        self._svdsm = self._manager.instance()
Пример #4
0
 def retryAssert(self, *args, **kwargs):
     '''Keep retrying an assertion if AssertionError is raised.
        See function utils.retry for the meaning of the arguments.
     '''
     # the utils module only can be imported correctly after
     # hackVdsmModule() is called. Do not import it at the
     # module level.
     from vdsm.common.function import retry
     return retry(expectedException=AssertionError, *args, **kwargs)
Пример #5
0
def open_connection(uri=None, username=None, passwd=None):
    """ by calling this method you are getting a new and unwrapped connection
        if you want to use wrapped and cached connection use the get() method
    """
    def req(credentials, user_data):
        for cred in credentials:
            if cred[0] == libvirt.VIR_CRED_AUTHNAME:
                cred[4] = username
            elif cred[0] == libvirt.VIR_CRED_PASSPHRASE:
                cred[4] = passwd.value if passwd else None
        return 0

    auth = [[libvirt.VIR_CRED_AUTHNAME, libvirt.VIR_CRED_PASSPHRASE], req,
            None]

    libvirtOpen = functools.partial(libvirt.openAuth, uri, auth, 0)
    return function.retry(libvirtOpen, timeout=10, sleep=0.2)
Пример #6
0
def open_connection(uri=None, username=None, passwd=None):
    """ by calling this method you are getting a new and unwrapped connection
        if you want to use wrapped and cached connection use the get() method
    """
    def req(credentials, user_data):
        for cred in credentials:
            if cred[0] == libvirt.VIR_CRED_AUTHNAME:
                cred[4] = username
            elif cred[0] == libvirt.VIR_CRED_PASSPHRASE:
                cred[4] = passwd.value if passwd else None
        return 0

    auth = [[libvirt.VIR_CRED_AUTHNAME, libvirt.VIR_CRED_PASSPHRASE],
            req, None]

    libvirtOpen = functools.partial(
        libvirt.openAuth, uri, auth, 0)
    return function.retry(libvirtOpen, timeout=10, sleep=0.2)
Пример #7
0
 def _recoverThread(self):
     # Trying to run recover process until it works. During that time vdsm
     # stays in recovery mode (_recover=True), means all api requests
     # returns with "vdsm is in initializing process" message.
     function.retry(self._recoverExistingVms, sleep=5)
Пример #8
0
 def _connect(self):
     retry(self.start, (socket.error, KeyError), tries=30)
Пример #9
0
 def _recoverThread(self):
     # Trying to run recover process until it works. During that time vdsm
     # stays in recovery mode (_recover=True), means all api requests
     # returns with "vdsm is in initializing process" message.
     function.retry(self._recoverExistingVms, sleep=5)
Пример #10
0
Файл: utils.py Проект: nirs/vdsm
 def _connect(self):
     retry(self.start, (socket.error, KeyError), tries=30)