def get_agent_version(self, instance, timeout=None):
        """Get the version of the agent running on the VM instance."""

        def _call():
            # Send the encrypted password
            transaction_id = str(uuid.uuid4())
            args = {'id': transaction_id}
            resp = self._make_agent_call('version', instance, '', args)
            if resp['returncode'] != '0':
                LOG.error(_('Failed to query agent version: %(resp)r') %
                          locals())
                return None
            # Some old versions of the Windows agent have a trailing \\r\\n
            # (ie CRLF escaped) for some reason. Strip that off.
            return resp['message'].replace('\\r\\n', '')

        if timeout:
            vm_ref = self._get_vm_opaque_ref(instance)
            vm_rec = self._session.get_xenapi().VM.get_record(vm_ref)

            domid = vm_rec['domid']

            expiration = time.time() + timeout
            while expiration < time.time():
                ret = _call()
                if ret:
                    return ret

                vm_rec = self._session.get_xenapi().VM.get_record(vm_ref)
                if vm_rec['domid'] != domid:
                    LOG.info(_('domid changed from %(olddomid)s to '
                               '%(newdomid)s') % {
                                   'olddomid': domid,
                                    'newdomid': vm_rec['domid']})
                    domid = vm_rec['domid']
        else:
            return _call()
dataset/ETHPy150Open nii-cloud/dodai-compute/nova/virt/xenapi/vmops.py/VMOps.get_agent_version/swapped operands of `<`