1. 28 11月, 2018 1 次提交
  2. 03 10月, 2018 1 次提交
    • M
      util: add qemu_write_pidfile() · 9e6bdef2
      Marc-André Lureau 提交于
      There are variants of qemu_create_pidfile() in qemu-pr-helper and
      qemu-ga. Let's have a common implementation in libqemuutil.
      
      The code is initially based from pr-helper write_pidfile(), with
      various improvements and suggestions from Daniel Berrangé:
      
        QEMU will leave the pidfile existing on disk when it exits which
        initially made me think it avoids the deletion race. The app
        managing QEMU, however, may well delete the pidfile after it has
        seen QEMU exit, and even if the app locks the pidfile before
        deleting it, there is still a race.
      
        eg consider the following sequence
      
              QEMU 1        libvirtd        QEMU 2
      
        1.    lock(pidfile)
      
        2.    exit()
      
        3.                 open(pidfile)
      
        4.                 lock(pidfile)
      
        5.                                  open(pidfile)
      
        6.                 unlink(pidfile)
      
        7.                 close(pidfile)
      
        8.                                  lock(pidfile)
      
        IOW, at step 8 the new QEMU has successfully acquired the lock, but
        the pidfile no longer exists on disk because it was deleted after
        the original QEMU exited.
      
        While we could just say no external app should ever delete the
        pidfile, I don't think that is satisfactory as people don't read
        docs, and admins don't like stale pidfiles being left around on
        disk.
      
        To make this robust, I think we might want to copy libvirt's
        approach to pidfile acquisition which runs in a loop and checks that
        the file on disk /after/ acquiring the lock matches the file that
        was locked. Then we could in fact safely let QEMU delete its own
        pidfiles on clean exit..
      Signed-off-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <20180831145314.14736-2-marcandre.lureau@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      9e6bdef2
  3. 23 8月, 2018 1 次提交
  4. 07 7月, 2018 2 次提交
    • M
      pr-helper: Rework socket path handling · 2729d79d
      Michal Privoznik 提交于
      When reviewing Paolo's pr-helper patches I've noticed couple of
      problems:
      
      1) socket_path needs to be calculated at two different places
      (one for printing out help, the other if socket activation is NOT
      used),
      
      2) even though the default socket_path is allocated in
      compute_default_paths() it is the only default path the function
      handles. For instance, pidfile is allocated outside of this
      function. And yet again, at different places than 1)
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      Message-Id: <c791ba035f26ea957e8f3602e3009b621769b1ba.1530611283.git.mprivozn@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      2729d79d
    • P
      pr-helper: avoid error on PR IN command with zero request size · ee8c13b8
      Paolo Bonzini 提交于
      After reading a PR IN command with zero request size in prh_read_request,
      the resp->result field will be uninitialized and the resp.sz field will
      be also uninitialized when returning to prh_co_entry.
      
      If resp->result == GOOD (from a previous successful reply or just luck),
      then the assert in prh_write_response might not be triggered and
      uninitialized response will be sent.
      
      The fix is to remove the whole handling of sz == 0 in prh_co_entry.
      Those errors apply only to PR OUT commands and it's perfectly okay to
      catch them later in do_pr_out and multipath_pr_out; the check for
      too-short parameters in fact doesn't apply in the easy SG_IO case, as
      it can be left to the target firmware even.
      
      The result is that prh_read_request does not fail requests anymore and
      prh_co_entry becomes simpler.
      Reported-by: NDima Stepanov <dimastep@yandex-team.ru>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      ee8c13b8
  5. 29 6月, 2018 2 次提交
  6. 09 4月, 2018 2 次提交
  7. 26 3月, 2018 1 次提交
  8. 12 3月, 2018 1 次提交
    • T
      Polish the version strings containing the package version · 7e563bfb
      Thomas Huth 提交于
      Since commit 67a1de0d there is no space anymore between the
      version number and the parentheses when running configure with
      --with-pkgversion=foo :
      
       $ qemu-system-s390x --version
       QEMU emulator version 2.11.50(foo)
      
      But the space is included when building without that option
      when building from a git checkout:
      
       $ qemu-system-s390x --version
       QEMU emulator version 2.11.50 (v2.11.0-1494-gbec9c64e-dirty)
      
      The same confusion exists with the "query-version" QMP command.
      Let's fix this by introducing a proper QEMU_FULL_VERSION definition
      that includes the space and parentheses, while the QEMU_PKGVERSION
      should just cleanly contain the package version string itself.
      Note that this also changes the behavior of the "query-version" QMP
      command (the space and parentheses are not included there anymore),
      but that's supposed to be OK since the strings there are not meant
      to be parsed by other tools.
      
      Fixes: 67a1de0d
      Buglink: https://bugs.launchpad.net/qemu/+bug/1673373Signed-off-by: NThomas Huth <thuth@redhat.com>
      Message-Id: <1518692807-25859-1-git-send-email-thuth@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      7e563bfb
  9. 21 12月, 2017 1 次提交
  10. 18 10月, 2017 1 次提交
    • P
      qemu-pr-helper: use new libmultipath API · b3f1c8c4
      Paolo Bonzini 提交于
      libmultipath has recently changed its API.  The new API supports multi-threaded
      clients better.  Unfortunately there is no backwards-compatibility, so we just
      switch to the new one.  Running QEMU compiled with the new library on the old
      library will likely crash, while doing the opposite will cause QEMU not to
      start at all (because udev, get_multipath_config and put_multipath_config
      are undefined).
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      b3f1c8c4
  11. 23 9月, 2017 2 次提交
    • P
      scsi: add multipath support to qemu-pr-helper · fe8fc5ae
      Paolo Bonzini 提交于
      Proper support of persistent reservation for multipath devices requires
      communication with the multipath daemon, so that the reservation is
      registered and applied when a path comes up.  The device mapper
      utilities provide a library to do so; this patch makes qemu-pr-helper.c
      detect multipath devices and, when one is found, delegate the operation
      to libmpathpersist.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      fe8fc5ae
    • P
      scsi: build qemu-pr-helper · b855f8d1
      Paolo Bonzini 提交于
      Introduce a privileged helper to run persistent reservation commands.
      This lets virtual machines send persistent reservations without using
      CAP_SYS_RAWIO or out-of-tree patches.  The helper uses Unix permissions
      and SCM_RIGHTS to restrict access to processes that can access its socket
      and prove that they have an open file descriptor for a raw SCSI device.
      
      The next patch will also correct the usage of persistent reservations
      with multipath devices.
      
      It would also be possible to support for Linux's IOC_PR_* ioctls in
      the future, to support NVMe devices.  For now, however, only SCSI is
      supported.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      b855f8d1