1. 18 10月, 2012 6 次提交
  2. 17 10月, 2012 15 次提交
  3. 16 10月, 2012 15 次提交
    • D
      7bd744c4
    • D
      Make virInitialize thread safe · d507f8f9
      Daniel P. Berrange 提交于
      Currently there is a restriction that multi-threaded applications
      must manually call virInitialize, before threads start using
      libvirt, because it is not thread-safe. By switching it to use
      a virOnceControl initializer we gain thread safety, and thus
      applications no longer need to manually call it. They can rely
      on virConnectOpen invoking it for them.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      d507f8f9
    • D
      Fix virProcessKillPainfully on Win32 · 84912e9c
      Daniel P. Berrange 提交于
      Win32 platforms don't have SIGKILL defined, but they do have
      SIGABRT. Since our virProcess wrapper treats anything which
      isn't SIGTERM/SIGINT as equivalent to SIGKILL, just use
      SIGABRT on Win32.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      84912e9c
    • D
      Add JSON serialization of virNetServerPtr objects for process re-exec() · 381a339e
      Daniel P. Berrange 提交于
      Add two new APIs virNetServerNewPostExecRestart and
      virNetServerPreExecRestart which allow a virNetServerPtr
      object to be created from a JSON object and saved to a
      JSON object, for the purpose of re-exec'ing a process.
      
      This includes serialization of all registered services
      and clients
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      381a339e
    • D
      Add JSON serialization of virNetServerClientPtr objects for process re-exec() · 3cfc3d7d
      Daniel P. Berrange 提交于
      Add two new APIs virNetServerClientNewPostExecRestart and
      virNetServerClientPreExecRestart which allow a virNetServerClientPtr
      object to be created from a JSON object and saved to a
      JSON object, for the purpose of re-exec'ing a process.
      
      This includes serialization of the connected socket associated
      with the client
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      3cfc3d7d
    • D
      Add JSON serialization of virNetServerServicePtr objects for process re-exec() · 0cc79255
      Daniel P. Berrange 提交于
      Add two new APIs virNetServerServiceNewPostExecRestart and
      virNetServerServicePreExecRestart which allow a virNetServerServicePtr
      object to be created from a JSON object and saved to a
      JSON object, for the purpose of re-exec'ing a process.
      
      This includes serialization of the listening sockets associated
      with the service
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      0cc79255
    • D
      Add JSON serialization of virNetSocketPtr objects for process re-exec() · c2981453
      Daniel P. Berrange 提交于
      Add two new APIs virNetSocketNewPostExecRestart and
      virNetSocketPreExecRestart which allow a virNetSocketPtr
      object to be created from a JSON object and saved to a
      JSON object, for the purpose of re-exec'ing a process.
      
      As well as saving the state in JSON format, the second
      method will disable the O_CLOEXEC flag so that the open
      file descriptors are preserved across the process re-exec()
      
      Since it is not possible to serialize SASL or TLS encryption
      state, an error will be raised if attempting to perform
      serialization on non-raw sockets
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      c2981453
    • D
      Add JSON serialization of virLockSpacePtr objects for process re-exec() · 8057c04e
      Daniel P. Berrange 提交于
      Add two new APIs virLockSpaceNewPostExecRestart and
      virLockSpacePreExecRestart which allow a virLockSpacePtr
      object to be created from a JSON object and saved to a
      JSON object, for the purposes of re-exec'ing a process.
      
      As well as saving the state in JSON format, the second
      method will disable the O_CLOEXEC flag so that the open
      file descriptors are preserved across the process re-exec()
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      8057c04e
    • D
      Introduce an internal API for handling file based lockspaces · eca72d47
      Daniel P. Berrange 提交于
      The previously introduced virFile{Lock,Unlock} APIs provide a
      way to acquire/release fcntl() locks on individual files. For
      unknown reason though, the POSIX spec says that fcntl() locks
      are released when *any* file handle referring to the same path
      is closed. In the following sequence
      
        threadA: fd1 = open("foo")
        threadB: fd2 = open("foo")
        threadA: virFileLock(fd1)
        threadB: virFileLock(fd2)
        threadB: close(fd2)
      
      you'd expect threadA to come out holding a lock on 'foo', and
      indeed it does hold a lock for a very short time. Unfortunately
      when threadB does close(fd2) this releases the lock associated
      with fd1. For the current libvirt use case for virFileLock -
      pidfiles - this doesn't matter since the lock is acquired
      at startup while single threaded an never released until
      exit.
      
      To provide a more generally useful API though, it is necessary
      to introduce a slightly higher level abstraction, which is to
      be referred to as a "lockspace".  This is to be provided by
      a virLockSpacePtr object in src/util/virlockspace.{c,h}. The
      core idea is that the lockspace keeps track of what files are
      already open+locked. This means that when a 2nd thread comes
      along and tries to acquire a lock, it doesn't end up opening
      and closing a new FD. The lockspace just checks the current
      list of held locks and immediately returns VIR_ERR_RESOURCE_BUSY.
      
      NB, the API as it stands is designed on the basis that the
      files being locked are not being otherwise opened and used
      by the application code. One approach to using this API is to
      acquire locks based on a hash of the filepath.
      
      eg to lock /var/lib/libvirt/images/foo.img the application
      might do
      
         virLockSpacePtr lockspace = virLockSpaceNew("/var/lib/libvirt/imagelocks");
         lockname = md5sum("/var/lib/libvirt/images/foo.img");
         virLockSpaceAcquireLock(lockspace, lockname);
      
      NB, in this example, the caller should ensure that the path
      is canonicalized before calculating the checksum.
      
      It is also possible to do locks directly on resources by
      using a NULL lockspace directory and then using the file
      path as the lock name eg
      
         virLockSpacePtr lockspace = virLockSpaceNew(NULL);
         virLockSpaceAcquireLock(lockspace, "/var/lib/libvirt/images/foo.img");
      
      This is only safe to do though if no other part of the process
      will be opening the files. This will be the case when this
      code is used inside the soon-to-be-reposted virlockd daemon
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      eca72d47
    • M
      tests: Fix domain-events python test · 60f96bfc
      Martin Kletzander 提交于
      There was a missing method in python implementation of domain-events
      test and this patch adds that.
      60f96bfc
    • E
      maint: prepare for next release number · 819c8ce0
      Eric Blake 提交于
      Given Daniel's announcement[1], code targetting the next release will
      be in 1.0.0, not 0.10.3.  Changed mechanically with:
      
      for f in $(git grep -l '0\(.\)10\13\b') ; do
         sed -i -e 's/0\(.\)10\13/1\10\10/g' $f
      done
      
      [1]https://www.redhat.com/archives/libvir-list/2012-October/msg00403.html
      
      * docs/formatdomain.html.in: Use 1.0.0 for next release.
      * src/interface/interface_backend_udev.c: Likewise.
      819c8ce0
    • E
      maint: fix license on polkit script · 1c3fee6a
      Eric Blake 提交于
      As approved here:
      https://www.redhat.com/archives/libvir-list/2012-October/msg00701.html
      
      * daemon/libvirtd.policy.in: Use LGPLv2+ license.
      1c3fee6a
    • M
      conf: add test for boot dev and order · 59952932
      Martin Kletzander 提交于
      Add test for 280b8c9e.
      59952932
    • M
      conf: Fix crash with cleanup · 280b8c9e
      Martin Kletzander 提交于
      There was a crash possible when both <boot dev... and <boot
      order... were specified due to virDomainDefParseBootXML() erroring out
      before setting *tmp (which was free'd in cleanup).  As a fix, I
      created this cleanup that uses one pointer for all the temporary
      stored XPath strings and values, plus this pointer is correctly
      initialized to NULL.
      280b8c9e
    • M
      selinux: Use raw contexts 2 · 6676c1fc
      Martin Kletzander 提交于
      In commit 9674f2c6, I forgot to change
      selabel_lookup with the other functions, so this one-liner does exactly
      that.
      6676c1fc
  4. 15 10月, 2012 4 次提交
    • E
      maint: drop spurious semicolons · 2cfa14bc
      Eric Blake 提交于
      Detected with:
      git grep ';;$' -- '**/*.[ch]'
      
      * src/network/bridge_driver.c (networkRadvdConfContents): Fix
      harmless typo.
      * src/phyp/phyp_driver.c (phypUUIDTable_Pull): Likewise.
      * src/qemu/qemu_monitor_json.c (qemuMonitorJSONDriveDel):
      Likewise.
      2cfa14bc
    • G
      selinux: add security selinux function to label tapfd · ae368ebf
      Guannan Ren 提交于
      BZ:https://bugzilla.redhat.com/show_bug.cgi?id=851981
      When using macvtap, a character device gets first created by
      kernel with name /dev/tapN, its selinux context is:
      system_u:object_r:device_t:s0
      
      Shortly, when udev gets notification when new file is created
      in /dev, it will then jump in and relabel this file back to the
      expected default context:
      system_u:object_r:tun_tap_device_t:s0
      
      There is a time gap happened.
      Sometimes, it will have migration failed, AVC error message:
      type=AVC msg=audit(1349858424.233:42507): avc:  denied  { read write } for
      pid=19926 comm="qemu-kvm" path="/dev/tap33" dev=devtmpfs ino=131524
      scontext=unconfined_u:system_r:svirt_t:s0:c598,c908
      tcontext=system_u:object_r:device_t:s0 tclass=chr_file
      
      This patch will label the tapfd device before qemu process starts:
      system_u:object_r:tun_tap_device_t:MCS(MCS from seclabel->label)
      ae368ebf
    • M
      Add support for SUSPEND_DISK event · 7ba5defb
      Martin Kletzander 提交于
      This patch adds support for SUSPEND_DISK event; both lifecycle and
      separated.  The support is added for QEMU, machines are changed to
      PMSUSPENDED, but as QEMU sends SHUTDOWN afterwards, the state changes
      to shut-off.  This and much more needs to be done in order for libvirt
      to work with transient devices, wake-ups etc.  This patch is not
      aiming for that functionality.
      7ba5defb
    • J
      util: switch virLogEatParams to virLogSource · a9e3b4f7
      Ján Tomko 提交于
      Commit e8fd8757 changed 'const char *'
      category to virLogSource enum. This changes it in virLogEatParams as
      well, thus fixing the build with --disable-debug.
      --
      Hopefully moving the enum declarations is less ugly than using int.
      a9e3b4f7