1. 20 5月, 2013 1 次提交
  2. 18 5月, 2013 1 次提交
    • E
      tests: use portable shell code · 6a7ae990
      Eric Blake 提交于
      'make check' fails since commit 470d5c46 on any system with dash
      as /bin/sh, because '<<<' is a bash extension.  For example:
      
      nwfilterschematest: 23: /home/eblake/libvirt/tests/schematestutils.sh: Syntax error: redirection unexpected
      
      Also, there is no need to spawn a grep process when shell globbing
      can do the same.
      
      * tests/schematestutils.sh: Replace bashism and subprocess with a
      faster and portable construct.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      (cherry picked from commit 1d21b884)
      6a7ae990
  3. 17 5月, 2013 1 次提交
  4. 16 5月, 2013 1 次提交
    • J
      daemon: fix leak after listing all volumes · 71e7f139
      Ján Tomko 提交于
      CVE-2013-1962
      
      remoteDispatchStoragePoolListAllVolumes wasn't freeing the pool.
      The pool also held a reference to the connection, preventing it from
      getting freed and closing the netcf interface driver, which held two
      sockets open.
      (cherry picked from commit ca697e90)
      71e7f139
  5. 15 5月, 2013 1 次提交
  6. 11 5月, 2013 1 次提交
    • L
      util: fix virFileOpenAs return value and resulting error logs · ce902dca
      Laine Stump 提交于
      This resolves:
      
           https://bugzilla.redhat.com/show_bug.cgi?id=851411
           https://bugzilla.redhat.com/show_bug.cgi?id=955500
      
      The first problem was that virFileOpenAs was returning fd (-1) in one
      of the error cases rather than ret (-errno), so the caller thought
      that the error was EPERM rather than ENOENT.
      
      The second problem was that some log messages in the general purpose
      qemuOpenFile() function would always say "Failed to create" even if
      the caller hadn't included O_CREAT (i.e. they were trying to open an
      existing file).
      
      This fixes virFileOpenAs to jump down to the error return (which
      returns ret instead of fd) in the previously mentioned incorrect
      failure case of virFileOpenAs(), removes all error logging from
      virFileOpenAs() (since the callers report it), and modifies
      qemuOpenFile to appropriately use "open" or "create" in its log
      messages.
      
      NB: I seriously considered removing logging from all callers of
      virFileOpenAs(), but there is at least one case where the caller
      doesn't want virFileOpenAs() to log any errors, because it's just
      going to try again (qemuOpenFile()). We can't simply make a silent
      variation of virFileOpenAs() though, because qemuOpenFile() can't make
      the decision about whether or not it wants to retry until after
      virFileOpenAs() has already returned an error code.
      
      Likewise, I also considered changing virFileOpenAs() to return -1 with
      errno set on return, and may still do that, but only as a separate
      patch, as it obscures the intent of this patch too much.
      (cherry picked from commit a2c1bedb)
      ce902dca
  7. 09 5月, 2013 4 次提交
  8. 08 5月, 2013 1 次提交
    • L
      qemu: allocate network connections sooner during domain startup · 6597cc25
      Laine Stump 提交于
      VFIO device assignment requires a cgroup ACL to be setup for access to
      the /dev/vfio/nn "group" device for any devices that will be assigned
      to a guest. In the case of a host device that is allocated from a
      pool, it was being allocated during qemuBuildCommandLine(), which is
      called by qemuProcessStart() *after* the all-encompassing
      qemuSetupCgroup() was called, meaning that the standard Cgroup ACL
      setup wasn't creating ACLs for these devices allocated from pools.
      
      One possible solution was to manually add a single ACL down inside
      qemuBuildCommandLine() when networkAllocateActualDevice() is called,
      but that has two problems: 1) the function that adds the cgroup ACL
      requires a virDomainObjPtr, which isn't available in
      qemuBuildCommandLine(), and 2) we really shouldn't be doing network
      device setup inside qemuBuildCommandLine() anyway.
      
      Instead, I've created a new function called
      qemuNetworkPrepareDevices() which is called just before
      qemuPrepareHostDevices() during qemuProcessStart() (explanation of
      ordering in the comments), i.e. well before the call to
      qemuSetupCgroup(). To minimize code churn in a patch that will be
      backported to 1.0.5-maint, qemuNetworkPrepareDevices only does
      networkAllocateActualDevice() and the bare amount of setup required
      for type='hostdev network devices, but it eventually should do *all*
      device setup for guest network devices.
      
      Note that some of the code that was previously needed in
      qemuBuildCommandLine() is no longer required when
      networkAllocateActualDevice() is called earlier:
      
       * qemuAssignDeviceHostdevAlias() is already done further down in
         qemuProcessStart().
      
       * qemuPrepareHostdevPCIDevices() is called by
         qemuPrepareHostDevices() which is called after
         qemuNetworkPrepareDevices() in qemuProcessStart().
      
      As hinted above, this new function should be moved into a separate
      qemu_network.c (or similarly named) file along with
      qemuPhysIfaceConnect(), qemuNetworkIfaceConnect(), and
      qemuOpenVhostNet(), and expanded to call those functions as well, then
      the nnets loop in qemuBuildCommandLine() should be reduced to only
      build the commandline string (which itself can be in a separate
      qemuInterfaceBuilldCommandLine() function as suggested by
      Michal). However, this will require storing away an array of tapfd and
      vhostfd that are needed for the commandline, so I would rather do that
      in a separate patch and leave this patch at the minimum to fix the
      bug.
      (cherry picked from commit 8cd40e7e)
      6597cc25
  9. 07 5月, 2013 10 次提交
    • G
      Make detect_scsi_host_caps a function on all architectures · 3b8f6e5f
      Guido Günther 提交于
      In the non linux case some callers like gather_scsi_host_caps needed the
      return code of -1 while others like update_caps needed an empty
      statement (to avoid a "statement without effect" warning). This is much
      simpler solved by using a function instead of a define.
      (cherry picked from commit 58662f44)
      3b8f6e5f
    • G
      Fixup rpcgen code on kFreeBSD too · 4a4d2300
      Guido Günther 提交于
      since it uses glibc's rpcgen.
      (cherry picked from commit b562d7b7)
      4a4d2300
    • D
      Fix release of resources with lockd plugin · 14ba72b6
      Daniel P. Berrange 提交于
      The lockd plugin for the lock manager was not correctly
      handling the release of resource locks. This meant that
      during migration, or when pausing a VM, the locks would
      not get released. This in turn made it impossible to
      resume the domain, or finish migration
      (cherry picked from commit 8dc93ffa)
      14ba72b6
    • E
      build: avoid non-portable cast of pthread_t · fc8a2310
      Eric Blake 提交于
      POSIX says pthread_t is opaque.  We can't guarantee if it is scaler
      or a pointer, nor what size it is; and BSD differs from Linux.
      We've also had reports of gcc complaining on attempts to cast it,
      if we use a cast to the wrong type (for example, pointers have to be
      cast to void* or intptr_t before being narrowed; while casting a
      function return of scalar pthread_t to void* triggers a different
      warning).
      
      Give up on casts, and use unions to get at decent bits instead.  And
      rather than futz around with figuring which 32 bits of a potentially
      64-bit pointer are most likely to be unique, convert the rest of
      the code base to use 64-bit values when using a debug id.
      
      Based on a report by Guido Günther against kFreeBSD, but with a
      fix that doesn't regress commit 4d970fd2 for FreeBSD.
      
      * src/util/virthreadpthread.c (virThreadSelfID, virThreadID): Use
      union to get at a decent bit representation of thread_t bits.
      * src/util/virthread.h (virThreadSelfID, virThreadID): Alter
      signature.
      * src/util/virthreadwin32.c (virThreadSelfID, virThreadID):
      Likewise.
      * src/qemu/qemu_domain.h (qemuDomainJobObj): Alter type of owner.
      * src/qemu/qemu_domain.c (qemuDomainObjTransferJob)
      (qemuDomainObjSetJobPhase, qemuDomainObjReleaseAsyncJob)
      (qemuDomainObjBeginNestedJob, qemuDomainObjBeginJobInternal): Fix
      clients.
      * src/util/virlog.c (virLogFormatString): Likewise.
      * src/util/vireventpoll.c (virEventPollInterruptLocked):
      Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      (cherry picked from commit 22d12905)
      fc8a2310
    • D
      Fix potential use of undefined variable in remote dispatch code · 832049ca
      Daniel P. Berrange 提交于
      If an early dispatch check caused a jump to the 'cleanup' branch
      then virTypeParamsFree() would be called with an uninitialized
      'nparams' variable. Fortunately 'params' is initialized to NULL,
      so the uninitialized 'nparams' variable would not be used.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      (cherry picked from commit 31dbbb66)
      832049ca
    • E
      build: fix mingw build of virprocess.c · 6381c1c1
      Eric Blake 提交于
      Commit 776d49f4 added a static function that is only called
      conditionally; leading to this compile error on mingw:
      
        CC       libvirt_util_la-virprocess.lo
      ../../src/util/virprocess.c:624:26: error: 'struct rlimit' declared inside parameter list [-Werror]
      ../../src/util/virprocess.c:624:26: error: its scope is only this definition or declaration, which is probably not what you want [-Werror]
      ../../src/util/virprocess.c:622:1: error: 'virProcessPrLimit' defined but not used [-Werror=unused-function]
      
      * src/util/virprocess.c (virProcessPrLimit): Only declare
      virProcessPrLimit when used.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      (cherry picked from commit 05f79a38)
      6381c1c1
    • D
      Fix F_DUPFD_CLOEXEC operation args · 3b9243e0
      Daniel P. Berrange 提交于
      The F_DUPFD_CLOEXEC operation with fcntl() expects a single
      int argument, specifying the minimum FD number for the newly
      dup'd file descriptor. We were not specifying that causing
      random stack data to be accessed as the FD number. Sometimes
      that worked, sometimes it didn't.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      (cherry picked from commit d6670a64)
      3b9243e0
    • E
      spec: proper soft static allocation of qemu uid · fa8692cd
      Eric Blake 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=924501 tracks a
      problem that occurs if uid 107 is already in use at the time
      libvirt is first installed.  In response that problem, Fedora
      packaging guidelines were recently updated.  This fixes the
      spec file to comply with the new guidelines:
      https://fedoraproject.org/wiki/Packaging:UsersAndGroups
      
      * libvirt.spec.in (daemon): Follow updated Fedora guidelines.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      (cherry picked from commit a2584d58)
      fa8692cd
    • E
      build: clean up stray files found by 'make distcheck' · c0431c10
      Eric Blake 提交于
      'make distcheck' complained:
      
      ERROR: files left in build directory after distclean:
      ./python/libvirt.pyc
      ./tests/commandhelper.log
      
      Problems introduced in commits f0154959 and 25ea8e47 (both v1.0.3).
      
      * tests/commandtest.c (test21): Check (and clean) log file.
      * tests/commanddata/test21.log: New file.
      * python/Makefile.am (CLEANFILES): Clean up compiled python files.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      (cherry picked from commit c21c38d7)
      c0431c10
    • E
      build: always include libvirt_lxc.syms in tarball · 343ab629
      Eric Blake 提交于
      On a mingw build, 'make distcheck' fails with:
      
        GEN      libvirt_qemu.def
      make[3]: *** No rule to make target `../../src/libvirt_lxc.syms', needed by `libvirt_lxc.def'.  Stop.
      
      I traced it to a missing entry in EXTRA_DIST.  But rather than keep
      the entire list in sync, it is easier to list the three syms files
      that drive .so files directly, and then reuse existing makefile
      variables for the remaining files (that is, I validated that all
      remaining files are added to SYM_FILES, possibly via USED_SYM_FILES,
      according to makefile conditionals).
      
      Problem introduced in commit 3d1596b0 (v1.0.2).
      
      * src/Makefile.am (EXTRA_DIST): Ensure all syms files are shipped.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      (cherry picked from commit ed11ab93)
      343ab629
  10. 04 5月, 2013 1 次提交
  11. 03 5月, 2013 4 次提交
    • E
      build: always include sanitytest in tarball · 3e7adcf6
      Eric Blake 提交于
      The libvirt 1.0.5 tarball is missing a file which renders 'make
      check' broken; first reported on list by Guido Günther.
      
      * python/Makefile.am (EXTRA_DIST): Hoist sanitytest.py out of
      HAVE_PYTHON conditional.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      (cherry picked from commit 5a3487da)
      3e7adcf6
    • G
      virInitctlRequest: unbreak make syntax check · 2b9bf71b
      Guido Günther 提交于
      introduced by dcf97846
      
      To trigger this cppi needs to be installed.
      (cherry picked from commit ca75c443)
      2b9bf71b
    • G
      virInitctlRequest: unbreak make syntax check · c2de882f
      Guido Günther 提交于
      introduced by dcf97846
      (cherry picked from commit a1365d73)
      c2de882f
    • L
      network: fix network driver startup for qemu:///session · d2686140
      Laine Stump 提交于
      This should resolve https://bugzilla.redhat.com/show_bug.cgi?id=958907
      
      Recent new addition of code to read/write active network state to the
      NETWORK_STATE_DIR in the network driver broke startup for
      qemu:///session. The network driver had several state file paths
      hardcoded to /var, which could never possibly work in session mode.
      
      This patch modifies *all* state files to use a variable string that is
      set differently according to whether or not we're running
      privileged. (It turns out that logDir was never used, so it's been
      completely eliminated.)
      
      There are very definitely other problems preventing dnsmasq and radvd
      from running in non-privileged mode, but it's more consistent to have
      the directories used by them be determined in the same fashion.
      
      NB: I've noted before that the network driver is storing its state
      (including dnsmasq and radvd state) in /var/lib, while qemu stores its
      state in /var/run. It would probably have been better if the two
      matched, but it's been this way for a long time, and changing it would
      break running installations during an upgrade, so it's best to just
      leave it as it is.
      (cherry picked from commit 2ffd87d8)
      
      Conflicts:
      	src/network/bridge_driver.c - code removed by this patch had
                                            been modified upstream.
      d2686140
  12. 02 5月, 2013 5 次提交
    • D
      Release of libvirt-1.0.5 · 8e20a23f
      Daniel Veillard 提交于
      * configure.ac docs/news.html.in libvirt.spec.in: updated for the release
      * po/*.po*: pulled and merged a number of new localization updates
      8e20a23f
    • G
      virInitctlRequest: Don't hardcode 384 bytes size · dcf97846
      Guido Günther 提交于
      When MAXHOSTNAMELEN is set we have to take it's value into account.
      Otherwise the build fails on kFreeBSD (FreeBSD kernel and GNU userland)
      dcf97846
    • L
      pci: autolearn name of stub driver, remove from arglist · e482693b
      Laine Stump 提交于
      virPCIDeviceReattach and virPCIDeviceUnbindFromStub (called by
      virPCIDeviceReattach) had previously required the name of the stub
      driver as input. This is unnecessary, because the name of the driver
      the device is currently bound to can be found by looking at the link:
      
        /sys/bus/pci/dddd:bb:ss.ff/driver
      
      Instead of requiring that the name of the expected stub driver name
      and only unbinding if that one name is matched, we no longer take a
      driver name in the arglist for either of these
      functions. virPCIDeviceUnbindFromStub just compares the name of the
      currently bound driver to a list of "well known" stubs (right now
      contains "pci-stub" and "vfio-pci" for qemu, and "pciback" for xen),
      and only performs the unbind if it's one of those devices.
      
      This allows virsh nodedevice-reattach to work properly across a
      libvirtd restart, and fixes a couple of cases where we were
      erroneously still hard-coding "pci-stub" as the drive name.
      
      For some unknown reason, virPCIDeviceReattach had been calling
      modprobe on the stub driver prior to unbinding the device. This was
      problematic because we no longer know the name of the stub driver in
      that function. However, it is pointless to probe for the stub driver
      at that time anyway - because the device is bound to the stub driver,
      we are guaranteed that it is already loaded, and so that call to
      modprobe has been removed.
      e482693b
    • E
      spec: collect all BuildRequires into one area · e2472e69
      Eric Blake 提交于
      Conditional BuildRequires: should be at the top level, rather
      than appearing in conditional sub-package sections.  This
      appears to be the only offender.
      
      * libvirt.spec.in (BuildRequires): Move libblkid-devel into
      correct area.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      e2472e69
    • C
      docs: Fix closing tag in snapshot documentation · 364554a0
      Christophe Fergeau 提交于
      Commit cc6d19f3 added text containing "<code>snapshot<code>" to
      formatsnapshot.html.in. The closing tag is missing '/' which causes
      the documentation to misrender.
      364554a0
  13. 01 5月, 2013 8 次提交
    • A
      ESX: Fix DISPATCH_FREE generation code to free all extended objects · 4e650435
      Ata E Husain Bohra 提交于
      Python code generator "generate_source" section that handles
      code generation to "free" inherited objects needs to generate
      DISPATCH_FREE calls for all extended_by objects.
      4e650435
    • V
      S390: Do not generate a default USB controller · 3a82f628
      Viktor Mihajlovski 提交于
      For s390 we don't want to have a default USB device generated even
      if QEMU is silently tolerating -usb on the command line. This may change
      in the future.
      Another reason to avoid the USB controller is that it implies a PCI
      bus which might cause a regression at some later point in time.
      The following change will set the USB controller model to 'none'
      unless a model or address has been specified, which can be the case
      if a legacy definition is loaded or the XML writer knows what
      she/he's doing.
      Requiring the user to explicitly disable USB on systems not supporting
      it seems cumbersome.
      Signed-off-by: NViktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
      3a82f628
    • V
      S390: Mention changed USB behavior · 3e82b5cc
      Viktor Mihajlovski 提交于
      Add a line saying that no USB controllers are generated by default
      on s390.
      3e82b5cc
    • L
      qemu: fix failure to start with spice graphics and no tls · f6966b62
      Laine Stump 提交于
      Commit eca3fdf7 inadvertantly caused a failure to start for any domain
      with the following in its config:
      
          <graphics type='spice' autoport='yes'/>
      
      The problem is that when tlsPort == 0 and defaultMode == "any" (which
      is the default for defaultMode), this would be flagged in the code as
      "needTLSPort", and if there was then no spice tls config, the new
      error+fail would happen.
      
      This patch checks for the case of defaultMode == "any", and in that
      case simply doesn't allocate a TLS port (since that's probably not
      what the user wanted, and it would have failed later anyway.). It does
      leave the error in place for cases when the user specifically asked to
      use tls in one way or another, though.
      f6966b62
    • E
      build: fix cygwin build in virnetdev · 7fecc8e3
      Eric Blake 提交于
      On cygwin, compilation failed because SIOCSIFHWADDR is undefined.
      
      * src/util/virnetdev.c (virNetDevSetMAC): Cygwin can query but not
      set mac address.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      7fecc8e3
    • J
      Need to call virFreeError after virSaveLastError · c0b86c8c
      John Ferlan 提交于
      c0b86c8c
    • J
      Resolve valgrind error · d0761c18
      John Ferlan 提交于
      As a result of commit id '19c345f2', 'make -C tests valgrind' has the
      following for qemuxml2argvtest:
      
      ==22482== 197 (80 direct, 117 indirect) bytes in 1 blocks are definitely lost in loss record 101 of 120
      ==22482==    at 0x4A06B6F: calloc (vg_replace_malloc.c:593)
      ==22482==    by 0x4C6F301: virAlloc (viralloc.c:124)
      ==22482==    by 0x4C840FC: virSaveLastError (virerror.c:308)
      ==22482==    by 0x431882: qemuBuildCommandLine (qemu_command.c:8204)
      ==22482==    by 0x41E8F0: testCompareXMLToArgvHelper (qemuxml2argvtest.c:155)
      ==22482==    by 0x41FE9F: virtTestRun (testutils.c:157)
      ==22482==    by 0x419DEB: mymain (qemuxml2argvtest.c:654)
      ==22482==    by 0x4204DA: virtTestMain (testutils.c:719)
      ==22482==    by 0x39D0821A04: (below main) (libc-start.c:225)
      ==22482==
      d0761c18
    • J
      libvirt-guests: status: return non-zero when stopped · 9c51de2b
      Ján Tomko 提交于
      Return 3 when the service is stopped, whether there
      are saved guests or not, to conform with the LSB standards:
      
      http://refspecs.linuxbase.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/iniscrptact.html
      9c51de2b
  14. 30 4月, 2013 1 次提交
    • R
      portability: handle ifreq differences in virnetdev · 5295e35f
      Roman Bogorodskiy 提交于
      FreeBSD (and maybe other BSDs) have different member
      names in struct ifreq when compared to Linux, such as:
      
       - uses ifr_data instead of ifr_newname for setting
         interface names
       - uses ifr_index instead of ifr_ifindex for interface
         index
      
      Also, add a check for SIOCGIFHWADDR for virNetDevValidateConfig().
      
      Use AF_LOCAL if AF_PACKET is not available.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      5295e35f