1. 23 4月, 2013 1 次提交
  2. 30 1月, 2013 1 次提交
    • M
      docs: aesthetical cleanups · 901f4b6b
      Martin Kletzander 提交于
      Adding dots inside "exempli gratia" where missing.  While on that, I
      took the liberty of changing it where found with simple grep.
      901f4b6b
  3. 25 1月, 2013 1 次提交
  4. 17 1月, 2013 2 次提交
  5. 16 1月, 2013 1 次提交
    • J
      locking: Remove unnecessary setting of lockspace · e8cd571b
      John Ferlan 提交于
      In virLockSpaceProtocolDispatchNew() the returned value of lockspace from
      virLockDaemonFindLockSpace() is overwritten by the virLockSpaceNew() return.
      Coverity complains that it's unused.
      
      In virLockSpaceProtocolDispatchCreateLockSpace() lockspace is also overwritten
      in a similar manner resulting in the same Coverity message.
      e8cd571b
  6. 14 1月, 2013 1 次提交
  7. 09 1月, 2013 1 次提交
  8. 08 1月, 2013 1 次提交
    • E
      maint: avoid potential promotion issues with [ug]id_t · 798ff667
      Eric Blake 提交于
      POSIX does not guarantee whether uid_t and gid_t are signed or
      unsigned, nor does it guarantee whether they are smaller, same
      size, or larger than int (or even the same size as one another).
      Therefore, it is possible to have platforms where '(uid_t)-1==-1'
      is false or where 'uid = gid = -1' sets uid to the wrong value,
      thanks to integer promotion rules.  The only portable way to use
      the placeholder value of these two types is to always use a cast.
      Thankfully, the issue is mostly theoretical - sanlock only
      compiles on Linux for now, and on Linux, these types do not
      suffer from strange promotion problems.
      
      * src/locking/lock_driver_sanlock.c
      (virLockManagerSanlockSetupLockspace, virLockManagerSanlockInit)
      (virLockManagerSanlockCreateLease): Cast -1 to proper type before
      comparing with uid_t or gid_t.
      798ff667
  9. 07 1月, 2013 2 次提交
    • E
      build: properly substitute virtlockd.socket · cb854b8f
      Eric Blake 提交于
      virtlockd.service could be installed to a configurable root,
      but virtlockd.socket was hardcoded to installation into a
      distro.
      
      * src/Makefile.am (virtlockd.service, virtlockd.socket): Drop
      unused substitutions.
      * src/locking/virtlockd.socket.in (ListenStream): Don't hard-code
      /var.
      cb854b8f
    • E
      build: use common .in replacement mechanism · 462a6962
      Eric Blake 提交于
      We had several different styles of .in conversion in our Makefiles:
      ALLCAPS, @ALLCAPS@, @lower@, ::lower::
      Canonicalize on one form, to make it easier to copy and paste
      between .in files.
      
      Also, we were using some non-portable sed constructs: \@ is an
      undefined escape sequence (it happens to be @ itself in GNU sed,
      but POSIX allows it to mean something else), as well as risky
      behavior (failure to consistently quote things means a space
      in $(sysconfdir) could throw things off; also, Autoconf recommends
      using | rather than , or ! in the s||| operator, because | has to
      be quoted in shell and is therefore less likely to appear in file
      names than , or !).
      
      Fix all of these uses to follow the same syntax.
      
      * daemon/libvirtd.8.in: Switch to @var@.
      * tools/virt-xml-validate.in: Likewise.
      * tools/virt-pki-validate.in: Likewise.
      * src/locking/virtlockd.init.in: Likewise.
      * daemon/Makefile.am: Prefer | over ! in sed.
      (libvirtd.8): Prefer consistent substitution.
      (libvirtd.init, libvirtd.service): Avoid non-portable sed.
      * tools/Makefile.am (libvirt-guests.sh, libvirt-guests.init)
      (libvirt-guests.service): Likewise.
      (virt-xml-validate, virt-pki-validate, virt-sanlock-cleanup):
      Prefer consistent capitalization.
      * src/Makefile.am (virtlockd.init, virtlockd.service)
      (virtlockd.socket): Prefer consistent substitution.
      462a6962
  10. 28 12月, 2012 1 次提交
    • M
      sanlock: Chown lease files as well · ce753ec5
      Michal Privoznik 提交于
      Since sanlock doesn't run under root:root, we have chown()'ed the
      __LIBVIRT__DISKS__ lease file to the user:group defined in the
      sanlock config. However, when writing the patch I've forgot about
      lease files for each disk (this is the
      /var/lib/libvirt/sanlock/<md5>) file.
      ce753ec5
  11. 21 12月, 2012 7 次提交
  12. 14 12月, 2012 1 次提交
    • M
      sanlock: Re-add lockspace unconditionally · 11cfa288
      Michal Privoznik 提交于
      Currently, if sanlock is already registering a lockspace other
      libvirtd instances (from other hosts) obtain -EINPROGRESS. On
      sufficiently new sanlock, sanlock_inq_lockspace() is called,
      which suspend execution until lockspace state is changed. With
      current libvirt implementation, we fail to retry adding the
      lockspace again but continue in error path. Therefore we produce
      meaningless error message:
      
      virLockManagerSanlockSetupLockspace:363 : Unable to add lockspace
      /var/lib/libvirt/sanlock/__LIBVIRT__DISKS__: Success
      qemudLoadDriverConfig:558 : Failed to load lock manager sanlock
      
      We should try to re-add the lockspace after its state change to
      be sure it was added successfully. In fact, with sufficiently new
      sanlock we can just avoid dummy usleep() which is used if there's
      no inquire API.
      11cfa288
  13. 13 12月, 2012 10 次提交
    • D
      Add support for locking based on SCSI volume ID · 64f0e145
      Daniel P. Berrange 提交于
      64f0e145
    • D
      Add support for locking based on LVM volume uuid · 565d040f
      Daniel P. Berrange 提交于
      565d040f
    • D
      Add ability to maintain disk leases indirectly · f14fdae3
      Daniel P. Berrange 提交于
      The default lockd driver behavour is to acquire leases
      directly on the disk files. This introduces an alternative
      mode, where leases are acquire indirectly on a file that
      is based on a SHA256 hash of the disk filename.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      f14fdae3
    • D
      Add a virtlockd client as a lock driver impl · eb8268a4
      Daniel P. Berrange 提交于
      This adds a 'lockd' lock driver which is just a client which
      talks to the lockd daemon to perform all locking. This will
      be the default lock driver for any hypervisor which needs one.
      
      * src/Makefile.am: Add lockd.so plugin
      * src/locking/lock_driver_lockd.c: Lockd driver impl
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      eb8268a4
    • D
      Add support for re-exec() of virtlockd upon SIGUSR1 · f234dc93
      Daniel P. Berrange 提交于
      The virtlockd daemon maintains file locks on behalf of libvirtd
      and any VMs it is running. These file locks must be held for as
      long as any VM is running. If virtlockd itself ever quits, then
      it is expected that a node would be fenced/rebooted. Thus to
      allow for software upgrads on live systemd, virtlockd needs the
      ability to re-exec() itself.
      
      Upon receipt of SIGUSR1, virtlockd will save its current live
      state out to a file /var/run/virtlockd-restart-exec.json
      It then re-exec()'s itself with exactly the same argv as it
      originally had, and loads the state file, reconstructing any
      objects as appropriate.
      
      The state file contains information about all locks held and
      all network services and clients currently active. An example
      state document is
      
       {
          "server": {
              "min_workers": 1,
              "max_workers": 20,
              "priority_workers": 0,
              "max_clients": 20,
              "keepaliveInterval": 4294967295,
              "keepaliveCount": 0,
              "keepaliveRequired": false,
              "services": [
                  {
                      "auth": 0,
                      "readonly": false,
                      "nrequests_client_max": 1,
                      "socks": [
                          {
                              "fd": 6,
                              "errfd": -1,
                              "pid": 0,
                              "isClient": false
                          }
                      ]
                  }
              ],
              "clients": [
                  {
                      "auth": 0,
                      "readonly": false,
                      "nrequests_max": 1,
                      "sock": {
                          "fd": 9,
                          "errfd": -1,
                          "pid": 0,
                          "isClient": true
                      },
                      "privateData": {
                          "restricted": true,
                          "ownerPid": 1722,
                          "ownerId": 6,
                          "ownerName": "f18x86_64",
                          "ownerUUID": "97586ba9-df27-9459-c806-f016c8bbd224"
                      }
                  },
                  {
                      "auth": 0,
                      "readonly": false,
                      "nrequests_max": 1,
                      "sock": {
                          "fd": 10,
                          "errfd": -1,
                          "pid": 0,
                          "isClient": true
                      },
                      "privateData": {
                          "restricted": true,
                          "ownerPid": 1784,
                          "ownerId": 7,
                          "ownerName": "f16x86_64",
                          "ownerUUID": "7b8e5e42-b875-61e9-b981-91ad8fa46979"
                      }
                  }
              ]
          },
          "defaultLockspace": {
              "resources": [
                  {
                      "name": "/var/lib/libvirt/images/f16x86_64.raw",
                      "path": "/var/lib/libvirt/images/f16x86_64.raw",
                      "fd": 14,
                      "lockHeld": true,
                      "flags": 0,
                      "owners": [
                          1784
                      ]
                  },
                  {
                      "name": "/var/lib/libvirt/images/shared.img",
                      "path": "/var/lib/libvirt/images/shared.img",
                      "fd": 12,
                      "lockHeld": true,
                      "flags": 1,
                      "owners": [
                          1722,
                          1784
                      ]
                  },
                  {
                      "name": "/var/lib/libvirt/images/f18x86_64.img",
                      "path": "/var/lib/libvirt/images/f18x86_64.img",
                      "fd": 11,
                      "lockHeld": true,
                      "flags": 0,
                      "owners": [
                          1722
                      ]
                  }
              ]
          },
          "lockspaces": [
      
          ],
          "magic": "30199"
       }
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      f234dc93
    • D
      Enable systemd socket activation with virtlockd · 74c0353e
      Daniel P. Berrange 提交于
      This enhancement virtlockd so that it can receive a pre-opened
      UNIX domain socket from systemd at launch time, and adds the
      systemd service/socket unit files
      
      * daemon/libvirtd.service.in: Require virtlockd to be running
      * libvirt.spec.in: Add virtlockd systemd files
      * src/Makefile.am: Install systemd files
      * src/locking/lock_daemon.c: Support socket activation
      * src/locking/virtlockd.service.in, src/locking/virtlockd.socket.in:
        systemd unit files
      * src/rpc/virnetserverservice.c, src/rpc/virnetserverservice.h:
        Add virNetServerServiceNewFD() method
      * src/rpc/virnetsocket.c, src/rpc/virnetsocket.h: Add virNetSocketNewListenFD
        method
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      74c0353e
    • D
      Implement dispatch functions for lock protocol in virtlockd · 0e49b839
      Daniel P. Berrange 提交于
      Introduce a lock_daemon_dispatch.c file which implements the
      server side dispatcher the RPC APIs previously defined in the
      lock protocol.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      0e49b839
    • D
      Define a wire protocol for talking to the virtlockd daemon · ad39fd83
      Daniel P. Berrange 提交于
      The virtlockd daemon will be responsible for managing locks
      on virtual machines. Communication will be via the standard
      RPC infrastructure. This provides the XDR protocol definition
      
      * src/locking/lock_protocol.x: Wire protocol for virtlockd
      * src/Makefile.am: Include lock_protocol.[ch] in virtlockd
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      ad39fd83
    • D
      Introduce basic infrastructure for virtlockd daemon · c57e3d89
      Daniel P. Berrange 提交于
      The virtlockd daemon will maintain locks on behalf of libvirtd.
      There are two reasons for it to be separate
      
       - Avoid risk of other libvirtd threads accidentally
         releasing fcntl() locks by opening + closing a file
         that is locked
       - Ensure locks can be preserved across libvirtd restarts.
         virtlockd will need to be able to re-exec itself while
         maintaining locks. This is simpler to achieve if its
         sole job is maintaining locks
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      c57e3d89
    • D
      Refactor creation of lock manager plugins · f199f75e
      Daniel P. Berrange 提交于
      Refactor virLockManagerPluginNew() so that the caller does
      not need to pass in the config file path itself - just the
      config directory and driver name.
      
      Fix QEMU to actually pass in a config file when creating the
      default lock manager plugin, rather than NULL.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      f199f75e
  14. 16 11月, 2012 1 次提交
    • M
      sanlock: Retry after EINPROGRESS · 96a02703
      Michal Privoznik 提交于
      It may take some time for sanlock to add a lockspace. And if user
      restart libvirtd service meanwhile, the fresh daemon can fail adding
      the same lockspace with EINPROGRESS. Recent sanlock has
      sanlock_inq_lockspace() function which should block until lockspace
      changes state. If we are building against older sanlock we should
      retry a few times before claiming an error. This issue can be easily
      reproduced:
      
      for i in {1..1000} ; do echo $i; service libvirtd restart; sleep 2; done
      20
      Stopping libvirtd daemon:                                  [FAILED]
      Starting libvirtd daemon:                                  [  OK  ]
      21
      Stopping libvirtd daemon:                                  [  OK  ]
      Starting libvirtd daemon:                                  [  OK  ]
      22
      Stopping libvirtd daemon:                                  [  OK  ]
      Starting libvirtd daemon:                                  [  OK  ]
      
       error : virLockManagerSanlockSetupLockspace:334 : Unable to add
       lockspace /var/lib/libvirt/sanlock/__LIBVIRT__DISKS__: Operation now in
       progress
      96a02703
  15. 02 11月, 2012 1 次提交
  16. 30 10月, 2012 1 次提交
  17. 17 10月, 2012 1 次提交
    • J
      locking: Fix build with sanlock < 2.4 · 5ce6d95e
      Jiri Denemark 提交于
      libvirt started using sanlock_killpath to implement on_lockfailure
      action. Since sanlock_killpath was introduced in sanlock 2.4, libvirt
      fails to build with older sanlock.
      5ce6d95e
  18. 11 10月, 2012 4 次提交
  19. 21 9月, 2012 2 次提交