1. 07 5月, 2012 1 次提交
    • J
      qemu: Emit compatible XML when migrating a domain · 409b5f54
      Jiri Denemark 提交于
      When we added the default USB controller into domain XML, we efficiently
      broke migration to older versions of libvirt that didn't support USB
      controllers at all (0.9.4 and earlier) even for domains that don't use
      anything that the older libvirt can't provide. We still want to present
      the default USB controller in any XML seen by a user/app but we can
      safely remove it from the domain XML used during migration. If we are
      migrating to a new enough libvirt, it will add the controller XML back,
      while older libvirt won't be confused with it although it will still
      tell qemu to create the controller.
      
      Similar approach can be used in the future whenever we find out we
      always enabled some kind of device without properly advertising it in
      domain XML.
      409b5f54
  2. 05 5月, 2012 6 次提交
    • J
      qemu: Don't use virDomainDefFormat* directly · cd603008
      Jiri Denemark 提交于
      Always use appropriate qemuDomain{,Def}Format wrapper since it may do
      some additional magic based on the flags.
      cd603008
    • E
      qemu: reject blockiotune if qemu too old · 13f9a193
      Eric Blake 提交于
      Commit 4c82f09e added a capability check for qemu per-device io
      throttling, but only applied it to domain startup.  As mentioned
      in the previous commit (98cec052), the user can still get an 'internal
      error' message during a hotplug attempt, when the monitor command
      doesn't exist.  It is confusing to allow tuning on inactive domains
      only to then be rejected when starting the domain.
      
      * src/qemu/qemu_driver.c (qemuDomainSetBlockIoTune): Reject
      offline tuning if online can't match it.
      13f9a193
    • E
      qemu: don't modify domain on failed blockiotune · 98cec052
      Eric Blake 提交于
      If you have a qemu build that lacks the blockio tune monitor command,
      then this command:
      
      $ virsh blkdeviotune rhel6u2 hda --total_bytes_sec 1000
      error: Unable to change block I/O throttle
      error: internal error Unexpected error
      
      fails as expected (well, the error message is lousy), but the next
      dumpxml shows that the domain was modified anyway.  Worse, that means
      if you save the domain then restore it, the restore will likely fail
      due to throttling being unsupported, even though no throttling should
      even be active because the monitor command failed in the first place.
      
      * src/qemu/qemu_driver.c (qemuDomainSetBlockIoTune): Check for
      error before making modification permanent.
      98cec052
    • L
      util: remove error log from stubs of virNetlinkEventServiceStart|Stop · bae4ff28
      Laine Stump 提交于
      These two functions are called from main() on all platforms, and
      always return success on platforms that don't support libnl. They
      still log an error message, though, which doesn't make sense - they
      should just be NOPs on those platforms. (Per a suggestion during
      review, I've turned the logs into debug messages rather than removing
      them completely).
      bae4ff28
    • S
      node_device: fix possible non-terminated string · 43d1616f
      Stefan Berger 提交于
      Error: STRING_NULL:
      /libvirt/src/node_device/node_device_linux_sysfs.c:80:
      string_null_argument: Function "saferead" does not terminate string "*buf".
      /libvirt/src/util/util.c:101:
      string_null_argument: Function "read" fills array "*buf" with a non-terminated string.
      /libvirt/src/node_device/node_device_linux_sysfs.c:87:
      string_null: Passing unterminated string "buf" to a function expecting a null-terminated string.
      43d1616f
    • S
      uuid: fix possible non-terminated string · b4586051
      Stefan Berger 提交于
      Error: STRING_NULL:
      /libvirt/src/util/uuid.c:273:
      string_null_argument: Function "getDMISystemUUID" does not terminate string "*dmiuuid".
      /libvirt/src/util/uuid.c:241:
      string_null_argument: Function "saferead" fills array "*uuid" with a non-terminated string.
      /libvirt/src/util/util.c:101:
      string_null_argument: Function "read" fills array "*buf" with a non-terminated string.
      /libvirt/src/util/uuid.c:274:
      string_null: Passing unterminated string "dmiuuid" to a function expecting a null-terminated string.
      /libvirt/src/util/uuid.c:138:
      var_assign_parm: Assigning: "cur" = "uuidstr". They now point to the same thing.
      /libvirt/src/util/uuid.c:164:
      string_null_sink_loop: Searching for null termination in an unterminated array "cur".
      b4586051
  3. 04 5月, 2012 10 次提交
    • S
      qemu: fix resource leak · c0774482
      Stefan Berger 提交于
      Error: RESOURCE_LEAK:
      /libvirt/src/qemu/qemu_driver.c:6968:
      alloc_fn: Calling allocation function "calloc".
      /libvirt/src/qemu/qemu_driver.c:6968:
      var_assign: Assigning: "nodeset" =  storage returned from "calloc(1UL, 1UL)".
      /libvirt/src/qemu/qemu_driver.c:6977:
      noescape: Variable "nodeset" is not freed or pointed-to in function "virTypedParameterAssign".
      /libvirt/src/qemu/qemu_driver.c:6997:
      leaked_storage: Variable "nodeset" going out of scope leaks the storage it points to.
      c0774482
    • S
      vmx: fix resource leak · 409a637e
      Stefan Berger 提交于
      Error: RESOURCE_LEAK:
      /libvirt/src/vmx/vmx.c:2431:
      alloc_fn: Calling allocation function "calloc".
      /libvirt/src/vmx/vmx.c:2431:
      var_assign: Assigning: "networkName" =  storage returned from "calloc(1UL, 1UL)".
      /libvirt/src/vmx/vmx.c:2495:
      leaked_storage: Variable "networkName" going out of scope leaks the storage it points to.
      409a637e
    • G
      1cbe658b
    • 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
    • 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
  4. 03 5月, 2012 4 次提交
  5. 02 5月, 2012 1 次提交
    • 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
  6. 01 5月, 2012 8 次提交
    • 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
    • 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
  7. 30 4月, 2012 3 次提交
  8. 28 4月, 2012 4 次提交
    • 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
  9. 27 4月, 2012 3 次提交
    • 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