1. 17 9月, 2013 25 次提交
    • P
      virsh: Don't shadow global variable "remove" in cmdMetadata · 6bf4c779
      Peter Krempa 提交于
      Some systems apparently have a global variable/function called remove
      and thus break compilation of virsh-domain.c. Rename the variable to
      avoid this.
      
      Reported by GuanQiang.
      6bf4c779
    • P
      conf: Avoid false positive of uninitialized variable use · 0d4f469c
      Peter Krempa 提交于
      GCC 4.8.0+ whines about variable "new" being uninitialized since
      commit 73bfac0e. This is a false positive as the
      xmlFreeNode(new) statement can be only reached if new was actually
      allocated successfully.
      
        CC       conf/libvirt_conf_la-domain_conf.lo
        conf/domain_conf.c: In function 'virDomainDefSetMetadata':
        conf/domain_conf.c:18650:24: error: 'new' may be used uninitialized in this function [-Werror=maybe-uninitialized]
                     xmlFreeNode(new);
      
      Reported independently by John Ferlan and Michal Privoznik.
      0d4f469c
    • E
      build: fix VPATH build of remote driver · 716c7bb1
      Eric Blake 提交于
      Commit 073e1575 tried to set things up so that 1) generated files
      to be shipped in the tarball always live in srcdir, and 2) we have
      no files in SOURCES that depend on any other files with a literal
      $(srcdir) in the name, because that situation can cause confusing
      results for the make expansion of $@ depending on whether the file
      is found locally or via VPATH.  But all my testing for that patch
      was done incrementally, where all the protocol.[ch] files had
      already been generated prior to the patch and were up-to-date in
      the srcdir, and thus I missed one case where $@ causes grief in a
      VPATH build from a fresh checkout:
      
      We have a pattern rule for generating remote_protocol.[ch], and
      what's more, the rule for protocol.c depends on protocol.h AND
      on the protocol.x file.  The pattern for protocol.c is only
      satisfied via the VPATH lookup for protocol.x, and if protocol.h
      doesn't yet exist, the VPATH rule kicks in and we end up with a
      dependency on a file with $(srcdir) in the name.  Based on make's
      rules for $@, this resulted in make building remote_protocol.h
      into srcdir (where we want it), then remote_protocol.c into
      builddir (oops, not so good for the tarball), and also causes
      the build to fail (the compiler can't find the .h if it lives
      in a different directory than the .c):
      
        CC       remote/libvirt_driver_remote_la-remote_protocol.lo
      remote/remote_protocol.c:7:29: fatal error: remote_protocol.h: No such file or directory
       #include "remote_protocol.h"
                                   ^
      compilation terminated.
      
      As before, the fix is to hard-code the output file to go into
      srcdir in spite of $@; but since this is in a pattern rule, we
      are forced to use $@ in the recipe, so the patch is a bit
      trickier than what was done in commit 073e1575.
      
      * src/Makefile.am (%protocol.c, %protocol.h): Force output to srcdir.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      716c7bb1
    • P
      conf: Don't corrupt metadata on OOM · 7655ed08
      Peter Krempa 提交于
      Eric Blake suggested that we could do a little better in case copying of
      the metadata to be set fails. With this patch, the old metadata is
      discarded after the new string is copied successfuly.
      7655ed08
    • P
      qemu: Fix memleak after commit 59898a88 · 044e3e75
      Peter Krempa 提交于
      If the ABI compatibility check with the "migratable" user XML is
      successful, we would leak the originally parsed XML from the user that
      would not be used in this case.
      
      Reported by Ján Tomko.
      044e3e75
    • P
      tests: Add metadata tests · 2e23c77b
      Peter Krempa 提交于
      This test exercises the virDomain[Get|Set]Metadata API and tests it for
      regressions
      2e23c77b
    • P
      test: Add <metadata> support into the test driver · f616fbf2
      Peter Krempa 提交于
      f616fbf2
    • P
      lxc: Add metadata modification APIs · f9c7b32e
      Peter Krempa 提交于
      f9c7b32e
    • P
      lib: Don't force the key argument when deleting metadata · 3b6784d1
      Peter Krempa 提交于
      virDomainSetMetadata when operating on the metadata element was
      requesting the @key argument to be passed even if @metadata was NULL
      used to delete the corresponding metadata element. This is not needed as
      the key is only used when adding the element and matching is done via
      the XML namespace.
      3b6784d1
    • P
      conf: allow to add XML metadata using the virDomainSetMetadata api · 73bfac0e
      Peter Krempa 提交于
      The functionality wasn't originally implemented. This patch adds the
      ability to modify domain's XML metadata using the API.
      73bfac0e
    • P
      conf: Add support for requesting of XML metadata via the API · ac38bff0
      Peter Krempa 提交于
      The virDomainGetMetadata function was designed to support also retrieval
      of app specific metadata from the <metadata> element. This functionality
      was never implemented originally.
      ac38bff0
    • P
      virsh-domain: Add command to allow modifications of XML metadata · 01b03f59
      Peter Krempa 提交于
      The metadata modification functions will support modification of the XML
      metadata. Add a virsh command to allow using this approach.
      01b03f59
    • P
      3df33d7a
    • P
      be0f0c22
    • P
      conf: Factor out setting of metadata to simplify code · e9cb66f1
      Peter Krempa 提交于
      The code to set the metadata in a domain definition is common to live
      and inactive domains. Factor it out into a common func.
      e9cb66f1
    • P
      qemu: Factor out body of qemuDomainSetMetadata for universal use · f87a7c67
      Peter Krempa 提交于
      The function implemented common behavior that can be reused for other
      hypervisor drivers that use the virDomainObj data structures. Factor out
      the core into a separate helper func.
      f87a7c67
    • P
      qemu: Factor out body of qemuDomainGetMetadata for universal use · 99c51af2
      Peter Krempa 提交于
      The function implemented common behavior that can be reused for other
      hypervisor drivers that use the virDomainObj data structures. Factor out
      the core into a separate helper func.
      99c51af2
    • P
      virsh-domain: Line up signal names array · cb356928
      Peter Krempa 提交于
      Line up the array so that the grid is visible.
      cb356928
    • P
      virsh-domain: Remove spurious ATTRIBUTE_UNUSED from cmdDesc · 626d4dfc
      Peter Krempa 提交于
      The "cmd" variable is actually used so remove the attribute.
      626d4dfc
    • P
      qemu: Use "migratable" XML definition when doing external checkpoints · 1b7bfa65
      Peter Krempa 提交于
      In the original implementation of external checkpoints I've mistakenly
      used the live definition to be stored in the save image. The normal
      approach is to use the "migratable" definition. This was discovered when
      commit 07966f6a changed the behavior to
      use a converted XML from the user to do the compatibility check to fix
      problem when using the regular machine saving.
      
      As the previous patch added a compatibility layer, we can now change the
      type of the XML in the image.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1008340
      1b7bfa65
    • P
      qemu: Fix checking of ABI stability when restoring external checkpoints · 59898a88
      Peter Krempa 提交于
      External checkpoints have a bug in the implementation where they use the
      normal definition instead of the "migratable" one. This causes errors
      when the snapshot is being reverted using the workaround method via
      qemuDomainRestoreFlags() with a custom XML. This issue was introduced
      when commit 07966f6a changed the code to
      compare "migratable" XMLs from the user as we should have used
      migratable in the image too.
      
      This patch adds a compatibility layer, so that fixing the snapshot code
      won't make existing snapshots fail to load.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1008340
      59898a88
    • H
      virsh: Fix a wrong check in cmdEcho() · 0925ad4e
      Hongwei Bi 提交于
      What should be checked here is xmlbuf rather than buf.
      0925ad4e
    • D
      Allow LUN type disks to have no source · 3efbe13f
      Doug Goldstein 提交于
      CD-ROMs and Floppies are allowed to have no source to imply they are
      empty or disconnected. Since the LUN type is used for raw CD-ROM access
      with QEMU (and VMWare in the future), it also needs to allow an empty
      source when the raw CD-ROM device is disconnected from the domain.
      3efbe13f
    • J
      Always free network and graphics cookies · 102eb00c
      Ján Tomko 提交于
      qemuMigrationEatCookie has flags to control if these should
      be parsed, but it does not fill mig->flags. These cookies might
      get leaked if these flags are not set by qemuMigrationBakeCookie.
      
      42 (32 direct, 10 indirect) bytes in 1 blocks are definitely lost in
      loss record 361 of 662
      ==123== by 0x1BA33FCA: qemuMigrationEatCookie (qemu_migration.c:678)
      ==123== by 0x1BA34A1E: qemuMigrationRun (qemu_migration.c:3108)
      ==123== by 0x1BA3622B: doNativeMigrate (qemu_migration.c:3343)
      ==123== by 0x1BA3B408: qemuMigrationPerform (qemu_migration.c:4138)
      102eb00c
    • J
      Free slicename in virSystemdCreateMachine · 09b48562
      Ján Tomko 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1008619
      
      1,003 bytes in 1 blocks are definitely lost in loss record 599 of 635
      ==404== by 0x50728A7: virBufferAddChar (virbuffer.c:185)
      ==404== by 0x50BC466: virSystemdEscapeName (virsystemd.c:67)
      ==404== by 0x50BC6B2: virSystemdMakeSliceName (virsystemd.c:108)
      ==404== by 0x50BC870: virSystemdCreateMachine (virsystemd.c:169)
      ==404== by 0x5078267: virCgroupNewMachine (vircgroup.c:1498)
      09b48562
  2. 16 9月, 2013 6 次提交
    • E
      build: make autobuild require rpm build deps · 6ccf92ab
      Eric Blake 提交于
      I spent far too long on a new machine trying to figure out why
      ./autobuild.sh failed due to an rpm build failure (complaining
      that libvirt_parthelper was supposed to be packaged but was not
      built), and finally traced it to a missing parted-devel
      installation.  I learned that --nodeps is in place for
      autobuilder setups, but for developers, removing it would make
      rpmbuild error out much sooner for a less cryptic failure.
      
      * autobuild.sh: Conditionally drop --nodeps from rpmbuild lines.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      6ccf92ab
    • E
      build: fix build with latest rawhide kernel headers · e62e0094
      Eric Blake 提交于
      Bother those kernel developers.  In the latest rawhide, kernel
      and glibc have now been unified so that <netinet/in.h> and
      <linux/in6.h> no longer clash; but <linux/if_bridge.h> is still
      not self-contained.  Because of the latest header change, the
      build is failing with:
      
      checking for linux/param.h... no
      configure: error: You must install kernel-headers in order to compile libvirt with QEMU or LXC support
      
      with details:
      
      In file included from conftest.c:561:0:
      /usr/include/linux/in6.h:71:18: error: field 'flr_dst' has incomplete type
        struct in6_addr flr_dst;
      
      We need a workaround to avoid our workaround :)
      
      * configure.ac (NETINET_LINUX_WORKAROUND): New test.
      * src/util/virnetdevbridge.c (includes): Use it.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      e62e0094
    • P
      cgroup: Move [qemu|lxc]GetCpuBWStatus to vicgroup.c and refactor it · d79fe8b5
      Peter Krempa 提交于
      The function existed in two identical instances in lxc and qemu. Move it
      to vircgroup.c and simplify it. Refactor the callers too.
      d79fe8b5
    • P
      cleanup: Kill usage of access(PATH, F_OK) in favor of virFileExists() · 4baa8d76
      Peter Krempa 提交于
      Semantics of the libvirt helper are more clear. This change also allows
      to clean up some pieces of code.
      4baa8d76
    • P
      util: Declare that virFileExists shall honor errno · d66e7ce6
      Peter Krempa 提交于
      Explicitly state that some parts of the code may require virFileExists
      to set or preserve a correct errno so that future modifications don't
      break.
      d66e7ce6
    • Y
      virsh: move command maxvcpus from domain group to host group. · 6c038ee3
      yangdongsheng 提交于
      Since the maxvcpus command query the maximum number of virtual
      CPUs supported for a guest VM on this connection, it should be
      in virsh-host.c but not virsh-domain.c.
      Signed-off-by: Nyangdongsheng <yangds.fnst@cn.fujitsu.com>
      6c038ee3
  3. 14 9月, 2013 1 次提交
    • G
      Explicitly link libvirt_net_rpc against SELINUX_LIBS · 42c6a0cd
      Guido Günther 提交于
      Since virnetsocket conditionally uses selinux we need to link against it
      otherwise the build fails with:
      
      CCLD     libvirtd
      /usr/bin/ld: ../src/.libs/libvirt-lxc.so: undefined reference to symbol 'freecon'
      /lib/i386-linux-gnu/libselinux.so.1: error adding symbols: DSO missing from command line
      collect2: error: ld returned 1 exit status
      make[3]: *** [libvirtd] Error 1
      42c6a0cd
  4. 13 9月, 2013 5 次提交
  5. 12 9月, 2013 3 次提交
    • G
      LXC: don't try to mount selinux filesystem when user namespace enabled · 1c7037cf
      Gao feng 提交于
      Right now we mount selinuxfs even user namespace is enabled and
      ignore the error. But we shouldn't ignore these errors when user
      namespace is not enabled.
      
      This patch skips mounting selinuxfs when user namespace enabled.
      Signed-off-by: NGao feng <gaofeng@cn.fujitsu.com>
      1c7037cf
    • P
      qemu: Fix checking of guest ABI compatibility when reverting snapshots · 53c39f58
      Peter Krempa 提交于
      When reverting a live internal snapshot with a live guest the ABI
      compatiblity check was comparing a "migratable" definition with a normal
      one. This resulted in the check failing with:
      
      revert requires force: Target device address type none does not match source pci
      
      This patch generates a "migratable" definition from the actual one to
      check against the definition from the snapshot to avoid this problem.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1006886
      53c39f58
    • L
      netcf driver: use a single netcf handle for all connections · 822fe136
      Laine Stump 提交于
      This resolves: https://bugzilla.redhat.com/show_bug.cgi?id=983026
      
      The netcf interface driver previously had no state driver associated
      with it - as a connection was opened, it would create a new netcf
      instance just for that connection, and close it when it was
      finished. the problem with this is that each connection to libvirt
      used up a netlink socket, and there is a per process maximum of ~1000
      netlink sockets.
      
      The solution is to create a state driver to go along with the netcf
      driver. The state driver will opens a netcf instance, then all
      connections share that same netcf instance, thus only a single
      netlink socket will be used no matter how many connections are mde to
      libvirtd.
      
      This was rather simple to do - a new virObjectLockable class is
      created for the single driverState object, which is created in
      netcfStateInitialize and contains the single netcf handle; instead of
      creating a new object for each client connection, netcfInterfaceOpen
      now just increments the driverState object's reference count and puts
      a pointer to it into the connection's privateData. Similarly,
      netcfInterfaceClose() just un-refs the driverState object (as does
      netcfStateCleanup()), and virNetcfInterfaceDriverStateDispose()
      handles closing the netcf instance. Since all the functions already
      have locking around them, the static lock functions used by all
      functions just needed to be changed to call virObjectLock() and
      virObjectUnlock() instead of directly calling the virMutex* functions.
      822fe136