1. 04 5月, 2012 9 次提交
    • O
      Coverity: Fix resource leak in virnetlink.c · fd2b4157
      Osier Yang 提交于
      fd2b4157
    • O
      Coverity: Fix resource leak in nodeinfo.c · 739cfc31
      Osier Yang 提交于
      Error: RESOURCE_LEAK:
      /builddir/build/BUILD/libvirt-0.9.10/src/nodeinfo.c:629: alloc_fn: Calling allocation function "fopen".
      /builddir/build/BUILD/libvirt-0.9.10/src/nodeinfo.c:629: var_assign: Assigning: "cpuinfo" =  storage returned from "fopen("/proc/cpuinfo", "r")".
      /builddir/build/BUILD/libvirt-0.9.10/src/nodeinfo.c:638: leaked_storage: Variable "cpuinfo" going out of scope leaks the storage it points to.
      739cfc31
    • O
      Coverity: Fix resource leak in test driver · ad4d4ad0
      Osier Yang 提交于
      Error: RESOURCE_LEAK:
      /builddir/build/BUILD/libvirt-0.9.10/src/test/test_driver.c:1041: alloc_arg: Calling allocation function "virXPathNodeSet" on "devs".
      /builddir/build/BUILD/libvirt-0.9.10/src/util/xml.c:621: alloc_arg: "virAllocN" allocates memory that is stored into "*list".
      /builddir/build/BUILD/libvirt-0.9.10/src/util/memory.c:129: alloc_fn: Storage is returned from allocation function "calloc".
      /builddir/build/BUILD/libvirt-0.9.10/src/util/memory.c:129: var_assign: Assigning: "*((void **)ptrptr)" = "calloc(count, size)".
      /builddir/build/BUILD/libvirt-0.9.10/src/util/xml.c:625: noescape: Variable "*list" is not freed or pointed-to in function "memcpy".
      /builddir/build/BUILD/libvirt-0.9.10/src/test/test_driver.c:1098: leaked_storage: Variable "devs" going out of scope leaks the storage it points to.
      ad4d4ad0
    • O
      Coverity: Fix resource leak in xen driver · e91e0ab6
      Osier Yang 提交于
      Coverity logs:
      
      Error: RESOURCE_LEAK:
      /builddir/build/BUILD/libvirt-0.9.10/src/xen/xen_inotify.c:103: alloc_fn: Calling allocation function "xenDaemonLookupByUUID".
      /builddir/build/BUILD/libvirt-0.9.10/src/xen/xend_internal.c:2534: alloc_fn: Storage is returned from allocation function "virGetDomain".
      /builddir/build/BUILD/libvirt-0.9.10/src/datatypes.c:191: alloc_arg: "virAlloc" allocates memory that is stored into "ret".
      /builddir/build/BUILD/libvirt-0.9.10/src/util/memory.c:101: alloc_fn: Storage is returned from allocation function "calloc".
      /builddir/build/BUILD/libvirt-0.9.10/src/util/memory.c:101: var_assign: Assigning: "*((void **)ptrptr)" = "calloc(1UL, size)".
      /builddir/build/BUILD/libvirt-0.9.10/src/datatypes.c:210: return_alloc: Returning allocated memory "ret".
      /builddir/build/BUILD/libvirt-0.9.10/src/xen/xend_internal.c:2534: var_assign: Assigning: "ret" = "virGetDomain(conn, name, uuid)".
      /builddir/build/BUILD/libvirt-0.9.10/src/xen/xend_internal.c:2541: return_alloc: Returning allocated memory "ret".
      /builddir/build/BUILD/libvirt-0.9.10/src/xen/xen_inotify.c:103: var_assign: Assigning: "dom" =  storage returned from "xenDaemonLookupByUUID(conn, rawuuid)".
      /builddir/build/BUILD/libvirt-0.9.10/src/xen/xen_inotify.c:126: leaked_storage: Variable "dom" going out of scope leaks the storage it points to.
      
      Error: RESOURCE_LEAK:
      /builddir/build/BUILD/libvirt-0.9.10/src/xen/xen_hypervisor.c:2742: alloc_fn: Calling allocation function "fopen".
      /builddir/build/BUILD/libvirt-0.9.10/src/xen/xen_hypervisor.c:2742: var_assign: Assigning: "cpuinfo" =  storage returned from "fopen("/proc/cpuinfo", "r")".
      /builddir/build/BUILD/libvirt-0.9.10/src/xen/xen_hypervisor.c:2763: noescape: Variable "cpuinfo" is not freed or pointed-to in function "xenHypervisorMakeCapabilitiesInternal".
      /builddir/build/BUILD/libvirt-0.9.10/src/xen/xen_hypervisor.c:2574:45: noescape: "xenHypervisorMakeCapabilitiesInternal" does not free or save its pointer parameter "cpuinfo".
      /builddir/build/BUILD/libvirt-0.9.10/src/xen/xen_hypervisor.c:2768: leaked_storage: Variable "cpuinfo" going out of scope leaks the storage it points to.
      
      Error: RESOURCE_LEAK:
      /builddir/build/BUILD/libvirt-0.9.10/src/xen/xen_hypervisor.c:2752: alloc_fn: Calling allocation function "fopen".
      /builddir/build/BUILD/libvirt-0.9.10/src/xen/xen_hypervisor.c:2752: var_assign: Assigning: "capabilities" =  storage returned from "fopen("/sys/hypervisor/properties/capabilities", "r")".
      /builddir/build/BUILD/libvirt-0.9.10/src/xen/xen_hypervisor.c:2763: noescape: Variable "capabilities" is not freed or pointed-to in function "xenHypervisorMakeCapabilitiesInternal".
      /builddir/build/BUILD/libvirt-0.9.10/src/xen/xen_hypervisor.c:2574:60: noescape: "xenHypervisorMakeCapabilitiesInternal" does not free or save its pointer parameter "capabilities".
      /builddir/build/BUILD/libvirt-0.9.10/src/xen/xen_hypervisor.c:2768: leaked_storage: Variable "capabilities" going out of scope leaks the storage it points to.
      e91e0ab6
    • O
      Coverity: Fix resource leaks in phyp driver · cff0d342
      Osier Yang 提交于
      Coverity logs:
      
      Error: RESOURCE_LEAK:
      /builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:523: alloc_fn: Calling allocation function "fopen".
      /builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:523: var_assign: Assigning: "fd" =  storage returned from "fopen(local_file, "rb")".
      /builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:540: noescape: Variable "fd" is not freed or pointed-to in function "fread".
      /builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:542: noescape: Variable "fd" is not freed or pointed-to in function "feof".
      /builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:575: leaked_storage: Variable "fd" going out of scope leaks the storage it points to.
      /builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:585: leaked_storage: Variable "fd" going out of scope leaks the storage it points to.
      
      Error: RESOURCE_LEAK:
      /builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:2088: alloc_fn: Calling allocation function "phypVolumeLookupByName".
      /builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:2026: alloc_fn: Storage is returned from allocation function "virGetStorageVol".
      /builddir/build/BUILD/libvirt-0.9.10/src/datatypes.c:724: alloc_arg: "virAlloc" allocates memory that is stored into "ret".
      /builddir/build/BUILD/libvirt-0.9.10/src/util/memory.c:101: alloc_fn: Storage is returned from allocation function "calloc".
      /builddir/build/BUILD/libvirt-0.9.10/src/util/memory.c:101: var_assign: Assigning: "*((void **)ptrptr)" = "calloc(1UL, size)".
      /builddir/build/BUILD/libvirt-0.9.10/src/datatypes.c:753: return_alloc: Returning allocated memory "ret".
      /builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:2026: var_assign: Assigning: "vol" = "virGetStorageVol(pool->conn, pool->name, volname, key)".
      /builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:2030: return_alloc: Returning allocated memory "vol".
      /builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:2088: leaked_storage: Failing to save storage allocated by "phypVolumeLookupByName(pool, voldef->name)" leaks it.
      
      Error: RESOURCE_LEAK:
      /builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:2725: alloc_fn: Calling allocation function "phypGetStoragePoolLookUpByUUID".
      /builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:2689: alloc_fn: Storage is returned from allocation function "virGetStoragePool".
      /builddir/build/BUILD/libvirt-0.9.10/src/datatypes.c:592: alloc_arg: "virAlloc" allocates memory that is stored into "ret".
      /builddir/build/BUILD/libvirt-0.9.10/src/util/memory.c:101: alloc_fn: Storage is returned from allocation function "calloc".
      /builddir/build/BUILD/libvirt-0.9.10/src/util/memory.c:101: var_assign: Assigning: "*((void **)ptrptr)" = "calloc(1UL, size)".
      /builddir/build/BUILD/libvirt-0.9.10/src/datatypes.c:610: return_alloc: Returning allocated memory "ret".
      /builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:2689: var_assign: Assigning: "sp" = "virGetStoragePool(conn, pools[i], uuid)".
      /builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:2694: return_alloc: Returning allocated memory "sp".
      /builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:2725: leaked_storage: Failing to save storage allocated by "phypGetStoragePoolLookUpByUUID(conn, def->uuid)" leaks it.
      
      Error: RESOURCE_LEAK:
      /builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:2719: alloc_fn: Calling allocation function "phypStoragePoolLookupByName".
      /builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:2254: alloc_fn: Storage is returned from allocation function "virGetStoragePool".
      /builddir/build/BUILD/libvirt-0.9.10/src/datatypes.c:592: alloc_arg: "virAlloc" allocates memory that is stored into "ret".
      /builddir/build/BUILD/libvirt-0.9.10/src/util/memory.c:101: alloc_fn: Storage is returned from allocation function "calloc".
      /builddir/build/BUILD/libvirt-0.9.10/src/util/memory.c:101: var_assign: Assigning: "*((void **)ptrptr)" = "calloc(1UL, size)".
      /builddir/build/BUILD/libvirt-0.9.10/src/datatypes.c:610: return_alloc: Returning allocated memory "ret".
      /builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:2254: return_alloc_fn: Directly returning storage allocated by "virGetStoragePool".
      /builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:2719: leaked_storage: Failing to save storage allocated by "phypStoragePoolLookupByName(conn, def->name)" leaks it.
      
      Error: RESOURCE_LEAK:
      /builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:2270: alloc_fn: Calling allocation function "phypStoragePoolLookupByName".
      /builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:2254: alloc_fn: Storage is returned from allocation function "virGetStoragePool".
      /builddir/build/BUILD/libvirt-0.9.10/src/datatypes.c:592: alloc_arg: "virAlloc" allocates memory that is stored into "ret".
      /builddir/build/BUILD/libvirt-0.9.10/src/util/memory.c:101: alloc_fn: Storage is returned from allocation function "calloc".
      /builddir/build/BUILD/libvirt-0.9.10/src/util/memory.c:101: var_assign: Assigning: "*((void **)ptrptr)" = "calloc(1UL, size)".
      /builddir/build/BUILD/libvirt-0.9.10/src/datatypes.c:610: return_alloc: Returning allocated memory "ret".
      /builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:2254: return_alloc_fn: Directly returning storage allocated by "virGetStoragePool".
      /builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:2270: var_assign: Assigning: "sp" =  storage returned from "phypStoragePoolLookupByName(vol->conn, vol->pool)".
      /builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:2324: leaked_storage: Variable "sp" going out of scope leaks the storage it points to.
      /builddir/build/BUILD/libvirt-0.9.10/src/phyp/phyp_driver.c:2327: leaked_storage: Variable "sp" going out of scope leaks the storage it points t
      cff0d342
    • O
      Coverity: Fix the forward_null error in Python binding codes · b80f4db9
      Osier Yang 提交于
      Related coverity log:
      
      Error: FORWARD_NULL:
      /builddir/build/BUILD/libvirt-0.9.10/python/libvirt-override.c:355:
      assign_zero: Assigning: "params" = 0.
      /builddir/build/BUILD/libvirt-0.9.10/python/libvirt-override.c:458:
      var_deref_model: Passing null variable "params" to function
      "getPyVirTypedParameter", which dereferences it. (The dereference is assumed on
      the basis of the 'nonnull' parameter attribute.)
      b80f4db9
    • E
      qemu: avoid 32-bit compiler warning · cdce2f42
      Eric Blake 提交于
      On 32-bit platforms, gcc warns that the comparison between a long
      and (ULLONG_MAX/1024/1024) is always false; throwing in a type
      conversion shuts up the warning.
      
      * src/qemu/qemu_monitor.c (qemuMonitorBlockJob): Shut gcc up.
      cdce2f42
    • S
      build: support libnl-3 · 60fb8a22
      Serge Hallyn 提交于
      configure.ac: check for libnl-3 in addition to libnl-1
      
      src/Makefile.am: link against libnl when needed
      
      src/util/virnetlink.c:
      support libnl3 api.  To minimize impact on code flow, wrap the
      differences under the virNetlink* namespace.
      
      Unfortunately libnl3 moves netlink/msg.h to
      /usr/include/libnl3/netlink/msg.h, so the LIBNL_CFLAGS need to be added
      to a bunch of places where they weren't needed with libnl1.
      Signed-off-by: NSerge Hallyn <serge.hallyn@canonical.com>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      60fb8a22
    • E
      build: fix build on cygwin · c8982638
      Eric Blake 提交于
      On cygwin, <rpc/rpc.h> lives in a different directory than
      /usr/include, so anything that uses it must modify CFLAGS.  This
      previously tripped up just 'make check', but now that we build
      all test programs unconditionally, it also trips up 'make'.
      
      * tests/Makefile.am (virnetmessagetest_CFLAGS): Find rpc headers.
      c8982638
  2. 03 5月, 2012 5 次提交
  3. 02 5月, 2012 3 次提交
    • E
      virsh: output scaled values with correct units · 706aa7c5
      Eric Blake 提交于
      The recent push to use correct scaling terms (kB for 1000, KiB for
      1024 - such as commit 9dfdeadc) missed some places in virsh.
      
      * tools/virsh.c (prettyCapacity, cmdDominfo, cmdFreecell)
      (cmdNodeinfo, cmdNodeMemStats, cmdMigrateSetMaxSpeed)
      (cmdBlockCopy, cmdBlockPull, cmdBlockJob): Use KiB, not kB, when
      referring to multiples of 1024.
      * tests/virshtest.c: Update expected output to match.
      706aa7c5
    • E
      virsh: make -h always give help · 46e5d36b
      Eric Blake 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=817244 mentions that
      unlike most other tools, where --help or --version prevent all
      further parsing of all later options, virsh was strange in that
      --version stopped parsing but --help tried to plow on to the end.
      There was no rationale for this original implementation (since
      2005!), so I think we can safely conform to common usage patterns.
      
      * tools/virsh.c (main): Drop useless 'help' variable.
      46e5d36b
    • L
      build: make ATTRIBUTE_NONNULL() a NOP unless STATIC_ANALYSIS is on · eefb881d
      Laine Stump 提交于
      The ATTRIBUTE_NONNULL(m) macro normally resolves to the gcc builtin
      __attribute__((__nonnull__(m))). The effect of this in gcc is
      unfortunately only to make gcc believe that "m" can never possibly be
      NULL, *not* to add in any checks to guarantee that it isn't ever NULL
      (i.e. it is an optimization aid, *not* something to verify code
      correctness.) - see the following gcc bug report for more details:
      
        http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17308
      
      Static source analyzers such as clang and coverity apparently can use
      ATTRIBUTE_NONNULL(), though, to detect dead code (in the case that the
      arg really is guaranteed non-NULL), as well as situations where an
      obviously NULL arg is given to the function.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=815270 is a good example
      of a bug caused by erroneous application of ATTRIBUTE_NONNULL().
      Several people spent a long time staring at this code and not finding
      the problem, because the problem wasn't in the function itself, but in
      the prototype that specified ATTRIBUTE_NONNULL() for an arg that
      actually *wasn't* always non-NULL, and caused a segv when dereferenced
      (even though the code that dereferenced the pointer was inside an if()
      that checked for a NULL pointer, that code was optimized out by gcc).
      
      There may be some very small gain to be had from the optimizations
      that can be inferred from ATTRIBUTE_NONNULL(), but it seems safer to
      err on the side of generating code that behaves as expected, while
      turning on the attribute for static analyzers.
      eefb881d
  4. 01 5月, 2012 9 次提交
    • D
      Make lxcContainerSetStdio the last thing to be called in container startup · 07cf96ec
      Daniel P. Berrange 提交于
      Once lxcContainerSetStdio is invoked, logging will not work as
      expected in libvirt_lxc. So make sure this is the last thing to
      be called, in particular after setting the security process label
      07cf96ec
    • D
      Ensure logging is initialized early in libvirt_lxc · 43ee9873
      Daniel P. Berrange 提交于
      The virLogSetFromEnv call was done too late in startup to
      catch many log messages (eg from security driver initialization).
      To assist debugging also explicitly log the security details
      at startup
      43ee9873
    • D
      Ensure LXC security driver is set unconditonally · 3746b070
      Daniel P. Berrange 提交于
      The driver->securityDriverName field may be NULL, if automatic
      probing is used to determine security driver. This meant that
      unless selinux was explicitly requested in lxc.conf, it was
      not being sent to the libvirt_lxc process.
      
      The driver->securityManager field is guaranteed non-NULL, since
      there will always be the 'none' security driver present if
      nothing else exists. So use that to set the driver name for
      libvirt_lxc
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      3746b070
    • D
      Ensure libvirt_lxc process loads the live XML config · eb06375a
      Daniel P. Berrange 提交于
      Currently the libvirt_lxc process uses VIR_DOMAIN_XML_INACTIVE
      when loading the XML for the container. This means it loses
      any dynamic data such as the, just allocated, SELinux label.
      
      Further there is an inconsistency in the libvirt LXC driver
      whereby it saves the live config XML and then later overwrites
      the file with the live status XML instead. Add a comment about
      this for future reference.
      
      * src/lxc/lxc_controller.c: Remove VIR_DOMAIN_XML_INACTIVE
        when loading XML
      * src/lxc/lxc_driver.c: Add comment about inconsistent
        config file formats
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      eb06375a
    • E
      maint: avoid false positives on unmarked diagnostics · 8f3728f8
      Eric Blake 提交于
      Otherwise, a string such as _("Don't use \"" VAR "\".") would
      complain about unmarked diagnostics.
      
      * cfg.mk (sc_libvirt_unmarked_diagnostics): Handle \" in message.
      8f3728f8
    • J
      b57e0153
    • J
      qemu: change rbd auth_supported separation character to ; · d50cae33
      Josh Durgin 提交于
      This works with newer qemu that doesn't allow escaping spaces.
      It's backwards compatible as well.
      Signed-off-by: NJosh Durgin <josh.durgin@dreamhost.com>
      d50cae33
    • A
      util: Avoid libvirtd crash in virNetDevTapCreate · 5ee18aaa
      Alex Jia 提交于
      In fact, the 'tapfd' is always NULL, the function 'virNetDevTapCreate()' hasn't
      assign 'fd' to 'tapfd', when the function 'virNetDevSetMAC()' is failed then
      goto 'error' label, finally, the VIR_FORCE_CLOSE() will deref a NULL 'tapfd'.
      
      * util/virnetdevtap.c (virNetDevTapCreateInBridgePort): fix a NULL pointer derefing.
      
      * How to reproduce?
      
      $ cat > /tmp/net.xml <<EOF
      <network>
        <name>test</name>
        <forward mode='nat'/>
        <bridge name='br1' stp='off' delay='1' />
        <mac address='00:00:00:00:00:00'/>
        <ip address='192.168.100.1' netmask='255.255.255.0'>
          <dhcp>
            <range start='192.168.100.2' end='192.168.100.254' />
          </dhcp>
        </ip>
      </network>
      EOF
      
      $ virsh net-define /tmp/net.xml
      
      $ virsh net-start test
      error: Failed to start network brTest
      error: End of file while reading data: Input/output error
      Signed-off-by: NAlex Jia <ajia@redhat.com>
      5ee18aaa
    • E
      storage: fix build with iscsi · 29e702e5
      Eric Blake 提交于
      The previous storage patch missed an instance affected by the struct
      member rename.  It also had some botched whitespace detected by
      'make check'.
      
      * src/storage/storage_backend_iscsi.c
      (virStorageBackendISCSIFindPoolSources): Adjust to new struct.
      * src/conf/storage_conf.c (virStoragePoolSourceFormat): Fix
      indentation.
      29e702e5
  5. 30 4月, 2012 3 次提交
  6. 28 4月, 2012 7 次提交
    • M
      qemu_agent: Report error class at least · 37803108
      Michal Privoznik 提交于
      Currently, qemu GA is not providing 'desc' field for errors like
      we are used to from qemu monitor. Therefore, we fall back to this
      general 'unknown error' string. However, GA is reporting 'class' which
      is not perfect, but much more helpful than generic error string.
      Thus we should fall back to class firstly and if even no class
      is presented, then we can fall back to that generic string.
      
      Before this patch:
      virsh # dompmsuspend --target mem f16
      error: Domain f16 could not be suspended
      error: internal error unable to execute QEMU command
      'guest-suspend-ram': unknown QEMU command error
      
      After this patch:
      virsh # dompmsuspend --target mem f16
      error: Domain f16 could not be suspended
      error: internal error unable to execute QEMU command
      'guest-suspend-ram': The command has not been found
      37803108
    • S
      More coverity findings addressed · 59b935f5
      Stefan Berger 提交于
      More bug extermination in the category of:
      
      Error: CHECKED_RETURN:
      
      /libvirt/src/conf/network_conf.c:595:
      check_return: Calling function "virAsprintf" without checking return value (as is done elsewhere 515 out of 543 times).
      
      /libvirt/src/qemu/qemu_process.c:2780:
      unchecked_value: No check of the return value of "virAsprintf(&msg, "was paused (%s)", virDomainPausedReasonTypeToString(reason))".
      
      /libvirt/tests/commandtest.c:809:
      check_return: Calling function "setsid" without checking return value (as is done elsewhere 4 out of 5 times).
      
      /libvirt/tests/commandtest.c:830:
      unchecked_value: No check of the return value of "virTestGetDebug()".
      
      /libvirt/tests/commandtest.c:831:
      check_return: Calling function "virTestGetVerbose" without checking return value (as is done elsewhere 41 out of 42 times).
      
      /libvirt/tests/commandtest.c:833:
      check_return: Calling function "virInitialize" without checking return value (as is done elsewhere 18 out of 21 times).
      
      
      One note about the error in commandtest line 809: setsid() seems to fail when running the test -- could be removed ?
      59b935f5
    • E
      blockjob: fix block-stream bandwidth race · 2eabac00
      Eric Blake 提交于
      With RHEL 6.2, virDomainBlockPull(dom, dev, bandwidth, 0) has a race
      with non-zero bandwidth: there is a window between the block_stream
      and block_job_set_speed monitor commands where an unlimited amount
      of data was let through, defeating the point of a throttle.
      
      This race was first identified in commit a9d3495e, and libvirt was
      able to reduce the size of the window for that race.  In the meantime,
      the qemu developers decided to fix things properly; per this message:
      https://lists.gnu.org/archive/html/qemu-devel/2012-04/msg03793.html
      the fix will be in qemu 1.1, and changes block-job-set-speed to use
      a different parameter name, as well as adding a new optional parameter
      to block-stream, which eliminates the race altogether.
      
      Since our documentation already mentioned that we can refuse a non-zero
      bandwidth for some hypervisors, I think the best solution is to do
      just that for RHEL 6.2 qemu, so that the race is obvious to the user
      (anyone using stock RHEL 6.2 binaries won't have this patch, and anyone
      building their own libvirt with this patch for RHEL can also rebuild
      qemu to get the modern semantics, so it is no real loss in behavior).
      
      Meanwhile the code must be fixed to honor actual qemu 1.1 naming.
      Rename the parameter to 'modern', since the naming difference now
      covers more than just 'async' block-job-cancel.  And while at it,
      fix an unchecked integer overflow.
      
      * src/qemu/qemu_monitor.h (enum BLOCK_JOB_CMD): Drop unused value,
      rename enum to match conventions.
      * src/qemu/qemu_monitor.c (qemuMonitorBlockJob): Reflect enum rename.
      * src/qemu_qemu_monitor_json.h (qemuMonitorJSONBlockJob): Likewise.
      * src/qemu/qemu_monitor_json.c (qemuMonitorJSONBlockJob): Likewise,
      and support difference between RHEL 6.2 and qemu 1.1 block pull.
      * src/qemu/qemu_driver.c (qemuDomainBlockJobImpl): Reject
      bandwidth during pull with too-old qemu.
      * src/libvirt.c (virDomainBlockPull, virDomainBlockRebase):
      Document this.
      2eabac00
    • S
      lxc: Fix coverity findings · f74471de
      Stefan Berger 提交于
      Error: UNINIT:
      /libvirt/src/lxc/lxc_driver.c:1412:
      var_decl: Declaring variable "fd" without initializer.
      /libvirt/src/lxc/lxc_driver.c:1460:
      uninit_use_in_call: Using uninitialized value "fd" when calling "virFileClose".
      /libvirt/src/util/virfile.c:50:
      read_parm: Reading a parameter value.
      
      Error: DEADCODE:
      /libvirt/src/lxc/lxc_controller.c:960:
      dead_error_condition: On this path, the condition "ret == 4" cannot be true.
      /libvirt/src/lxc/lxc_controller.c:959:
      at_most: After this line, the value of "ret" is at most -1.
      /libvirt/src/lxc/lxc_controller.c:959:
      new_values: Noticing condition "ret < 0".
      /libvirt/src/lxc/lxc_controller.c:961:
      dead_error_line: Execution cannot reach this statement "continue;".
      
      Error: UNINIT:
      /libvirt/src/lxc/lxc_controller.c:1104:
      var_decl: Declaring variable "consoles" without initializer.
      /libvirt/src/lxc/lxc_controller.c:1237:
      uninit_use: Using uninitialized value "consoles".
      f74471de
    • C
      python: Fix doc directory name for stable releases · 002b18b3
      Cole Robinson 提交于
      We were using the libvirt release version (like 0.9.11) and not
      the configure version (which for stable releases is 0.9.11.X)
      
      Most other places got this right so hopefully that's all the fallout
      from the version format change :)
      Signed-off-by: NCole Robinson <crobinso@redhat.com>
      002b18b3
    • C
      docs: Serialize running apibuild.py · c964b6aa
      Cole Robinson 提交于
      Use a witness file approach like we do for python/generator.py,
      as suggested by Eric. Fixes the build issue reported here:
      
      https://www.redhat.com/archives/libvir-list/2012-April/msg01435.htmlSigned-off-by: NCole Robinson <crobinso@redhat.com>
      c964b6aa
    • C
      configure: Use ustar format for dist tarball · ddd6bef4
      Cole Robinson 提交于
      Since for stable releases, some test files were over the 99 char
      limit for traditional tar filenames.
      
      Suggested by Osier here:
      https://www.redhat.com/archives/libvir-list/2012-April/msg01435.htmlSigned-off-by: NCole Robinson <crobinso@redhat.com>
      ddd6bef4
  7. 27 4月, 2012 4 次提交
    • J
      qemu: Use common helper when probing qemu capabilities · 2d76fea1
      Jiri Denemark 提交于
      QEMU binary is called several times when we probe different kinds of
      capabilities the binary supports. This patch introduces new common
      helper so that all probes use a consistent way of invoking qemu.
      2d76fea1
    • E
      qemu: improve errors related to offline domains · 8e532d34
      Eric Blake 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=816662 pointed out
      that attempting 'virsh blockpull' on an offline domain gave a
      misleading error message about qemu lacking support for the
      operation, even when qemu was specifically updated to support it.
      The real problem is that we have several capabilities that are
      only determined when starting a domain, and therefore are still
      clear when first working with an inactive domain (namely, any
      capability set by qemuMonitorJSONCheckCommands).
      
      While this patch was able to hoist an existing check in one of the
      three culprits, it had to add redundant checks in the other two
      places (because you always have to check for an active domain after
      obtaining a VM job lock, but the capability bits were being checked
      prior to obtaining the job lock).
      
      Someday it would be nice to patch libvirt to cache the set of
      capabilities per qemu binary (as determined by inode and timestamp),
      rather than re-probing the binary every time a domain is started,
      and to teach the cache how to query the monitor during the one
      time the probe is made rather than having to wait until a guest
      is started; then, a capability probe would succeed even for offline
      guests because it just refers to the cache, and the single check for
      an active domain after grabbing the job lock would be sufficient.
      But since that will involve a lot more coding, I'm happy to go
      with this simpler solution for an immediate solution.
      
      * src/qemu/qemu_driver.c (qemuDomainPMSuspendForDuration)
      (qemuDomainSnapshotCreateXML, qemuDomainBlockJobImpl): Check for
      offline state before checking an online-only cap.
      8e532d34
    • S
      macvtap: fix a typo · 4bf9061e
      Stefan Berger 提交于
      Below patch fixes the following coverity findings
      
      Error: OVERRUN_STATIC:
      /libvirt/src/qemu/qemu_command.c:152:
      overrun-buffer-val: Overrunning static array "net->mac" of size 6 bytes by passing it as an argument to a function which indexes it at byte position 15.
      /libvirt/src/util/virnetdevmacvlan.c:948:
      access_dbuff_const: Calling "virNetDevMacVLanVPortProfileRegisterCallback" indexes array "macaddress" at byte position 15.
      /libvirt/src/util/virnetdevmacvlan.c:773:
      access_dbuff_const: Calling "memcpy" indexes array "macaddress" with index "16UL" at byte position 15.
      
      Error: OVERRUN_STATIC:
      /libvirt/src/qemu/qemu_migration.c:2744:
      overrun-buffer-val: Overrunning static array "net->mac" of size 6 bytes by passing it as an argument to a function which indexes it at byte position 15.
      /libvirt/src/util/virnetdevmacvlan.c:773:
      access_dbuff_const: Calling "memcpy" indexes array "macaddress" with index "16UL" at byte position 15.
      
      Error: OVERRUN_STATIC:
      /libvirt/src/qemu/qemu_driver.c:435:
      overrun-buffer-val: Overrunning static array "net->mac" of size 6 bytes by passing it as an argument to a function which indexes it at byte position 15.
      /libvirt/src/util/virnetdevmacvlan.c:1036:
      access_dbuff_const: Calling "virNetDevMacVLanVPortProfileRegisterCallback" indexes array "macaddress" at byte position 15.
      /libvirt/src/util/virnetdevmacvlan.c:773:
      access_dbuff_const: Calling "memcpy" indexes array "macaddress" with index "16UL" at byte position 15.
      
      4bf9061e
    • S
      nwfilter: address more coverity findings · 42548fbf
      Stefan Berger 提交于
      This patch addresses the following coverity findings:
      
      /libvirt/src/conf/nwfilter_params.c:390:
      var_assigned: Assigning: "varValue" = null return value from "virHashLookup".
      
      /libvirt/src/conf/nwfilter_params.c:392:
      dereference: Dereferencing a pointer that might be null "varValue" when calling "virNWFilterVarValueGetNthValue".
      
      /libvirt/src/conf/nwfilter_params.c:399:
      dereference: Dereferencing a pointer that might be null "tmp" when calling "virNWFilterVarValueGetNthValue".
      42548fbf