1. 06 4月, 2012 4 次提交
    • S
      xen config: No vfb in HVM guest configuration · fb98da00
      Stefan Bader 提交于
      This causes an implicit vkbd device to be added which takes
      6min to finally fail being initialized in the guest.
      
      http://lists.xen.org/archives/html/xen-devel/2012-04/msg00409.htmlSigned-off-by: NStefan Bader <stefan.bader@canonical.com>
      fb98da00
    • E
      tests: avoid compiler warnings · 72505073
      Eric Blake 提交于
      gcc 4.7 warns about uninitialized struct members
      
      * tests/testutilsqemu.c (testQemuCapsInit): Populate new members.
      * tests/viruritest.c (mymain): Likewise.
      72505073
    • L
      test: fix build errors with gcc 4.7.0 and -O0 · 06a1a45c
      Laine Stump 提交于
      When building on Fedora 17 (which uses gcc 4.7.0) with -O0 in CFLAGS,
      three of the tests failed to compile.
      
      cputest.c and qemuxml2argvtest.c had non-static structs defined
      inside the macro that was being repeatedly invoked. Due to some so-far
      unidentified change in gcc, the stack space used by variables defined
      inside { } is not recovered/re-used when the block ends, so all these
      structs have become additive (this is the same problem worked around
      in commit cf57d345). Fortunately, these two files could be fixed with
      a single line addition of "static" to the struct definition in the
      macro.
      
      virnettlscontexttest.c was a bit different, though. The problem structs
      in the do/while loop of macros had non-constant initializers, so it
      took a bit more work and piecemeal initialization instead of member
      initialization to get things to be happy.
      
      In an ideal world, none of these changes should be necessary, but not
      knowing how long it will be until the gcc regressions are fixed, and
      since the code is just as correct after this patch as before, it makes
      sense to fix libvirt's build for -O0 while also reporting the gcc
      problem.
      06a1a45c
    • G
      virURIParse: don't forget to copy the user part · 4eb1c256
      Guido Günther 提交于
      This got dropped with 300e60e1
      
      Cheers,
       -- Guido
      4eb1c256
  2. 05 4月, 2012 4 次提交
    • L
      test: fix segfault in networkxml2argvtest · bde32b1a
      Laine Stump 提交于
      This bug resolves https://bugzilla.redhat.com/show_bug.cgi?id=810100
      
      rpm builds for i686 were failing with a segfault in
      networkxml2argvtest. Running under valgrind showed that a region of
      memory was being referenced after it had been freed (as the result of
      realloc - see the valgrind report in the BZ).
      
      The problem (in replaceTokens() - added in commit 22ec60, meaning this
      bug was in 0.9.10 and 0.9.11) was that the pointers token_start and
      token_end were being computed based on the value of *buf, then *buf
      was being realloc'ed (potentially moving it), then token_start and
      token_end were used without recomputing them to account for movement
      of *buf.
      
      The solution is to change the code so that token_start and token_end
      are offsets into *buf rather than pointers. This way there is only a
      single pointer to the buffer, and nothing needs readjusting after a
      realloc. (You may note that some uses of token_start/token_end didn't
      need to be changed to add in "*buf +" - that's because there ended up
      being a +*buf and -*buf which canceled each other out).
      
      DV gets the credit for finding this bug and pointing out the valgrind
      report.
      bde32b1a
    • A
      conf: Plug memory leaks on virDomainDiskDefParseXML · 80d476a9
      Alex Jia 提交于
      Detected by valgrind. Leaks are introduced in commit b22eaa75.
      
      * src/conf/domain_conf.c (virDomainDiskDefParseXML): fix memory leaks.
      
      How to reproduce?
      
      % make && make -C tests check TESTS=qemuxml2argvtest
      % cd tests && valgrind -v --leak-check=full ./qemuxml2argvtest
      
      actual result:
      
      ==2143== 12 bytes in 2 blocks are definitely lost in loss record 74 of 179
      ==2143==    at 0x4A05FDE: malloc (vg_replace_malloc.c:236)
      ==2143==    by 0x39D90A67DD: xmlStrndup (xmlstring.c:45)
      ==2143==    by 0x4F5EC0: virDomainDiskDefParseXML (domain_conf.c:3438)
      ==2143==    by 0x502F00: virDomainDefParseXML (domain_conf.c:8304)
      ==2143==    by 0x505FE3: virDomainDefParseNode (domain_conf.c:9080)
      ==2143==    by 0x5069AE: virDomainDefParse (domain_conf.c:9030)
      ==2143==    by 0x41CBF4: testCompareXMLToArgvHelper (qemuxml2argvtest.c:105)
      ==2143==    by 0x41E5DD: virtTestRun (testutils.c:145)
      ==2143==    by 0x416FA3: mymain (qemuxml2argvtest.c:399)
      ==2143==    by 0x41DCB7: virtTestMain (testutils.c:700)
      ==2143==    by 0x39CF01ECDC: (below main) (libc-start.c:226)
      Signed-off-by: NAlex Jia <ajia@redhat.com>
      80d476a9
    • I
      openvz: support vzctl 3.1 · 37075dfe
      Ilja Livenson 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=809895
      
      Basically, openvz dropped strict version numbering (3.1 vs 3.1.0),
      which caused parsing to fail.
      37075dfe
    • D
      Don't install sysctl file on non-Linux hosts · e7eca6e4
      Daniel P. Berrange 提交于
      * configure.ac: Set WITH_SYSCTL only on Linux hosts
      * daemon/Makefile.am: Conditionalize install-sysctl using WITH_SYSCTL
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      Cc: Jason Helfman <jhelfman@e-e.com>
      e7eca6e4
  3. 04 4月, 2012 13 次提交
    • D
      Fix parallel build in docs/ directory · 4f4b496e
      Daniel P. Berrange 提交于
      Every now & then, with parallel builds, we get a failure to
      validate hvsupport.html.in.  I eventually noticed that this
      is because we get 2 instances of the generator running at
      once.
      
      We already list hvsupport.html.in in BUILT_SOURCES but this
      was not working. It turns out the flaw is that we were
      adding deps to the 'all:' target instead of the 'all-am:'
      target. BUILT_SOURCES is a dep of 'all', so any custom
      targets written in Makefile.am must use 'all-am:' so that
      they don't get run until BUILT_SOURCES are completely
      generated
      
      * docs/Makefile.am: s/all/all-am/
      4f4b496e
    • D
    • D
      Add linuxNodeInfoCPUPopulate to src/libvirt_linux.syms · 06180ca4
      Daniel P. Berrange 提交于
      This symbol is used in the test suites
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      06180ca4
    • D
      Fix format specifiers in test cases on Win32 · f48de0f1
      Daniel P. Berrange 提交于
      Some of the test suites use fprintf with format specifiers
      that are not supported on Win32 and are not fixed by gnulib.
      
      The mingw32 compiler also has trouble detecting ssize_t
      correctly, complaining that 'ssize_t' does not match
      'signed size_t' (which it expects for %zd). Force the
      cast to size_t to avoid this problem
      
      * tests/testutils.c, tests/testutils.h: Fix printf
        annotation on virTestResult. Use virVasprintf
        instead of vfprintf
      * tests/virhashtest.c: Use VIR_WARN instead of fprintf(stderr).
        Cast to size_t to avoid mingw32 compiler bug
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      f48de0f1
    • M
      qemu: Build activeUsbHostdevs list on process reconnect · ea3bc548
      Michal Privoznik 提交于
      If the daemon is restarted it will lose list of active
      USB devices assigned to active domains. Therefore we need
      to rebuild this list on qemuProcessReconnect().
      ea3bc548
    • M
      qemu: Delete USB devices used by domain on stop · e2f5dd61
      Michal Privoznik 提交于
      To prevent assigning one USB device to two domains,
      we keep a list of assigned USB devices. On domain
      startup - qemuProcessStart() - we insert devices
      used by domain into the list but remove them only
      on detach-device. Devices are, however, released
      on qemuProcessStop() as well.
      e2f5dd61
    • M
      qemu: Don't leak temporary list of USB devices · b2c7b9ee
      Michal Privoznik 提交于
      and add debug message when adding USB device
      to the list of active devices.
      b2c7b9ee
    • D
      Fix initial hypervisor conditionals · cf2ed25c
      Daniel P. Berrange 提交于
      The openvz, virtualbox and vmware drivers do not run inside
      libvirtd, therefore they should be grouped with the other
      client side drivers
      cf2ed25c
    • D
      Remove bogus xen-devel dep from libvirt-devel RPM · 899bf668
      Daniel P. Berrange 提交于
      The public libvirt API does not have any application visible
      dependency on Xen libraries. The xen-devel dependency is thus
      bogus
      899bf668
    • D
      Introduce per-hypervisor virtual RPMs · 726e391d
      Daniel P. Berrange 提交于
      Introduce a set sub-RPMs, one per hypervisor, which can be used
      as dependency targets by applications wishing to pull in the
      full stack of packages required for a specific hypervisor. This
      avoids the application needing to know what the hypervisor specific
      package set is.
      
      ie, applications should not need to know that using the libvirt
      Xen hypervisor requires the 'xen' RPM - libvirt should take care
      of that knowledge. All the application wants is 'libvirt-daemon-xen'
      
      There are 5 sub-RPMs:
      
        libvirt-daemon-qemu - non-native TCG based emulators
        libvirt-daemon-kvm  - native KVM hypervisor
        libvirt-daemon-uml  - User Mode linux
        libvirt-daemon-xen  - Xen, either via XenD or libxl
        libvirt-daemon-lxc  - Linux native containers
      
      When driver modules get turned on, these sub-RPMs will also
      gain dependencies on the appropriate driver module .so files
      726e391d
    • D
      Split config files & daemon off from main daemon RPM · bb145134
      Daniel P. Berrange 提交于
      Take the libvirt RPM and split it into three pieces
      
       - libvirt-daemon - libvirtd & other mandatory bits for its operation
       - libvirt-daemon-config-network - the virbr0 config definition
       - libvirt-daemon-config-nwfilter - the firewall config rules
      
      For backwards compatibility with existing installs / application RPM
      deps, the 'libvirt' RPM is retained, but will have a dependency on
      the 3 new RPMs.
      bb145134
    • D
      Remove API XML files from libvirt RPM · 189fbe1a
      Daniel P. Berrange 提交于
      The API XML files are now formally installed as part of the
      libvirt-devel RPM. Thus there is no need to include them as
      %doc in the main libvirt RPM
      189fbe1a
    • D
      Move all documentation into a -docs sub-RPM · 524ba61d
      Daniel P. Berrange 提交于
      Currently documentation is split between the libvirt RPM and the
      libvirt-devel RPM. In the client-only build there is no libvirt
      RPM, so the docs need to live elsewhere. The obvious answer is a
      dedicated libvirt-docs RPM. For back-compatibility make the
      libvirt-devel RPM require the libvirt-docs RPM
      
      * libvirt.spec.in: Create separate libvirt-docs RPM
      524ba61d
  4. 03 4月, 2012 6 次提交
  5. 02 4月, 2012 4 次提交
    • P
      Xen: Fix <clock> handling · 11ec6bd8
      Philipp Hahn 提交于
      XenD-3.1 introduced managed domains. HV-domains have rtc_timeoffset
      (hgd24f37b31030 from 2007-04-03), which tracks the offset between the
      hypervisors clock and the domains RTC, and is persisted by XenD.
      In combination with localtime=1 this had a bug until XenD-3.4
      (hg5d701be7c37b from 2009-04-01) (I'm not 100% sure how that bug
      manifests, but at least for me in TZ=Europe/Berlin I see the previous
      offset relative to utc being applied to localtime again, which manifests
      in an extra hour being added)
      
      XenD implements the following variants for clock/@offset:
      - PV domains don't have a RTC → 'localtime' | 'utc'
      - <3.1: no managed domains → 'localtime' | 'utc'
      - ≥3.1: the offset is tracked for HV → 'variable'
              due to the localtime=1 bug → 'localtime' | 'utc'
      - ≥3.4: the offset is tracked for HV → 'variable'
      
      Current libvirtd still thinks XenD only implements <clock offset='utc'/>
      and <clock offset='localtime'/>, which is wrong, since the semantic of
      'utc' and 'localtime' specifies, that the offset will be reset on
      domain-restart, while with 'variable' the offset is kept. (keeping the
      offset over "virsh edit" is important, since otherwise the clock might
      jump, which confuses certain guest OSs)
      
      xendConfigVersion was last incremented to 4 by the xen-folks for
      xen-3.1.0. I know of no way to reliably detect the version of XenD
      (user space tools), which may be different from the version of the
      hypervisor (kernel) version! Because of this only the change from
      'utc'/'localtime' to 'variable' in XenD-3.1 is handled, not the buggy
      behaviour of XenD-3.1 until XenD-3.4.
      
      For backward compatibility with previous versions of libvirt Xen-HV
      still accepts 'utc' and 'localtime', but they are returned as 'variable'
      on the next read-back from Xend to libvirt, since this is what XenD
      implements: The RTC is NOT reset back to the specified time on next
      restart, but the previous offset is kept.
      This behaviour can be turned off by adding the additional attribute
      adjustment='reset', in which case libvirt will report an error instead
      of doing the conversion. The attribute can also be used as a shortcut to
      offset='variable' with basis='...'.
      
      With these changes, it is also necessary to adjust the xen tests:
      
      "localtime = 0" is always inserted, because otherwise on updates the
      value is not changed within XenD.
      
      adjustment='reset' is inserted for all cases, since they're all <
      XEND_CONFIG_VERSION_3_1_0, only 3.1 introduced persistent
      rtc_timeoffset.
      
      Some statements change their order because code was moved around.
      Signed-off-by: NPhilipp Hahn <hahn@univention.de>
      11ec6bd8
    • P
      Support clock=variable relative to localtime · b8bf79aa
      Philipp Hahn 提交于
      Since Xen 3.1 the clock=variable semantic is supported. In addition to
      qemu/kvm Xen also knows about a variant where the offset is relative to
      'localtime' instead of 'utc'.
      
      Extends the libvirt structure with a flag 'basis' to specify, if the
      offset is relative to 'localtime' or 'utc'.
      
      Extends the libvirt structure with a flag 'reset' to force the reset
      behaviour of 'localtime' and 'utc'; this is needed for backward
      compatibility with previous versions of libvirt, since they report
      incorrect XML.
      
      Adapt the only user 'qemu' to the new name.
      Extend the RelaxNG schema accordingly.
      Document the new 'basis' attribute in the HTML documentation.
      Adapt test for the new attribute.
      Signed-off-by: NPhilipp Hahn <hahn@univention.de>
      b8bf79aa
    • Y
      Fix typos and spacing in messages. · 867ed7bb
      Yuri Chornoivan 提交于
      867ed7bb
    • L
      qemu: fix memory leak in virDomainGetVcpus · a4650316
      Laine Stump 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=808979
      
      The leak is really in virProcessInfoGetAffinity, as shown in the
      valgrind output given in the above bug report - it calls CPU_ALLOC(),
      but then fails to call CPU_FREE().
      
      This leak has existed in every version of libvirt since 0.7.5.
      a4650316
  6. 31 3月, 2012 9 次提交
    • E
      conf: allow fuzz in XML with cur balloon > max · d400b8fb
      Eric Blake 提交于
      Commit 1b1402b9 introduced a regression.  Since older libvirt versions
      would silently round memory up (until the previous patch), but populated
      current memory based on querying the guest, it was possible to have
      dumpxml show cur > max by the amount of the rounding.  For example, if
      a user requested 1048570 KiB memory (just shy of 1GiB), the qemu
      driver would actually run with 1048576 KiB, and libvirt 0.9.10 would
      output a current that was 6KiB larger than the maximum.  Situations
      where this could have an impact include, but are not limited to,
      migration from old to new libvirt, managedsave in old libvirt and
      start in new libvirt, snapshot creation in old libvirt and revert in
      new libvirt - without this patch, the new libvirt would reject the
      VM because of the rounding discrepancy.
      
      Fix things by adding a fuzz factor, and silently clamp current down to
      maximum in that case, rather than failing to reparse XML for an existing
      VM.  From a practical standpoint, this has no user impact: 'virsh
      dumpxml' will continue to query the running guest rather than rely on
      the incoming xml, which will see the currect current value, and even if
      clamping down occurs during parsing, it will be by at most the fuzz
      factor of a megabyte alignment, and rounded back up when passed back to
      the hypervisor.
      
      Meanwhile, we continue to reject cur > max if the difference is beyond
      the fuzz factor of nearest megabyte.  But this is not a real change in
      behavior, since with 0.9.10, even though the parser allowed it, later
      in the processing stream we would reject it at the qemu layer; so
      rejecting it in the parser just moves error detection to a nicer place.
      
      * src/conf/domain_conf.c (virDomainDefParseXML): Don't reject
      existing XML.
      Based on a report by Zhou Peng.
      d400b8fb
    • E
      qemu: reflect any memory rounding back to xml · 095b0bc4
      Eric Blake 提交于
      If we round up a user's memory request, we should update the XML
      to reflect the actual value in use by the VM, rather than giving
      an artificially small value back to the user.
      
      * src/qemu/qemu_command.c (qemuBuildNumaArgStr)
      (qemuBuildCommandLine): Reflect rounding back to XML.
      095b0bc4
    • E
      python: improve conversion validation · 4a86c2bb
      Eric Blake 提交于
      Laszlo Ersek pointed out that in trying to convert a long to an
      unsigned int, we used:
      
      long long_val = ...;
      if ((unsigned int)long_val == long_val)
      
      According to C99 integer promotion rules, the if statement is
      equivalent to:
      
      (unsigned long)(unsigned int)long_val == (unsigned long)long_val
      
      since you get an unsigned comparison if at least one side is
      unsigned, using the largest rank of the two sides; but on 32-bit
      platforms, where unsigned long and unsigned int are the same size,
      this comparison is always true and ends up converting negative
      long_val into posigive unsigned int values, rather than rejecting
      the negative value as we had originally intended (python longs
      are unbounded size, and we don't want to do silent modulo
      arithmetic when converting to C code).
      
      Fix this by using direct comparisons, rather than casting.
      
      * python/typewrappers.c (libvirt_intUnwrap, libvirt_uintUnwrap)
      (libvirt_ulongUnwrap, libvirt_ulonglongUnwrap): Fix conversion
      checks.
      4a86c2bb
    • D
      Fix client only RPM build & other misc RPM problems · 8bf0442e
      Daniel P. Berrange 提交于
      * libvirt.spec.in: Remove obsolete --with-remote-pid-file arg.
        Add missing %{without_libxl} statement. Fix handling of docs
        in client only build. Put systemtap files in -client RPM
        instead of -daemon RPM
      * examples/xml/nwfilter/Makefile.am: Don't install examples if
        nwfilter is disabled.
      8bf0442e
    • D
      Refactor the libvirt RPM daemon pieces · 06a0d57f
      Daniel P. Berrange 提交于
      There are a number of flaws with our packaging of the libvirtd
      daemon:
      
       - Installing 'libvirt' does not install 'qemu-kvm' or 'xen'
         etc which are required to actually run the hypervisor in
         question
       - Installing 'libvirt' pulls in the default configuration
         files which may not be wanted & cause problems if installed
         inside a guest
       - It is not possible to explicitly required all the peices
         required to manage a specific hypervisor
      
      This change takes the 'libvirt' RPM and and changes it thus
      
       - libvirt: just a virtual package with dep on libvirt-daemon,
         libvirt-daemon-config-network & libvirt-daemon-config-nwfilter
       - libvirt-daemon: the libvirt daemon and related pieces
       - libvirt-daemon-config-network: the default network config
       - libvirt-daemon-config-nwfilter: the network filter configs
       - libvirt-docs: the website HTML
      
      We then introduce some more virtual (empty) packages
      
       - libvirt-daemon-qemu: Deps on libvirt-daemon & 'qemu'
       - libvirt-daemon-kvm: Deps on libvirt-daemon & 'qemu-kvm'
       - libvirt-daemon-lxc: Deps on libvirt-daemon
       - libvirt-daemon-uml: Deps on libvirt-daemon
       - libvirt-daemon-xen: Deps on libvirt-daemon & 'xen'
      
       - libvirt-qemu: Deps on libvirt-daemon-qemu & libvirt-daemon-config-{network,nwfilter}
       - libvirt-kvm: Deps on libvirt-daemon-kvm & libvirt-daemon-config-{network,nwfilter}
       - libvirt-lxc: Deps on libvirt-daemon-lxc & libvirt-daemon-config-{network,nwfilter}
       - libvirt-uml: Deps on libvirt-daemon-uml & libvirt-daemon-config-{network,nwfilter}
       - libvirt-xen: Deps on libvirt-daemon-xen & libvirt-daemon-config-network
      
      My intent in the future is to turn on the driver modules by
      default, at which time 'libvirt-daemon' will cease to include
      any specific drivers, instead we'll get libvirt-daemon-driver-XXXX
      packages for each driver. The libvirt-daemon-XXX packages will
      then pull in each driver that they require.
      
      It is recommended that applications required a locally installed
      libvirtd daemon, use either 'Requires: libvirt-daemon-XXXX' or
      'Requires: libvirt-XXX' and *not* "Requires: libvirt-daemon"
      or 'Requires: libvirt'
      
      * libvirt.spec.in: Refactor RPMs
      * docs/packaging.html.in, docs/sitemap.html.in: Document
        new RPM split rationale
      06a0d57f
    • H
      qemu: support live change of the bridge used by a guest network device · 2711ac87
      Hendrik Schwartke 提交于
      This patch was created to resolve this upstream bug:
      
        https://bugzilla.redhat.com/show_bug.cgi?id=784767
      
      and is at least a partial solution to this RHEL RFE:
      
        https://bugzilla.redhat.com/show_bug.cgi?id=805071
      
      Previously the only attribute of a network device that could be
      modified by virUpdateDeviceFlags() ("virsh update-device") was the
      link state; attempts to change any other attribute would log an error
      and fail.
      
      This patch adds recognition of a change in bridge device name, and
      supports reconnecting the guest's interface to the new device.
      Standard audit logs for detaching and attaching a network device are
      also generated. Although the current auditing function doesn't log the
      bridge being attached to, this will later be changed in a separate
      patch.
      2711ac87
    • E
      build: fix build on cygwin · 87681495
      Eric Blake 提交于
      Regression introduced when we changed types in commit 3e2c3d8f.
      
      We've done this sort of cleanup before (see commit c685993d).
      
      * src/conf/storage_conf.c (virStoragePoolDefFormat)
      (virStorageVolTargetDefFormat): Cast gid_t and uid_t.
      87681495
    • E
      build: fix mingw ssize_t, syntax check · 1012dc29
      Eric Blake 提交于
      We are so close to a release that we don't want to pull in a
      gnulib submodule update and risk regressions, since there has
      been a lot of other gnulib churn upstream.  However, there are
      a couple of gnulib issues that are worth fixing in isolation,
      by applying local patches to gnulib.
      
      There was an upstream gnulib bug in maint.mk that rendered most
      of our syntax checks ineffective (and fixing it flushed out a
      minor bug in our code):
      https://lists.gnu.org/archive/html/bug-gnulib/2012-03/msg00194.html
      
      There is still an upstream bug where gnulib uses the wrong type
      for ssize_t on mingw; we need the fix now even though it has not
      yet been accepted into gnulib:
      https://lists.gnu.org/archive/html/bug-gnulib/2012-03/msg00188.html
      
      * gnulib/local/top/maint.mk.diff: Pick up upstream gnulib
      maint.mk.
      * gnulib/local/m4/ssize_t.m4.diff: Work around gnulib bug.
      * src/libvirt.c: Remove unused header.
      * cfg.mk
      (exclude_file_name_regexp--sc_prohibit_empty_lines_at_EOF): Exempt
      gnulib local files.
      1012dc29
    • L
      qemu: eliminate nested switch, simplify code · ecde1591
      Laine Stump 提交于
      qemuBuildHostNetStr had a switch-within-a-switch where both were
      looking at the same variable. This was apparently to take advantage of
      code common to three different cases (while also taking care of some
      code that was different). However, there were only 2 lines common to
      all, one of those can be eliminated by merging it into the
      virAsprintfs that are in each case. On top of that, all the extra
      empty cases cause Coverity complaints (because they are unreachable),
      but absence of the empty cases causes a compile error due to
      "enumeration value not handled in switch".
      
      The solution is to just make each toplevel case independent, folding
      in the common code to each.
      ecde1591