1. 10 12月, 2010 4 次提交
    • H
      Add a watchdog action `dump' · e19cdbfc
      Hu Tao 提交于
      `dump' watchdog action lets libvirtd to dump the guest when receives a
      watchdog event (which probably means a guest crash)
      
      Currently only qemu is supported.
      e19cdbfc
    • H
      Add a new function doCoreDump · b4560bf2
      Hu Tao 提交于
      This patch prepares for the next patch.
      b4560bf2
    • H
      threadpool impl · 482380b5
      Hu Tao 提交于
      * src/util/threadpool.c, src/util/threadpool.h: Thread pool
        implementation
      * src/Makefile.am: Build thread pool
      * src/libvirt_private.syms: Export public functions
      482380b5
    • E
      command: avoid memory leak · 8e9ee30e
      Eric Blake 提交于
      * src/util/command.c (virCommandRun): Fix yesterday's regression
      on logging, and avoid leaking log-only output captures.
      Reported by Hu Tao.
      8e9ee30e
  2. 09 12月, 2010 4 次提交
    • J
      qemu: Distinguish between domain shutdown and crash · c778fe96
      Jiri Denemark 提交于
      When we get an EOF event on monitor connection, it may be a result of
      either crash or graceful shutdown. QEMU which supports async events
      (i.e., we are talking to it using JSON monitor) emits SHUTDOWN event on
      graceful shutdown. In case we don't get this event by the time monitor
      connection is closed, we assume the associated domain crashed.
      c778fe96
    • R
      qemu: call drive_del in DetachPciDiskDevice · aefaeb3d
      Ryan Harper 提交于
      Currently libvirt doesn't confirm whether the guest has responded to the
      disk removal request.  In some cases this can leave the guest with
      continued access to the device while the mgmt layer believes that it has
      been removed.  With a recent qemu monitor command[1] we can
      deterministically revoke a guests access to the disk (on the QEMU side)
      to ensure no futher access is permitted.
      
      This patch adds support for the drive_del() command and introduces it
      in the disk removal paths.  If the guest is running in a QEMU without this
      command we currently explicitly check for unknown command/CommandNotFound
      and log the issue.
      
      If QEMU supports the command we issue the drive_del command after we attempt
      to remove the device.  The guest may respond and remove the block device
      before we get to attempt to call drive_del.  In that case, we explicitly check
      for 'Device not found' from the monitor indicating that the target drive
      was auto-deleted upon guest responds to the device removal notification.
      
      1. http://thread.gmane.org/gmane.comp.emulators.qemu/84745Signed-off-by: NRyan Harper <ryanh@us.ibm.com>
      aefaeb3d
    • R
      qemu: call drive_unplug in DetachPciDiskDevice · 0cdc9829
      Ryan Harper 提交于
      Currently libvirt doesn't confirm whether the guest has responded to the
      disk removal request.  In some cases this can leave the guest with
      continued access to the device while the mgmt layer believes that it has
      been removed.  With a recent qemu monitor command[1] we can
      deterministically revoke a guests access to the disk (on the QEMU side)
      to ensure no futher access is permitted.
      
      This patch adds support for the drive_unplug() command and introduces it
      in the disk removal paths.  There is some discussion to be had about how
      to handle the case where the guest is running in a QEMU without this
      command (and the fact that we currently don't have a way of detecting
      what monitor commands are available).
      
      Changes since v2:
       - use VIR_ERROR to report when unplug command not found
      Changes since v1:
       - return > 0 when command isn't present, < 0 on command failure
       - detect when drive_unplug command isn't present and log error
         instead of failing entire command
      Signed-off-by: NRyan Harper <ryanh@us.ibm.com>
      0cdc9829
    • A
      qemud: fix memory leak in io error events · 560ed3eb
      Anthony Liguori 提交于
      The extra data isn't being free()'d for IO error events that have a reason.
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      560ed3eb
  3. 08 12月, 2010 9 次提交
    • O
      qemu: Only build devstr when needs (attach PCI controller) · 981f7c8c
      Osier Yang 提交于
      - qemudDomainAttachPciControllerDevice: Don't build "devstr"
        if "-device" of qemu is not available, as "devstr" will only
        be used by "qemuMonitorAddDevice", which depends on "-device"
        argument of qemu is supported.
      
      - "qemudDomainSaveImageOpen": Fix indent problem.
      
      * src/qemu/qemu_driver.c
      981f7c8c
    • J
      qemu: Enable disabled debug messages · e8785146
      Jiri Denemark 提交于
      e8785146
    • J
      qemu: Use -vga none only if it is supported · 2cfb1079
      Jiri Denemark 提交于
      Commit febc5916 introduced -vga none in
      case no video card is included in domain XML. However, old qemu
      versions do not support this and such domain cannot be successfully
      started.
      2cfb1079
    • E
      maint: update to latest gnulib · 8f636752
      Eric Blake 提交于
      * .gnulib: Update to latest, for at least a stdint.h fix
      * src/storage/storage_driver.c (storageVolumeZeroSparseFile)
      (storageWipeExtent): Use better type, although it still triggers
      spurious -Wformat warning on MacOS's gcc.
      8f636752
    • E
      openvz: avoid potential buffer overflow · a0ac00f4
      Eric Blake 提交于
      * src/openvz/openvz_conf.c (openvzLoadDomains): Replace unsafe
      sscanf with safe direct parsing.
      (openvzGetVEID): Avoid lost integer overflow detection.
      (openvzAssignUUIDs): Likewise, and detect readdir failure.
      a0ac00f4
    • E
      openvz: convert popen to virCommand · bfd6267b
      Eric Blake 提交于
      popen must be matched with pclose (not fclose), or it will leak
      resources.  Furthermore, it is a lousy interface when it comes to
      signal handling.  We're much better off using our decent command
      wrapper.  Note that virCommand guarantees that VIR_FREE(outbuf) is
      both required and safe to call, whether virCommandRun succeeded or
      failed.
      
      * src/openvz/openvz_conf.c (openvzLoadDomains, openvzGetVEID):
      Replace popen with virCommand usage.
      bfd6267b
    • E
      command: improve behavior on no output · cc5e2a84
      Eric Blake 提交于
      Guarantee that outbuf/errbuf are allocated on success, even if to the
      empty string.  Caller always has to free the result, and empty output
      check requires checking if *outbuf=='\0'.  Makes the API easier to use
      safely.  Failure is best effort allocation (some paths, like
      out-of-memory, cannot allocate a buffer, but most do), so caller must
      free buffer on failure.
      
      * docs/internals/command.html.in: Update documentation.
      * src/util/command.c (virCommandSetOutputBuffer)
      (virCommandSetErrorBuffer, virCommandProcessIO) Guarantee empty
      string on no output.
      * tests/commandtest.c (test17): New test.
      cc5e2a84
    • E
      command: enforce fd vs. buffer considerations · ee11729d
      Eric Blake 提交于
      * docs/internals/command.html.in: Better documentation of buffer
      vs. fd considerations.
      * src/util/command.c (virCommandRunAsync): Reject raw execution
      with string io.
      (virCommandRun): Reject execution with user-specified fds not
      visiting a regular file.
      ee11729d
    • E
      command: improve allocation failure reporting · c426d13b
      Eric Blake 提交于
      * src/util/command.c (virCommandAddEnvString): Remove duplicate
      code.
      (virCommandToString, virCommandRun, virCommandRunAsync)
      (virCommandWait): Report NULL command as ENOMEM, not invalid
      usage.
      Reported by Jiri Denemark.
      c426d13b
  4. 07 12月, 2010 6 次提交
    • E
      uuid: require smbios uuid and domain uuid to match · 4117672e
      Eric Blake 提交于
      * src/conf/domain_conf.c (virDomainDefParseXML): Prefer sysinfo
      uuid over generating one, and if both uuids are present, require
      them to be identical.
      * src/qemu/qemu_conf.c (qemuBuildSmbiosSystemStr): Allow skipping
      the uuid.
      (qemudBuildCommandLine): Adjust caller; <smbios mode=host/> must
      not use host uuid in place of guest uuid.
      4117672e
    • E
      smbios: support system family · 8cad5603
      Eric Blake 提交于
      * docs/schemas/domain.rng (sysinfo-system-name): Also allow
      family.
      * src/util/sysinfo.h (struct _virSysinfoDef): Add system_family.
      * src/conf/domain_conf.c (virSysinfoParseXML)
      (virDomainSysinfoDefFormat): Support it.
      * src/util/sysinfo.c (virSysinfoDefFree, virSysinfoRead): Likewise.
      * src/qemu/qemu_conf.c (qemuBuildSmbiosSystemStr): Likewise.
      * tests/qemuxml2argvdata/qemuxml2argv-smbios.xml: Adjust test.
      * tests/qemuxml2argvdata/qemuxml2argv-smbios.args: Likewise.
      8cad5603
    • E
      qemu: avoid adding "" in smbios arguments · 575914cf
      Eric Blake 提交于
      The log lists things like -smbios type=1,vendor="Red Hat", which
      is great for shell parsing, but not so great when you realize that
      execve() then passes those literal "" on as part of the command
      line argument, such that qemu sets SMBIOS with extra literal quotes.
      
      The eventual addition of virCommand is needed before we have the API
      to shell-quote a string representation of a command line, so that the
      log can still be pasted into a shell, but without inserting extra
      bytes into the execve() arguments.
      
      * src/qemu/qemu_conf.c (qemuBuildSmbiosBiosStr)
      (qemuBuildSmbiosSystemStr): Qemu doesn't like quotes around uuid
      arguments, and the remaining quotes are passed literally to
      smbios, making <smbios mode='host'/> inaccurate.  Removing the
      quotes makes the log harder to parse, but that can be fixed later
      with virCommand improvements.
      * tests/qemuxml2argvdata/qemuxml2argv-smbios.args: 'Fix' test; it
      will need fixing again once virCommand learns how to shell-quote a
      potential command line.
      575914cf
    • D
      Fix funny off-by-one error in clock-variable · e37ff200
      Dan Kenigsberg 提交于
      Humans consider January as month #1, while gmtime_r(3) calls it month #0.
      
      While fixing it, render qemu's rtc parameter with leading zeros, as is more
      commonplace.
      
      Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=660194
      e37ff200
    • E
      threads: add virThreadID for debugging use · e4bc372e
      Eric Blake 提交于
      * src/util/threads.h (virThreadID): New prototype.
      * src/util/threads-pthread.c (virThreadID): New function.
      * src/util/threads-win32.c (virThreadID): Likewise.
      * src/libvirt_private.syms (threads.h): Export it.
      * daemon/event.c (virEventInterruptLocked): Use it to avoid
      warning on BSD systems.
      e4bc372e
    • O
      util: Fix bug which will cause libvirtd crash · 85ccf42c
      Osier Yang 提交于
      "virCommandRun": if "cmd->outbuf" or "cmd->errbuf" is NULL,
      libvirtd will be crashed when trying to start a qemu domain
      (which invokes "virCommandRun"), it caused by we try to use
      "*cmd->outbuf" and "*cmd->errbuf" regardless of cmd->outbuf
      or cmd->errbuf is NULL.
      
      * src/util/command.c (virCommandRun)
      85ccf42c
  5. 06 12月, 2010 2 次提交
    • J
      qemu: Fix a possible deadlock in p2p migration · 584c13f3
      Jiri Denemark 提交于
      Two more calls to remote libvirtd have to be surrounded by
      qemuDomainObjEnterRemoteWithDriver() and
      qemuDomainObjExitRemoteWithDriver() to prevent possible deadlock between
      two communicating libvirt daemons.
      
      See commit f0c8e1cb for further details.
      584c13f3
    • J
      Change return value of VIR_DRV_SUPPORTS_FEATURE to bool · 4186f929
      Jiri Denemark 提交于
      virDrvSupportsFeature API is allowed to return -1 on error while all but
      one uses of VIR_DRV_SUPPORTS_FEATURE only check for (non)zero return
      value. Let's make this macro return zero on error, which is what
      everyone expects anyway.
      4186f929
  6. 05 12月, 2010 1 次提交
  7. 04 12月, 2010 1 次提交
  8. 03 12月, 2010 8 次提交
    • J
      Create file in virFileWriteStr() if it doesn't exist · 966a1bfe
      Jean-Baptiste Rouault 提交于
      This patch adds a mode_t parameter to virFileWriteStr().
      If mode is different from 0, virFileWriteStr() will try
      to create the file if it doesn't exist.
      
      * src/util/util.h (virFileWriteStr): Alter signature.
      * src/util/util.c (virFileWriteStr): Allow file creation.
      * src/network/bridge_driver.c (networkEnableIpForwarding)
      (networkDisableIPV6): Adjust clients.
      * src/node_device/node_device_driver.c
      (nodeDeviceVportCreateDelete): Likewise.
      * src/util/cgroup.c (virCgroupSetValueStr): Likewise.
      * src/util/pci.c (pciBindDeviceToStub, pciUnBindDeviceFromStub):
      Likewise.
      966a1bfe
    • D
      Remove bogus includes · 70256860
      Daniel P. Berrange 提交于
      70256860
    • D
      uml: convert to virCommand · 98c379b3
      Daniel P. Berrange 提交于
      * src/uml/uml_conf.c (umlBuildCommandLineChr)
      (umlBuildCommandLine): Rewrite with virCommand.
      * src/uml/uml_conf.h (umlBuildCommandLine): Update signature.
      * src/uml/uml_driver.c (umlStartVMDaemon): Adjust caller.
      98c379b3
    • E
      qemu: convert to virCommand · 6a7e7c4f
      Eric Blake 提交于
      * src/qemu/qemu_conf.c (qemudExtractVersionInfo): Check for file
      before executing it here, rather than in callers.
      (qemudBuildCommandLine): Rewrite with virCommand.
      * src/qemu/qemu_conf.h (qemudBuildCommandLine): Update signature.
      * src/qemu/qemu_driver.c (qemuAssignPCIAddresses)
      (qemudStartVMDaemon, qemuDomainXMLToNative): Adjust callers.
      6a7e7c4f
    • D
      Port hooks and iptables code to new command execution APIs · 3709a386
      Daniel P. Berrange 提交于
      This proof of concept shows how two existing uses of virExec
      and virRun can be ported to the new virCommand APIs, and how
      much simpler the code becomes
      3709a386
    • D
      Introduce new APIs for spawning processes · f16ad06f
      Daniel P. Berrange 提交于
      This introduces a new set of APIs in src/util/command.h
      to use for invoking commands. This is intended to replace
      all current usage of virRun and virExec variants, with a
      more flexible and less error prone API.
      
      * src/util/command.c: New file.
      * src/util/command.h: New header.
      * src/Makefile.am (UTIL_SOURCES): Build it.
      * src/libvirt_private.syms: Export symbols internally.
      * tests/commandtest.c: New test.
      * tests/Makefile.am (check_PROGRAMS): Run it.
      * tests/commandhelper.c: Auxiliary program.
      * tests/commanddata/test2.log - test15.log: New expected outputs.
      * cfg.mk (useless_free_options): Add virCommandFree.
      (msg_gen_function): Add virCommandError.
      * po/POTFILES.in: New translation.
      * .x-sc_avoid_write: Add exemption.
      * tests/.gitignore: Ignore new built file.
      f16ad06f
    • E
      util: add virVasprintf · fce3baee
      Eric Blake 提交于
      * src/util/util.h (virVasprintf): New declaration.
      * src/util/util.c (virVasprintf): New function.
      (virAsprintf): Use it.
      * src/util/virtaudit.c (virAuditSend): Likewise.
      * src/libvirt_private.syms: Export it.
      * cfg.mk (sc_prohibit_asprintf): Also prohibit vasprintf.
      * .x-sc_prohibit_asprintf: Add exemption.
      fce3baee
    • E
      util: fix saferead type · dbab6bb5
      Eric Blake 提交于
      * src/util/util.c (saferead): Fix return type.
      (safewrite): Fix indentation.
      dbab6bb5
  9. 02 12月, 2010 5 次提交
    • D
      Fix memory leak in logging setup · c846bc9e
      Daniel P. Berrange 提交于
      The logging setup requires const char * strings, but the
      virLogSetFromEnv() strdup's the env variables, thus causing
      a memory leak
      
      * src/util/logging.c: Avoid strdup'ing env variables
      c846bc9e
    • G
      OpenVZ: drop fd leackage · fab5a25c
      Guido Günther 提交于
      Drop unused (and unclosed) errfd and close outfd on exit. Otherwise
      polling the running domains with virt-manager let's us quickly run out
      of fds.
      fab5a25c
    • O
      qemu: Use macro for max and min vnc port instead of number · 401979a4
      Osier Yang 提交于
      * src/qemu/qemu_driver.c (though MACROS QEMU_VNC_PORT_MAX, and
      QEMU_VNC_PORT_MIN are defined at the beginning, numbers (65535, 5900)
      are still used, replace them)
      401979a4
    • O
      qemu: Fix typo in qemuTeardownDiskPathDeny · ead3c434
      Osier Yang 提交于
      typo in error message, it should be by copy-a-paste
      from "qemuSetupDiskPathAllow".
      
      * src/qemu/qemu_driver.c (qemuTeardownDiskPathDeny)
      ead3c434
    • E
      qemu: plug memory leak · 428ea3a6
      Eric Blake 提交于
      * src/qemu/qemu_driver.c (qemudShutdown): Free all strings and the
      ebtables structure.
      * src/libvirt_private.syms (ebtablesContextFree): Export missing
      symbol.
      * src/util/ebtables.c (ebtablesContextFree): Allow early exit.
      428ea3a6