1. 15 6月, 2012 40 次提交
    • P
      qemu: Fix off-by-one error while unescaping monitor strings · 0889bdb8
      Peter Krempa 提交于
      While unescaping the commands the commands passed through to the monitor
      function qemuMonitorUnescapeArg() initialized lenght of the input string
      to strlen()+1 which is fine for alloc but not for iteration of the
      string.
      
      This patch fixes the off-by-one error and drops the pointless check for
      a single trailing slash that is automaticaly handled by the default
      branch of switch.
      (cherry picked from commit 0f4660c8)
      0889bdb8
    • P
      virsh: Don't generate invalid XML in attach-disk command · 73908b1d
      Peter Krempa 提交于
      The attach-disk command used with parameter --cache created an invalid
      XML snippet as the beginning of the <driver> element was not printed
      when used solely with --cache and no other attribute to driver.
      (cherry picked from commit 5b474026)
      73908b1d
    • D
      Fix typo in RPM specfile · 661a2e83
      Daniel P. Berrange 提交于
      libvirt.spec.in: s/{?rhel}/%{?rhel}/
      (cherry picked from commit 48939a4a)
      661a2e83
    • E
      python: fix snapshot listing bugs · 934e7c22
      Eric Blake 提交于
      Python exceptions are different than libvirt errors, and we had
      some corner case bugs on OOM situations.
      
      * python/libvirt-override.c (libvirt_virDomainSnapshotListNames)
      (libvirt_virDomainSnapshotListChildrenNames): Use correct error
      returns, avoid segv on OOM, and avoid memory leaks on error.
      (cherry picked from commit a0de5d78)
      934e7c22
    • E
      python: use simpler methods · a570ecd6
      Eric Blake 提交于
      * python/libvirt-override.c (libvirt_virDomainGetVcpus)
      (libvirt_virDomainGetVcpuPinInfo): Use Py_XDECREF instead of
      open-coding it.
      (cherry picked from commit 8566618f)
      a570ecd6
    • M
      qemu: Don't overwrite security labels · dd85b621
      Michal Privoznik 提交于
      Currently, if qemuProcessStart fail at some point, e.g. because
      domain being started wants a PCI/USB device already assigned to
      a different domain, we jump to cleanup label where qemuProcessStop
      is performed. This unconditionally calls virSecurityManagerRestoreAllLabel
      which is wrong because the other domain is still using those devices.
      
      However, once we successfully label all devices/paths in
      qemuProcessStart() from that point on, we have to perform a rollback
      on failure - that is - we have to virSecurityManagerRestoreAllLabel.
      (cherry picked from commit 86032b22)
      
      Conflicts:
      
      	src/qemu/qemu_process.c
      dd85b621
    • M
      qemuProcessStop: Switch to flags · 9225f9e1
      Michal Privoznik 提交于
      Currently, we are passing only one boolean (migrated) so there is
      no real profit in this. But it creates starting position for
      next patch.
      (cherry picked from commit 69dd7714)
      
      Conflicts:
      
      	src/qemu/qemu_process.c
      9225f9e1
    • L
      docs: minor fixes to domain interface documentation · a016b20f
      Laine Stump 提交于
      A few examples for <interface> had a type='direct' interface with no
      sub-elements. This is not allowed - a type='direct' interface must
      have at least a source element. (Most likely the example was copied
      from the type='user' or type='ethernet' examples - they *do* allow an
      instance with no sub-elements).
      
      There was also one place that mistakenly used %lt; ... %gt; instead of
      &lt; ... &gt; (for some reason, I make that typo all the time).
      (cherry picked from commit 549741ee)
      a016b20f
    • E
      docs: link to FLOSS Weekly podcast, virt blogs · 17c78756
      Eric Blake 提交于
      Eric Blake and Guido Günther were guests during this week's
      FLOSS Weekly podcast, giving insights into libvirt as a Free
      Software project.  Also, there are several useful blogs on
      virt-related topics.
      
      * docs/relatedlinks.html.in (Blogs and Podcasts): New section.
      (cherry picked from commit a0ac7450)
      17c78756
    • D
      Two RPM conditional fixes for RHEL-7 · 6503cb12
      Daniel P. Berrange 提交于
      Ensure systemd is used in RHEL-7 and cgconfig is not used in
      RHEL-7
      (cherry picked from commit 1cdbe4d2)
      6503cb12
    • E
      snapshot: avoid virsh crash with older servers · 2e2a81be
      Eric Blake 提交于
      Commits 51082301, 16d7b390, and 521cc447 introduced support for
      'virsh snapshot-list --from' when talking to a server older than
      0.9.5, but broke support for plain 'virsh snapshot-list' for the
      same old server in the process.  Because the code is not properly
      gated, we end up with a SIGSEGV during a strcmp with a NULL argument.
      
      * tools/virsh.c (cmdSnapshotList): Don't waste time on fallbacks
      when --from is not present.
      (cherry picked from commit d9f60665)
      2e2a81be
    • O
      Update AUTHORS · a52a99f5
      Osier Yang 提交于
      Commit a80bb970 forgot to update authors.
      (cherry picked from commit d41d2526)
      a52a99f5
    • G
      LXC: fix memory leak in lxcContainerMountFSBlockAuto · a25ac3ac
      Gao feng 提交于
      we forgot to free fslist,just add VIR_FREE(fslist).
      Signed-off-by: NGao feng <gaofeng@cn.fujitsu.com>
      (cherry picked from commit e49d792f)
      a25ac3ac
    • G
      LXC: fix incorrect parameter of mount in lxcContainerMountFSBind · a9846e98
      Gao feng 提交于
      when do remount,the source and target should be the same
      values specified in the initial mount() call.
      
      So change fs->dst to src.
      Signed-off-by: NGao feng <gaofeng@cn.fujitsu.com>
      (cherry picked from commit 0cb787bd)
      a9846e98
    • 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