1. 06 7月, 2011 1 次提交
    • G
      pci: initialize state values on reattach · 416814e6
      Guannan Ren 提交于
      add a new API pciDeviceReAttachInit() in pci.c to initialize state values for nodedev reattach
      
      Initialize three state value of device driver to 1. This is just for a new call to
      qemudNodeDeviceReAttach()
      416814e6
  2. 04 7月, 2011 1 次提交
    • E
      cgroup: silence coverity warning · 3f81f8e4
      Eric Blake 提交于
      Coverity noted that most clients reacted to failure to hash; but in
      a best-effort kill loop, we can ignore failure.
      
      * src/util/cgroup.c (virCgroupKillInternal): Ignore hash failure.
      3f81f8e4
  3. 02 7月, 2011 3 次提交
    • E
      pci: avoid memory leak on error · 95eaf7ba
      Eric Blake 提交于
      Detected by Coverity.  Some, but not all, error paths were clean;
      but they were repetitive so I refactored them.
      
      * src/util/pci.c (pciGetDevice): Plug leak.
      95eaf7ba
    • E
      interface: avoid memory leak on parse error · 9e8b7c15
      Eric Blake 提交于
      Detected by Coverity.  Unlikely to hit unless the file contents
      were corrupted.
      
      * src/util/interface.c (ifaceRestoreMacAddress): Plug leak.
      9e8b7c15
    • E
      util: choose whether to require micro in version strings · 8ce1afff
      Eric Blake 提交于
      To avoid regressions, we let callers specify whether to require a
      minor and micro version.  Callers that were parsing uname() output
      benefit from defaulting to 0, whereas callers that were parsing
      version strings from other sources should not change in behavior.
      
      * src/util/util.c (virParseVersionString): Allow caller to choose
      whether to fail if minor or micro is missing.
      * src/util/util.h (virParseVersionString): Update signature.
      * src/esx/esx_driver.c (esxGetVersion): Update callers.
      * src/lxc/lxc_driver.c (lxcVersion): Likewise.
      * src/openvz/openvz_conf.c (openvzExtractVersionInfo): Likewise.
      * src/uml/uml_driver.c (umlGetVersion): Likewise.
      * src/vbox/vbox_MSCOMGlue.c (vboxLookupVersionInRegistry):
      Likewise.
      * src/vbox/vbox_tmpl.c (vboxExtractVersion): Likewise.
      * src/vmware/vmware_conf.c (vmwareExtractVersion): Likewise.
      * src/xenapi/xenapi_driver.c (xenapiGetVersion): Likewise.
      Reported by Matthias Bolte.
      8ce1afff
  4. 01 7月, 2011 3 次提交
  5. 29 6月, 2011 5 次提交
    • M
      sysinfo: fix illegal NULL return · 72882bc9
      Minoru Usui 提交于
      If virSysinfoParse{BIOS,System,Processor,Memory}()
      can't find newline('\n'), these return NULL.
      This patch fixes this.
      Signed-off-by: NMinoru Usui <usui@mxm.nes.nec.co.jp>
      72882bc9
    • M
      dnsmasq: Fix errno handling and don't unlink non-existing files · 8cce5436
      Matthias Bolte 提交于
      addnhostsSave and hostsfileSave expect < 0 return value on error from
      addnhostsWrite and hostsfileWrite but then pass err instead of -err
      to virReportSystemError that expects an errno value.
      
      Also addnhostsWrite returns -ENOMEM and errno, change this to -errno.
      
      addnhostsWrite and hostsfileWrite tried to unlink the tempfile after
      renaming it, making both fail on the final step. Remove the unnecessary
      unlink calls.
      8cce5436
    • M
      eb9dee2b
    • M
      network: Fix dnsmasq hostsfile creation logic and related tests · 9523b3c3
      Matthias Bolte 提交于
      networkSaveDnsmasqHostsfile was added in 8fa9c221 (Apr 2010).
      It has a force flag. If the dnsmasq hostsfile already exists force
      needs to be true to overwrite it. networkBuildDnsmasqArgv sets force
      to false, networkDefine sets it to true. This results in the
      hostsfile being written only in networkDefine in the common case.
      If no error occurred networkSaveDnsmasqHostsfile returns true and
      networkBuildDnsmasqArgv adds the --dhcp-hostsfile to the dnsmasq
      command line.
      
      networkSaveDnsmasqHostsfile was changed in 89ae9849 (24 Jun 2011)
      to return a new dnsmasqContext instead of reusing one. This change broke
      the logic of the force flag as now networkSaveDnsmasqHostsfile returns
      NULL on error, but the early return -- if force was not set and the
      hostsfile exists -- returns 0. This turned the early return in an error
      case and networkBuildDnsmasqArgv didn't add the --dhcp-hostsfile option
      anymore if the hostsfile already exists. It did because networkDefine
      created the hostsfile already.
      
      Then 9d4e2845 fixed the return 0 case in networkSaveDnsmasqHostsfile
      but didn't apply the force option correctly to the new addnhosts file.
      Now force doesn't control an early return anymore, but influences the
      handling of the hostsfile context creation and dnsmasqSave is always
      called now. This commit also added test cases that reveal several
      problems. First, the tests now calls functions that try to write the
      dnsmasq config files to disk. If someone runs this tests as root this
      might overwrite actively used dnsmasq config files, this is a no-go. Also
      the tests depend on configure --localstatedir, this needs to be fixed as
      well, because it makes the tests fail when localstatedir is different
      from /var.
      
      This patch does several things to fix this:
      
      1) Move dnsmasqContext creation and saving out of networkBuildDnsmasqArgv
      to the caller to separate the command line generation from the config
      file writing. This makes the command line generation testable without the
      risk of interfering with system files, because the tests just don't call
      dnsmasqSave.
      
      2) This refactoring of networkSaveDnsmasqHostsfile makes the force flag
      useless as the saving happens somewhere else now. This fixes the wrong
      usage of the force flag in combination with then newly added addnhosts
      file by removing the force flag.
      
      3) Adapt the wrong test cases to the correct behavior, by adding the
      missing --dhcp-hostsfile option. Both affected tests contain DHCP host
      elements but missed the necessary --dhcp-hostsfile option.
      
      4) Rename networkSaveDnsmasqHostsfile to networkBuildDnsmasqHostsfile,
      because it doesn't save the dnsmasqContext anymore.
      
      5) Move all directory creations in dnsmasq context handling code from
      the *New functions to dnsmasqSave to avoid directory creations in system
      paths in the test cases.
      
      6) Now that networkBuildDnsmasqArgv doesn't create the dnsmasqContext
      anymore the test case can create one with the localstatedir that is
      expected by the tests instead of the configure --localstatedir given one.
      9523b3c3
    • E
      sysinfo: fix parsing regression · c8eaba64
      Eric Blake 提交于
      Detected by gcc -O2, introduced in commit 532ce9c2.  If dmidecode
      outputs a field unrecognized by the parsers, then the code would
      dereference an uninitialized eol variable.
      
      * src/util/sysinfo.c (virSysinfoParseBIOS)
      (virSysinfoParseSystem, virSysinfoParseProcessor)
      (virSysinfoParseMemory): Avoid uninitialized variable.
      c8eaba64
  6. 27 6月, 2011 2 次提交
  7. 25 6月, 2011 3 次提交
  8. 24 6月, 2011 3 次提交
  9. 23 6月, 2011 7 次提交
    • S
      build: fix compilation on systems missing libnl and new includes · f7ed6936
      Stefan Berger 提交于
      This patch fixes the compilation of netlink.c and interface.c on those
      systems missing either libnl or that have an older linux/if_link.h
      include file not supporting macvtap or VF_PORTS.
      
      WITH_MACVTAP is '1' if newer include files were detected, '0' otherwise.
      
      IFLA_PORT_MAX is defined in linux/if_link.h if yet more functionality is
      supported.
      f7ed6936
    • O
      util: Fix memory leak in virJSONParserHandleStartMap · 91141474
      Osier Yang 提交于
      91141474
    • E
      util: avoid PATH_MAX-sized array · 60bfd5b5
      Eric Blake 提交于
      See previous patch for why this is good...
      
      * src/util/pci.c (struct _pciDevice, pciGetDevice, pciFreeDevice):
      Manage path dynamically.  Report snprintf overflow.
      * src/util/hostusb.c (struct _usbDevice, usbGetDevice)
      (usbFreeDevice): Likewise.
      60bfd5b5
    • E
      maint: add omitted copyright header · 26dc216a
      Eric Blake 提交于
      Bug introduced in commit 6a597883.
      
      * src/util/netlink.h: Add boilerplate.
      26dc216a
    • S
      cleanup: make several interface functions commonly available · df3d8c36
      Stefan Berger 提交于
      In a second cleanup step this patch makes several interface functions from macvtap.c commonly available by moving them into interface.c and prefixing their names with 'iface'. Those functions taking Linux-specific structures as parameters are only visible on Linux.
      
      ifaceRestoreMacAddress returns the return code from the ifaceSetMacAddr call and display an error message if setting the MAC address did not work. The caller is unchanged and still ignores the return code (which is ok).
      df3d8c36
    • S
      cleanup: make nlComm commonly available · 6a597883
      Stefan Berger 提交于
      In a first cleanup step, make nlComm from macvtap.c commonly available
      for other code to use. Since nlComm uses Linux-specific structures as
      parameters it's prototype is only visible on Linux.
      6a597883
    • D
      Remove macvtap dependency on domain configuration · caf808c7
      Daniel P. Berrange 提交于
      Files under src/util must not depend on src/conf
      Solve the macvtap problem by moving the definition
      of macvtap modes from domain_conf.h into macvtap.h
      
      * src/util/macvtap.c, src/util/macvtap.h: Add enum
        for macvtap modes
      * src/conf/domain_conf.c, src/conf/domain_conf.h: Remove
        enum for macvtap modes
      caf808c7
  10. 22 6月, 2011 1 次提交
  11. 21 6月, 2011 3 次提交
    • D
      set and restore MAC address of a NIC when using PASSTHROUGH mode · cbd8227e
      Dirk Herrendoerfer 提交于
      The following patch addresses the problem that when a PASSTHROUGH
      mode DIRECT NIC connection is made the MAC address of the NIC is
      not automatically set and reset to the configured VM MAC and
      back again.
      
      The attached patch fixes this problem by setting and resetting the MAC
      while remembering the previous setting while the VM is running.
      This also works if libvirtd is restarted while the VM is running.
      
      the patch passes make syntax-check
      cbd8227e
    • C
      events: Correct virEventAddTimeout docs · 27e47955
      Cole Robinson 提交于
      27e47955
    • C
      Promote virEvent*Handle/Timeout to public API · 6094ad7b
      Cole Robinson 提交于
      Since we virEventRegisterDefaultImpl is now a public API, callers need
      a way to invoke the default registered Handle and Timeout functions. We
      already have general functions for these internally, so promote
      them to the public API.
      
      v2:
          Actually add APIs to libvirt.h
      6094ad7b
  12. 17 6月, 2011 1 次提交
    • D
      Fix errno return in safezero() · a8182206
      Daniel P. Berrange 提交于
      Most of the safezero() implementations return -1 on error,
      setting errno. The safezero() impl using posix_fallocate()
      though returned a positive errno value on error (due to
      the unusual API contract of posix_fallocate() compared to
      most syscall APIs).
      
      * src/util/util.c: Ensure safezero() returns -1 and sets
        errno on error.
      * src/storage/storage_backend.c: Change safezero != 0 to
        < 0 for detecting errors
      a8182206
  13. 14 6月, 2011 4 次提交
    • E
      command: avoid double close · f3d67544
      Eric Blake 提交于
      Previously, the parent process opened 'null' to /dev/null, then
      the child process closes 'null' as well as 'childout'.  But if
      childout was set to be null, then this is a double close.  At
      least the double close was confined to the child process after a
      fork, and therefore there is no risk of another thread opening
      an fd of the same value to be bitten by the double close, but it
      is always better to avoid double-close to begin with.
      
      Additionally, if all three fds were specified, then opening
      'null' was wasted.
      
      This patch fixes things to lazily open null on the first use,
      then guarantees it gets closed exactly once.
      
      * src/util/command.c (getDevNull): New helper function.
      (virExecWithHook): Use it to avoid spurious opens and double close.
      f3d67544
    • E
      command: reduce duplicated debug messages · c668c897
      Eric Blake 提交于
      This also reduces malloc pressure for invoking a child when
      VIR_DEBUG is enabled.
      
      * src/util/command.c (virExecWithHook): Drop debug, since the only
      caller (virCommandRunAsync) also prints debug info.
      c668c897
    • O
      util: Cleanup indention problem in virterror.c · e22a6e9d
      Osier Yang 提交于
      Push under trivial rule.
      e22a6e9d
    • S
      qemu: Faster response time to qemu startup errors · f5358fdc
      Stefan Berger 提交于
      The below patch decreases the response time of libvirt to errors reported by Qemu upon startup by checking whether the qemu process is still alive while polling for the local socket to show up.
      
      This patch also introduces a special handling of signal for the Win32 part of virKillProcess.
      f5358fdc
  14. 13 6月, 2011 2 次提交
  15. 08 6月, 2011 1 次提交
    • E
      uuid: annotate non-null requirements · 208a6756
      Eric Blake 提交于
      Coverity already saw through a NULL dereference without these
      annotations, and gcc is still too puny to do good NULL analysis.
      But clang still benefits (and is easier to run than coverity),
      not to mention that adding this bit of documentation to the code
      may help future developers remember the constraints.
      
      * src/util/uuid.h (virGetHostUUID, virUUIDFormat): Document
      restrictions, for improved static analysis.
      208a6756