1. 06 6月, 2018 6 次提交
    • R
      util: virerror: Introduce virGetLastError{Code,Domain} public APIs · 50e96bb2
      ramyelkest 提交于
      Many places in the code call virGetLastError() just to check the
      raised error code, or domain. However virGetLastError() can return
      NULL, so the code has to check for that first. This patch therefore
      introduces virGetLasError{Code,Domain} functions which always return a
      valid error code or domain respectively, thus dropping the need to
      perform any checks on the error object.
      Signed-off-by: NRamy Elkest <ramyelkest@gmail.com>
      Reviewed-by: NErik Skultety <eskultet@redhat.com>
      50e96bb2
    • R
    • D
      qemu: remove pointless connect retry logic in agent · fc06debd
      Daniel P. Berrangé 提交于
      When the agent code was first introduced back in
      
        commit c160ce33
        Author: Daniel P. Berrange <berrange@redhat.com>
        Date:   Wed Oct 5 18:31:54 2011 +0100
      
          QEMU guest agent support
      
      there was code that would loop and retry the connection when opening
      the agent socket. At this time, the only thing done in between the
      opening of the monitor socket & opening of the agent socket was a
      call to set the monitor capabilities. This was a no-op on non-QMP
      versions, so in theory there could be a race which let us connect
      to the monitor while the agent socket was still not created by QEMU.
      
      In the modern world, however, we long ago mandated the use of QMP
      for managing QEMU, so we're guaranteed to have a set capabilities
      QMP call. Once we've seen a reply to this, we're guaranteed that
      QEMU has fully initialized all backends and is in its event loop.
      
      We can thus be sure the QEMU agent socket is present and don't need
      to retry connections to it, even without having the chardev FD passing
      feature.
      Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      fc06debd
    • D
      qemu: don't retry connect() if doing FD passing · 7ef0471b
      Daniel P. Berrangé 提交于
      Since libvirt called bind() and listen() on the UNIX socket, it is
      guaranteed that connect() will immediately succeed, if QEMU is running
      normally. It will only fail if QEMU has closed the monitor socket by
      mistake or if QEMU has exited, letting the kernel close it.
      
      With this in mind we can remove the retry loop and timeout when
      connecting to the QEMU monitor if we are doing FD passing. Libvirt can
      go straight to sending the QMP greeting and will simply block waiting
      for a reply until QEMU is ready.
      Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      7ef0471b
    • D
      qemu: support passing pre-opened UNIX socket listen FD · 30fb2276
      Daniel P. Berrangé 提交于
      There is a race condition when spawning QEMU where libvirt has spawned
      QEMU but the monitor socket is not yet open. Libvirt has to repeatedly
      try to connect() to QEMU's monitor until eventually it succeeds, or
      times out. We use kill() to check if QEMU is still alive so we avoid
      waiting a long time if QEMU exited, but having a timeout at all is still
      unpleasant.
      
      With QEMU 2.12 we can pass in a pre-opened FD for UNIX domain or TCP
      sockets. If libvirt has called bind() and listen() on this FD, then we
      have a guarantee that libvirt can immediately call connect() and
      succeed without any race.
      
      Although we only really care about this for the monitor socket and agent
      socket, this patch does FD passing for all UNIX socket based character
      devices since there appears to be no downside to it.
      
      We don't do FD passing for TCP sockets, however, because it is only
      possible to pass a single FD, while some hostnames may require listening
      on multiple FDs to cover IPv4 and IPv6 concurrently.
      Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      30fb2276
    • D
      qemu: probe for -chardev 'fd' parameter for FD passing · 7cef131e
      Daniel P. Berrangé 提交于
      QEMU >= 2.12 will support passing of pre-opened file descriptors for
      socket based character devices.
      Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      7cef131e
  2. 05 6月, 2018 34 次提交