1. 15 6月, 2012 40 次提交
    • G
      Only check for cluster fs if we're using a filesystem · 95ae1a06
      Guido Günther 提交于
      otherwise migration fails for e.g. network filesystems like sheepdog
      with:
      
         error: Invalid relative path 'virt-name': Invalid argument
      
      while we should fail with:
      
          Migration may lead to data corruption if disks use cache != none
      
      References:
      
          http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=676328
          https://www.redhat.com/archives/libvirt-users/2012-May/msg00088.html
      (cherry picked from commit 3ac8fb54)
      95ae1a06
    • C
      Fix missing ) in 2 strings · 84daddb0
      Cole Robinson 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=801656
      (cherry picked from commit 9ec6f818)
      84daddb0
    • L
      Assign correct address type to spapr-vlan and spapr-vty. · 5840d413
      Li Zhang 提交于
      For pseries guest, spapr-vlan and spapr-vty is based
      on spapr-vio address. According to model of network
      device, the address type should be assigned automatically.
      For serial device, serial pty device is recognized as
      spapr-vty device, which is also on spapr-vio.
      
      So this patch is to correct the address type of
      spapr-vlan and spapr-vty, and build correct
      command line of spapr-vty.
      Signed-off-by: NLi Zhang <zhlcindy@linux.vnet.ibm.com>
      Reviewed-by:   Michael Ellerman<michaele@au1.ibm.com>
      (cherry picked from commit 04a319ba)
      5840d413
    • E
      maint: make it easier to copy FORTIFY_SOURCE snippet · 29263ec2
      Eric Blake 提交于
      While libvirt intentionally avoids -Wundef (after all, C99
      guarantees sane semantics of treating undefined macros as 0),
      the glibc insanity of #warning on _FORTIFY_SOURCE coupled with
      what some people feel is the black magic of autoconf means
      that other projects are likely to copy our snippet verbatim.
      We can be nicer to other projects by making it easier to
      integrate into projects that use -Wundef.
      
      Suggested by Christophe Fergeau.
      
      * m4/virt-compile-warnings.m4 (LIBVIRT_COMPILE_WARNINGS): Be nice
      to other projects using -Wundef.
      (cherry picked from commit 1c2edf0f)
      29263ec2
    • E
      command: avoid potential deadlock on handshake · 55157abb
      Eric Blake 提交于
      There is a theoretical problem of an extreme bug where we can get
      into deadlock due to command handshaking.  Thanks to a pair of pipes,
      we have a situation where the parent thinks the child reported an
      error and is waiting for a message from the child to explain the
      error; but at the same time the child thinks it reported success
      and is waiting for the parent to acknowledge the success; so both
      processes are now blocked.
      
      Thankfully, I don't think this deadlock is possible without at
      least one other bug in the code, but I did see exactly that sort
      of situation prior to commit da831afc - I saw a backtrace where a
      double close bug in the parent caused the parent to read from the
      wrong fd and assume the child failed, even though the child really
      sent success.
      
      This potential deadlock is not quite like commit 858c2476 (a deadlock
      due to multiple readers on one pipe preventing a write from completing),
      although the solution is similar - always close unused pipe fds before
      blocking, rather than after.
      
      * src/util/command.c (virCommandHandshakeWait): Close unused fds
      sooner.
      (cherry picked from commit 5e8ab391)
      55157abb
    • C
      spec: Build against systemd for udev · c7bd2b05
      Cole Robinson 提交于
      They have now merged. Fedora details here:
      
      https://lists.fedoraproject.org/pipermail/devel/2012-June/168227.html
      (cherry picked from commit dd7bc51b)
      
      Conflicts:
      
      	libvirt.spec.in
      c7bd2b05
    • O
      virsh: Back out if the argument for vol-create-as is malformed · 4b5a7930
      Osier Yang 提交于
      (cherry picked from commit ee58b581)
      
      Conflicts:
      
      	tools/virsh.c
      4b5a7930
    • O
      virsh: Accept UUID as an argument for net-info and net-start · 9274256d
      Osier Yang 提交于
      (cherry picked from commit 68fcfdb8)
      9274256d
    • O
      virsh: Accept UUID as an argument for storage commands · 65a405dd
      Osier Yang 提交于
      Affected commands are: pool-start, vol-create-from.
      (cherry picked from commit 05f8917f)
      65a405dd
    • B
      Fix for parallel port passthrough for QEMU · b24a9f3e
      Beat Jörg 提交于
      I came across a bug that the command line generated for passthrough
      of the host parallel port /dev/parport0 by libvirt for QEMU is incorrect.
      
      It currently produces:
      -chardev tty,id=charparallel0,path=/dev/parport0
      -device isa-parallel,chardev=charparallel0,id=parallel0
      
      The first parameter is "tty". It sould be "parport".
      
      If I launch qemu with -chardev parport,... it works as expected.
      
      I have already filled a bug report (
      https://bugzilla.redhat.com/show_bug.cgi?id=823879 ), the topic was
      already on the list some months ago:
      
      https://www.redhat.com/archives/libvirt-users/2011-September/msg00095.htmlSigned-off-by: NEric Blake <eblake@redhat.com>
      (cherry picked from commit 7508338f)
      b24a9f3e
    • E
      maint: command.c whitespace cleanups · 33ada8f1
      Eric Blake 提交于
      Noticed during the previous commit.
      
      * src/util/command.c: Fix some spacing and break long lines.
      (cherry picked from commit a3bc393e)
      33ada8f1
    • E
      command: avoid deadlock on EPIPE situation · 07fdce4f
      Eric Blake 提交于
      It is possible to deadlock libvirt by having a domain with XML
      longer than PIPE_BUF, and by writing a hook script that closes
      stdin early.  This is because libvirt was keeping a copy of the
      child's stdin read fd open, which means the write fd in the
      parent will never see EPIPE (remember, libvirt should always be
      run with SIGPIPE ignored, so we should never get a SIGPIPE signal).
      Since there is no error, libvirt blocks waiting for a write to
      complete, even though the only reader is also libvirt.  The
      solution is to ensure that only the child can act as a reader
      before the parent does any writes; and then dealing with the
      fallout of dealing with EPIPE.
      
      Thankfully, this is not a security hole - since the only way to
      trigger the deadlock is to install a custom hook script, anyone
      that already has privileges to install a hook script already has
      privileges to do any number of other equally disruptive things
      to libvirt; it would only be a security hole if an unprivileged
      user could install a hook script to DoS a privileged user.
      
      * src/util/command.c (virCommandRun): Close parent's copy of child
      read fd earlier.
      (virCommandProcessIO): Don't let EPIPE be fatal; the child may
      be done parsing input.
      * tests/commandhelper.c (main): Set up a SIGPIPE situation.
      * tests/commandtest.c (test20): Trigger it.
      * tests/commanddata/test20.log: New file.
      (cherry picked from commit 858c2476)
      07fdce4f
    • E
      build: allow building with newer glibc-headers and -O0 · f6e7865d
      Eric Blake 提交于
      glibc 2.15 (on Fedora 17) coupled with explicit disabling of
      optimization during development dies a painful death:
      
      In file included from /usr/include/limits.h:27:0,
                       from /usr/lib/gcc/x86_64-redhat-linux/4.7.0/include/limits.h:169,
                       from /usr/lib/gcc/x86_64-redhat-linux/4.7.0/include/syslimits.h:7,
                       from /usr/lib/gcc/x86_64-redhat-linux/4.7.0/include/limits.h:34,
                       from util/bitmap.c:26:
      /usr/include/features.h:314:4: error: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Werror=cpp]
      cc1: all warnings being treated as errors
      
      Work around this by only conditionally defining _FORTIFY_SOURCE,
      in the case where glibc can actually use it.  The trick is using
      AH_VERBATIM instead of AC_DEFINE.
      
      * m4/virt-compile-warnings.m4 (LIBVIRT_COMPILE_WARNINGS): Squelch
      _FORTIFY_SOURCE when needed to avoid glibc #warnings.
      (cherry picked from commit 2af63b1c)
      f6e7865d
    • J
      command: Fix debug message during handshake · 2a75b756
      Jiri Denemark 提交于
      Probably a result of copy&paste...
      (cherry picked from commit 461ed421)
      2a75b756
    • R
      Fix sync issue in virNetClientStreamEventRemoveCallback · 25a35c9c
      Radu Caragea 提交于
      The stream lock is unlocked twice instead of being locked and then
      unlocked. Probably a typo.
      (cherry picked from commit 107f51b6)
      
      Conflicts:
      
      	AUTHORS
      25a35c9c
    • L
      qemu: fix netdev alias name assignment wrt type='hostdev' · 5b3c3560
      Laine Stump 提交于
      This patch resolves:
      
         https://bugzilla.redhat.com/show_bug.cgi?id=827519
      
      The problem is that an interface with type='hostdev' will have an
      alias of the form "hostdev%d", while the function that looks through
      existing netdevs to determine the name to use for a new addition will
      fail if there's an existing entry that does not match the form
      "net%d".
      
      This is another of the handful of places that need an exception due to
      the hybrid nature of <interface type='hostdev'> (which is not exactly
      an <interface> or a <hostdev>, but is both at the same time).
      (cherry picked from commit 6734ce7b)
      5b3c3560
    • M
      tools: make virt-pki-validate work with acls and xattrs · 114b726f
      Martin Kletzander 提交于
      This patch makes virt-pki-validate work with certificates that have
      acl or xattr set. Otherwise it failing due to wrong permissions.
      (cherry picked from commit d4fb6694)
      114b726f
    • W
      qemu: avoid closing fd more than once · 4e1e20c3
      Wen Congyang 提交于
      If we migrate to fd, spec->fwdType is not MIGRATION_FWD_DIRECT,
      we will close spec->dest.fd.local in qemuMigrationRun(). So we
      should set spec->dest.fd.local to -1 in qemuMigrationRun().
      
      Bug present since 0.9.5 (commit 32617617).
      (cherry picked from commit b19c236d)
      4e1e20c3
    • W
      command: check for fork error before closing fd · b5df0ffe
      Wen Congyang 提交于
      We should not set *outfd or *errfd if virExecWithHook() failed
      because the caller may close these fds.
      
      Bug present since v0.4.5 (commit 60ed1d2a).
      (cherry picked from commit 746ff701)
      b5df0ffe
    • E
      fdstream: avoid double close bug · bd670db3
      Eric Blake 提交于
      Wen Congyang reported that we have a double-close bug if we fail
      virFDStreamOpenInternal, since childfd duplicated one of the fds[]
      array contents.  In truth, since we always transfer both members
      of fds to other variables, we should close the fds through those
      other names, and just use fds[] for pipe().
      
      Bug present since 0.9.0 (commit e886237a).
      
      * src/fdstream.c (virFDStreamOpenFileInternal): Swap scope of
      childfd and fds[], to avoid a double close.
      (cherry picked from commit f3cfc7c8)
      bd670db3
    • E
      command: avoid double close bugs · 1ae26045
      Eric Blake 提交于
      KAMEZAWA Hiroyuki reported a nasty double-free bug when virCommand
      is used to convert a string into input to a child command.  The
      problem is that the poll() loop of virCommandProcessIO would close()
      the write end of the pipe in order to let the child see EOF, then
      the caller virCommandRun() would also close the same fd number, with
      the second close possibly nuking an fd opened by some other thread
      in the meantime.  This in turn can have all sorts of bad effects.
      
      The bug has been present since the introduction of virCommand in
      commit f16ad06f.
      
      This is based on his first attempt at a patch, at
      https://bugzilla.redhat.com/show_bug.cgi?id=823716
      
      * src/util/command.c (_virCommand): Drop inpipe member.
      (virCommandProcessIO): Add argument, to avoid closing caller's fd
      without informing caller.
      (virCommandRun, virCommandNewArgs): Adjust clients.
      (cherry picked from commit da831afc)
      1ae26045
    • W
      avoid fd leak · aa7d50ce
      Wen Congyang 提交于
      virCommandRunAsync() will set errfd if it succeed. We should
      close it if virFDStreamOpenInternal() fails.
      (cherry picked from commit 655cffa0)
      aa7d50ce
    • W
      avoid closing uninitialized fd · ab73fe59
      Wen Congyang 提交于
      If the system does not support bypass cache, we will close fd,
      but it is uninitialized.
      (cherry picked from commit 0a045f01)
      ab73fe59
    • E
      build: silence warning from autoconf · 37b07d90
      Eric Blake 提交于
      Autoconf 2.60 and later insist on using ${datarootdir}, rather than
      the derived ${datadir} (although the latter defaults to the former,
      it is possible to set configure arguments so that they differ):
      
      config.status: creating libvirt.pc
      config.status: WARNING:  'libvirt.pc.in' seems to ignore the --datarootdir setting
      
      This patch follows the autoconf manual's suggestions for how to
      support 2.59 (RHEL 5) and newer simultaneously.
      
      * libvirt.pc.in (datarootdir): Define, so ${datadir} will not ignore
      datarootdir when using newer autoconf.
      (cherry picked from commit aabf77aa)
      37b07d90
    • M
      virCommand: Extend debug message for handshake · b3f0d2ec
      Michal Privoznik 提交于
      Currently, we are logging only one side of pipes we
      create in virCommandRequireHandshake(); This is enough
      in cases where pipe2() returns two consecutive FDs. However,
      it is not guaranteed and it may return any FDs.
      Therefore, it's wise to log the other ends as well.
      (cherry picked from commit 7454849e)
      b3f0d2ec
    • M
      lxc: return correct number of CPUs · 0089a205
      Martin Kletzander 提交于
      When getting number of CPUs the host has assigned, there was always
      number "1" returned. Even though all lxc domains with no pinning
      launched by libvirt run on all pCPUs (by default, no matter what's the
      number), we should at least return the same number as the user
      specified when creating the domain.
      (cherry picked from commit 87dfdb0b)
      0089a205
    • D
      examples: add consolecallback example python script · dfa15484
      Dave Allan 提交于
      A while back I wrote the attached code to demonstrate how to use
      events and serial console to create a serial console that stays up
      even when the VM is down.  It might need some work, as I am not
      terribly strong with Python.
      
      * examples/python/consolecallback.py: New file.
      * examples/python/Makefile.am (EXTRA_DIST): Ship it.
      (cherry picked from commit ffc9f7ab)
      dfa15484
    • S
      leak_fix.diff · c82cbf1d
      Stefan Berger 提交于
      ==3240== 23 bytes in 1 blocks are definitely lost in loss record 242 of 744
      ==3240==    at 0x4C2A4CD: malloc (vg_replace_malloc.c:236)
      ==3240==    by 0x8077537: __vasprintf_chk (vasprintf_chk.c:82)
      ==3240==    by 0x509C677: virVasprintf (stdio2.h:199)
      ==3240==    by 0x509C733: virAsprintf (util.c:1912)
      ==3240==    by 0x1906583A: qemudStartup (qemu_driver.c:679)
      ==3240==    by 0x511991D: virStateInitialize (libvirt.c:809)
      ==3240==    by 0x40CD84: daemonRunStateInit (libvirtd.c:751)
      ==3240==    by 0x5098745: virThreadHelper (threads-pthread.c:161)
      ==3240==    by 0x7953D8F: start_thread (pthread_create.c:309)
      ==3240==    by 0x805FF5C: clone (clone.S:115)
      
      (cherry picked from commit 67dd486f)
      c82cbf1d
    • M
      docs: typo in acceleration element · da5eb7f1
      Martin Kletzander 提交于
      "accel3d" was specified twice, the second one is obviously "accel2d"
      (also from the text down below.
      (cherry picked from commit 94618eb6)
      da5eb7f1
    • D
      Re-order config options in qemu driver augeas lens · 9096dc1a
      Daniel P. Berrange 提交于
      Currently all the config options are listed under a 'vnc_entry'
      group. Create a bunch of new groups & move options to the
      right place
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      (cherry picked from commit 6c10c04c)
      9096dc1a
    • D
      Fix mistakes in augeas lens · cb724f8d
      Daniel P. Berrange 提交于
      Add nmissing 'host_uuid' entry to libvirtd.conf lens and
      rename spice_passwd to spice_password in qemu.conf lens
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      (cherry picked from commit a9c779ca)
      cb724f8d
    • D
      Standardize whitespace used in example config files · af57c143
      Daniel P. Berrange 提交于
      Instead of doing
      
        # example_config
      
      use
      
        #example_config
      
      so it is possible to programatically uncomment example config
      options, as distinct from their comment/descriptions
      
      Also delete rogue trailing comma not allowed by lens
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      (cherry picked from commit c5c3278e)
      
      (crobinso: Fix spacing to appease tests/daemon-conf, which is
       still in -maint branch)
      af57c143
    • D
      Fix check for socket existance / daemon spawn · eb6ef1f5
      Daniel P. Berrange 提交于
      When you try to connect to a socket in the abstract namespace,
      the error will be ECONNREFUSED for a non-listening daemon. With
      the non-abstract namespace though, you instead get ENOENT. Add
      a check for this extra errno when auto-spawning the daemon
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      (cherry picked from commit 54c4d9d9)
      eb6ef1f5
    • D
      Remove last usage of PATH_MAX and ban its future use · b4bbe640
      Daniel P. Berrange 提交于
      Remove a number of pointless checks against PATH_MAX and
      add a syntax-check rule to prevent its use in future
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      (cherry picked from commit ebbcc026)
      b4bbe640
    • J
      maint: avoid new automake warning about AM_PROG_CC_STDC · 0f031d18
      Jim Meyering 提交于
      * configure.ac (AM_PROG_CC_STDC): Stop using this macro.
      It provokes warnings from newer automake and is superseded by
      autoconf's AC_PROG_CC, which we're already using.
      (cherry picked from commit 0d07aa51)
      0f031d18
    • D
      Improve docs about compiling libvirt from GIT · 99f07394
      Daniel P. Berrange 提交于
      Add a note about setting the LIBVIRT_DRIVER_DIR env variable,
      explain --system and fix example to use --disable-werror
      (cherry picked from commit 4878a331)
      99f07394
    • E
      tests: run valgrind on real executables, not libtool wrappers · 52ab82bd
      Eric Blake 提交于
      * tests/Makefile.am (valgrind): Use libtool's ability to bypass
      libtool wrappers when running valgrind.
      (cherry picked from commit 428fc2bf)
      52ab82bd
    • D
      qemu augeas: Add spice_tls/spice_tls_x509_cert_dir · 7fba39bc
      Douglas Schilling Landgraf 提交于
      If vdsm is installed and configured in Fedora 17, we add the following
      items into qemu.conf:
      
      spice_tls=1
      spice_tls_x509_cert_dir="/etc/pki/vdsm/libvirt-spice"
      
      However, after this changes, augtool cannot identify qemu.conf anymore.
      (cherry picked from commit cdd762e4)
      7fba39bc
    • E
      tests: back to short test names · e39afdb8
      Eric Blake 提交于
      With the switch to modules by default, I was getting super long
      test output:
      
      TEST: /home/remote/eblake/libvirt/tests/.libs/lt-interfacexml2xmltest
      
      compared to the former:
      
      TEST: interfacexml2xmltest
      
      * tests/testutils.c (virtTestMain): Trim off libtool goop.
      (cherry picked from commit ee407255)
      e39afdb8
    • D
      Add parsing for VIR_ENUM_IMPL & VIR_ENUM_DECL in apibuild.py · 3e416ba9
      Daniel P. Berrange 提交于
      The apibuild.py parser needs to be able to parse & ignore
      any VIR_ENUM_IMPL/VIR_ENUM_DECL macros in the source. Add
      some special case code to deal with this rather than trying
      to figure out a generic syntax for parsing macros.
      
      * apibuild.py: Special case  VIR_ENUM_IMPL & VIR_ENUM_DECL
      (cherry picked from commit 45b43a8c)
      3e416ba9