1. 17 10月, 2012 1 次提交
    • J
      qemu: Clear async job when p2p migration fails early · d325704a
      Jiri Denemark 提交于
      When p2p migration fails early because qemuMigrationIsAllowed or
      qemuMigrationIsSafe say migration should be cancelled, we fail to clear
      the migration-out async job. As a result of that, further APIs called
      for the same domain may fail with Timed out during operation: cannot
      acquire state change lock.
      
      Reported by Guido Winkelmann.
      d325704a
  2. 09 10月, 2012 1 次提交
  3. 08 10月, 2012 3 次提交
    • C
      Prep for release 0.9.11.6 · 7725e01c
      Cole Robinson 提交于
      7725e01c
    • G
      remove dnsmasq command line parameter "--filterwin2k" · 38e6d7b9
      Gene Czarcinski 提交于
      This patch removed the "--filterwin2k" dnsmasq command line
      parameter which was unnecessary for domain specification,
      possibly blocked some usage, and was command line clutter.
      
      Gene Czarcinski <gene@czarc.net>
      (cherry picked from commit f20b7dbe)
      
      Conflicts:
      	tests/networkxml2argvdata/nat-network-dns-txt-record.argv
      38e6d7b9
    • G
      dnsmasq: avoid forwarding queries without a domain · 3fcc9096
      Gene Czarcinski 提交于
      dnsmasq is forwarding a number of queries upstream that should not
      be done.  There still remains an MX query for a plain name with no
      domain specified that will be forwarded is dnsmasq has --domain=xxx
      --local=/xxx/ specified. This does not happen with no domain name
      and --local=// ... not a libvirt problem.
      
      BTW, thanks again to Claudio Bley!
      (cherry picked from commit f3868259)
      
      Conflicts:
      	AUTHORS
      3fcc9096
  4. 20 9月, 2012 1 次提交
    • M
      security: Fix libvirtd crash possibility · b2c5a911
      Martin Kletzander 提交于
      Fix for CVE-2012-4423.
      
      When generating RPC protocol messages, it's strictly needed to have a
      continuous line of numbers or RPC messages. However in case anyone
      tries backporting some functionality and will skip a number, there is
      a possibility to make the daemon segfault with newer virsh (version of
      the library, rpc call, etc.) even unintentionally.
      
      The problem is that the skipped numbers will get func filled with
      NULLs, but there is no check whether these are set before the daemon
      tries to run them. This patch very simply enhances one check and fixes
      that.
      (cherry picked from commit b7ff9e69)
      b2c5a911
  5. 14 8月, 2012 1 次提交
  6. 13 8月, 2012 33 次提交
    • E
      tests: avoid seclabeltest crash · 758a066a
      Eric Blake 提交于
      Commit a56c3470 introduced a use of random numbers into seclabel
      handling, but failed to initialize the random number generator
      in the testsuite.  Also, fail with usual status, not 255.
      
      * tests/seclabeltest.c (main): Initialize randomness.
      (cherry picked from commit a22a36e8)
      
      Conflicts:
      	tests/seclabeltest.c
      758a066a
    • D
      client rpc: Fix error checking after poll() · 086c3fba
      Daniel P. Berrange 提交于
      First 'poll' can't return EWOULDBLOCK, and second, we're checking errno
      so far away from the poll() call that we've probably already trashed the
      original errno value.
      (cherry picked from commit 5d490603)
      086c3fba
    • J
      client rpc: Send keepalive requests from IO event loop · e9c00cbc
      Jiri Denemark 提交于
      In addition to keepalive responses, we also need to send keepalive
      requests from client IO loop to properly detect dead connection in case
      a libvirt API is called from the main loop, which prevents any timers to
      be called.
      (cherry picked from commit 4d971dc7)
      e9c00cbc
    • J
      server rpc: Remove APIs for manipulating filters on locked client · f8e65111
      Jiri Denemark 提交于
      We don't need to add or remove filters when client object is already
      locked anymore. There's no reason to keep the *Locked variants of those
      APIs.
      (cherry picked from commit d9ad4166)
      f8e65111
    • J
      rpc: Remove unused parameter in virKeepAliveStopInternal · 6180670c
      Jiri Denemark 提交于
      The previous commit removed the only usage of ``all'' parameter in
      virKeepAliveStopInternal, which was actually the only reason for having
      virKeepAliveStopInternal. This effectively reverts most of commit
      6446a9e2.
      (cherry picked from commit 0ec514b3)
      6180670c
    • J
      rpc: Do not use timer for sending keepalive responses · 4d695acd
      Jiri Denemark 提交于
      When a libvirt API is called from the main event loop (which seems to be
      common in event-based glib apps), the client IO loop would properly
      handle keepalive requests sent by a server but will not actually send
      them because the main event loop is blocked with the API. This patch
      gets rid of response timer and the thread which is processing keepalive
      requests is also responsible for queueing responses for delivery.
      (cherry picked from commit bb85f229)
      4d695acd
    • J
      client rpc: Separate call creation from running IO loop · 400a5a92
      Jiri Denemark 提交于
      This makes it possible to create and queue new calls while we are
      running IO loop.
      (cherry picked from commit c57103e5)
      400a5a92
    • J
      rpc: Add APIs for direct triggering of keepalive timer · e4859677
      Jiri Denemark 提交于
      Add virKeepAliveTimeout and virKeepAliveTrigger APIs that can be used to
      set poll timeouts and trigger keepalive timer. virKeepAliveTrigger
      checks if it is called to early and does nothing in that case.
      (cherry picked from commit 28c75382)
      e4859677
    • J
      rpc: Refactor keepalive timer code · 2c5b4c56
      Jiri Denemark 提交于
      The code that needs to be run every keepalive interval of inactivity was
      only called from a timer and thus from the main event loop. We will need
      to call the code directly from another place.
      (cherry picked from commit a2ba8686)
      2c5b4c56
    • J
      client rpc: Drop unused return value of virNetClientSendNonBlock · 419cb872
      Jiri Denemark 提交于
      As we never drop non-blocking calls, the return value that used to
      indicate a call was dropped is no longer needed.
      (cherry picked from commit ca9b13e3)
      419cb872
    • J
      client rpc: Just queue non-blocking call if another thread has the buck · 4779cf0f
      Jiri Denemark 提交于
      As non-blocking calls are no longer dropped, we don't really need to
      care that much about their fate and wait for the thread with the buck
      to process them. If another thread has the buck, we can just push a
      non-blocking call to the queue and be done with it.
      (cherry picked from commit ef392614)
      4779cf0f
    • J
      client rpc: Don't drop non-blocking calls · 5badf8c4
      Jiri Denemark 提交于
      So far, we were dropping non-blocking calls whenever sending them would
      block. In case a client is sending lots of stream calls (which are not
      supposed to generate any reply), the assumption that having other calls
      in a queue is sufficient to get a reply from the server doesn't work. I
      tried to fix this in b1e374a7 but
      failed and reverted that commit.
      
      With this patch, non-blocking calls are never dropped (unless the
      connection is being closed) and will always be sent.
      (cherry picked from commit 78602c4e)
      5badf8c4
    • J
      client rpc: Use event loop for writing · 8cb0d089
      Jiri Denemark 提交于
      Normally, when every call has a thread associated with it, the thread
      may get the buck and be in charge of sending all calls until its own
      call is done. When we introduced non-blocking calls, we had to add
      special handling of new non-blocking calls. This patch uses event loop
      to send data if there is no thread to get the buck so that any
      non-blocking calls left in the queue are properly sent without having to
      handle them specially. It also avoids adding even more cruft to client
      IO loop in the following patches.
      
      With this change in, non-blocking calls may see unpredictable delays in
      delivery when the client has no event loop registered. However, the only
      non-blocking calls we have are keepalives and we already require event
      loop for them, which makes this a non-issue until someone introduces new
      non-blocking calls.
      (cherry picked from commit 9e747e5c)
      8cb0d089
    • J
      client rpc: Improve debug messages in virNetClientIO · b1dcd198
      Jiri Denemark 提交于
      When analyzing our debug log, I'm always confused about what each of the
      pointers mean. Let's be explicit.
      (cherry picked from commit 71689f95)
      b1dcd198
    • P
      keepalive: Add ability to disable keepalive messages · 6f429469
      Peter Krempa 提交于
      The docs for virConnectSetKeepAlive() advertise that this function
      should be able to disable keepalives on negative or zero interval time.
      
      This patch removes the check that prohibited this and adds code to
      disable keepalives on negative/zero interval.
      
      * src/libvirt.c: virConnectSetKeepAlive(): - remove check for negative
                                                   values
      * src/rpc/virnetclient.c
      * src/rpc/virnetclient.h: - add virNetClientKeepAliveStop() to disable
                                  keepalive messages
      * src/remote/remote_driver.c: remoteSetKeepAlive(): -add ability to
                                                           disable keepalives
      (cherry picked from commit 6446a9e2)
      6f429469
    • P
      conf: Remove console stream callback only when freeing console helper · 2fd84d39
      Peter Krempa 提交于
      Commit ba226d33 tried to fix crash of
      the daemon when a domain with an open console was destroyed. The fix was
      wrong as it tried to remove the callback also when the stream was
      aborted, where at that point the fd stream driver was already freed and
      removed.
      
      This patch clears the callbacks with a helper right before the hash is
      freed, so that it doesn't interfere with other codepaths where the
      stream object is freed.
      (cherry picked from commit 45edefc7)
      2fd84d39
    • D
      Fix typo s/AM_CLFAGS/AM_CFLAGS/ in sanlock link · 69cba17c
      Daniel P. Berrange 提交于
      (cherry picked from commit 7de158cf)
      69cba17c
    • P
      virsh: console: Avoid using stream after being freed. · c02482bd
      Peter Krempa 提交于
      The stream object wasn't set to NULL after freeing causing a double free
      attempt on the cleanup path.
      (cherry picked from commit e3b8808b)
      c02482bd
    • M
      qemu: syntax fix · 20d78169
      Marc-André Lureau 提交于
      Pushed without ack, under the trivial rule.
      (cherry picked from commit 2beed2da)
      20d78169
    • E
      qemu: fix use after free · 9649b0a8
      Eric Blake 提交于
      Detected by Coverity.
      
      * src/qemu/qemu_hotplug.c (qemuDomainAttachHostDevice): Avoid
      double free of usb on failure.
      (cherry picked from commit 665c8cde)
      9649b0a8
    • P
      conf: Remove callback from stream when freeing entries in console hash · 819df255
      Peter Krempa 提交于
      When a domain has a active console connection and is destroyed the
      callback is called on private data that no longer exist causing a
      segfault.
      (cherry picked from commit ba226d33)
      819df255
    • J
      security: Skip labeling resources when seclabel defaults to none · 3883ef03
      Jiri Denemark 提交于
      If a domain is explicitly configured with <seclabel type="none"/> we
      correctly ensure that no labeling will be done by setting
      norelabel=true. However, if no seclabel element is present in domain XML
      and hypervisor is configured not to confine domains by default, we only
      set type to "none" without turning off relabeling. Thus if such a domain
      is being started, security driver wants to relabel resources with
      default label, which doesn't make any sense.
      
      Moreover, with SELinux security driver, the generated image label lacks
      "s0" sensitivity, which causes setfilecon() fail with EINVAL in
      enforcing mode.
      (cherry picked from commit ce53382b)
      3883ef03
    • M
      fixed SegFault in virauth · b9964013
      Martin Kletzander 提交于
      No check for conn->uri being NULL in virAuthGetConfigFilePath (valid
      state) made the client segfault. This happens for example with these
      settings:
       - no virtualbox driver installed (modifies conn->uri)
       - no default URI set (VIRSH_DEFAULT_CONNECT_URI="",
         LIBVIRT_DEFAULT_URI="", uri_default="")
       - auth_sock_rw="sasl"
       - virsh run as root
      
      That are unfortunately the settings with fresh Fedora 17 installation
      with VDSM.
      
      The check ought to be enough as conn->uri being NULL is valid in later
      code and is handled properly.
      (cherry picked from commit 5eef7432)
      b9964013
    • R
      adding handling EINTR to poll to make it more robust · 9a7bbc24
      Royce Lv 提交于
      some system call and signal will interrupt poll,
      making event loop stops and fails to react events and keepalive message
      from libvirt.
      adding handling EINTR to poll to make it more robust
      Signed-off-by: NRoyce Lv <lvroyce@linux.vnet.ibm.com>
      (cherry picked from commit 5e62ba34)
      9a7bbc24
    • D
      doc: Fix time keeping example for the guest clock · d13b354b
      Doug Goldstein 提交于
      The time keeping example was missing quotes which resulted in an error
      if you copied and pasted the example into a domain's XML. Additionally
      the rest of the examples use single quotes (') instead of double quotes
      (") so standardized that.
      (cherry picked from commit d57e17d5)
      d13b354b
    • D
      Fix test failure when no IPv6 is avail · eddceda2
      Doug Goldstein 提交于
      When the system doesn't have IPv6 available (e.g. not built into the
      kernel or the module isn't loaded), you can not create an IPv6 socket.
      The test determines earlier on that IPv6 isn't available then goes and
      creates a socket. This makes socket creation conditional on IPv6
      availability.
      (cherry picked from commit faffe269)
      eddceda2
    • D
      Ensure failure to talk to Xen hypervisor is fatal when privileged · c27523e6
      Daniel P. Berrange 提交于
      As per the comment, the Xen hypervisor driver is considered to
      be mandatory when running privileged. When it fails to open,
      we should thus return an error, not ignore it.
      (cherry picked from commit 489900e3)
      c27523e6
    • D
      Don't autostart domains when reloading config · f81800cf
      Daniel P. Berrange 提交于
      When sending SIGHUP to libvirtd, it will trigger the virStateDriver
      reload operation. This is intended to reload the configuration files
      for guests. For unknown historical reasons this is also triggering
      autostart of all guests. Autostart is generally expected to be
      something that happens on OS startup. Starting VMs on SIGHUP will
      violate that expectation and potentially cause dangerous scenarios
      if the admin has explicitly shutdown a misbehaving VM that has
      been marked as autostart
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      (cherry picked from commit 95c2c19f)
      f81800cf
    • E
      build: fix compilation without struct ifreq · d4ffc36f
      Eric Blake 提交于
      Detected on Cygwin.  Broken in commit 387117ad.
      
      * src/util/virnetdev.c (virNetDevValidateConfig)
      (virNetDevReplaceNetConfig): Fix prototypes.
      * src/util/virnetlink.c (virNetlinkEventAddClient)
      (virNetlinkEventRemoveClient): Likewise.
      (cherry picked from commit 68a97bd8)
      d4ffc36f
    • J
      remote: Fix locking in stream APIs · 40b01761
      Jiri Denemark 提交于
      Remote driver needs to make sure the driver lock is released before
      entering client IO loop as that may block indefinitely in poll(). As a
      direct consequence of not following this in stream APIs, tunneled
      migration to a destination host which becomes non-responding may block
      qemu driver. Luckily, if keepalive is turned for p2p migrations, both
      remote and qemu drivers will get automagically unblocked after keepalive
      timeout.
      (cherry picked from commit 17f3be07)
      40b01761
    • J
      qemu: Do not fail virConnectCompareCPU if host CPU is not known · cba63bbc
      Jiri Denemark 提交于
      When host CPU could not be properly detected, virConnectCompareCPU will
      just report that any CPU is incompatible with host CPU instead of
      failing.
      (cherry picked from commit 87c86231)
      cba63bbc
    • J
      Clarify direct migration · a69e4681
      Jiri Denemark 提交于
      When --direct is used when migrating a domain running on a hypervisor
      that does not support direct migration (such as QEMU), the caller would
      get the following error message:
      
          this function is not supported by the connection driver:
          virDomainMigrateToURI2
      
      which is a complete nonsense since qemu driver implements
      virDomainMigrateToURI2. This patch would emit a more sensible error in
      this case:
      
          Requested operation is not valid: direct migration is not supported
          by the connection driver
      (cherry picked from commit 3189dfb1)
      a69e4681
    • C
      Fix daemon auto-spawning · cf640bdf
      Christophe Fergeau 提交于
      Commit 32a9aac2 switched libvirt to use the XDG base directories
      to locate most of its data/config. In particular, the per-user socket
      for qemu:///session is now stored in the XDG runtime directory.
      This directory is located by looking at the XDG_RUNTIME_DIR environment
      variable, with a fallback to ~/.cache/libvirt if this variable is not
      set.
      
      When the daemon is autospawned because a client application wants
      to use qemu:///session, the daemon is ran in a clean environment
      which does not contain XDG_RUNTIME_DIR. It will create its socket
      in ~/.cache/libvirt. If the client application has XDG_RUNTIME_DIR
      set, it will not look for the socket in the fallback place, and will
      fail to connect to the autospawned daemon.
      
      This patch adds XDG_RUNTIME_DIR to the daemon environment before
      auto-starting it. I've done this in virNetSocketForkDaemon rather
      than in virCommandAddEnvPassCommon as I wasn't sure we want to pass
      these variables to other commands libvirt spawns. XDG_CACHE_HOME
      and XDG_CONFIG_HOME are also added to the daemon env as it makes use
      of those as well.
      (cherry picked from commit efe6c802)
      cf640bdf