1. 07 12月, 2010 5 次提交
    • 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
  2. 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
  3. 05 12月, 2010 1 次提交
  4. 04 12月, 2010 1 次提交
  5. 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
  6. 02 12月, 2010 7 次提交
    • 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
    • D
      Fix flaw in thread creation APIs · 9c656092
      Daniel P. Berrange 提交于
      The arguments passed to the thread function must be allocated on
      the heap, rather than the stack, since it is possible for the
      spawning thread to continue before the new thread runs at all.
      In such a case, it is possible that the area of stack where the
      thread args were stored is overwritten.
      
      * src/util/threads-pthread.c, src/util/threads-win32.c: Allocate
        thread arguments on the heap
      9c656092
    • M
      Fix undefined symbol errors when macvtap support is disabled · 474b1c14
      Matthias Bolte 提交于
      Use macvtap specific functions depending on WITH_MACVTAP.
      
      Use #if instead of #ifdef to check for WITH_MACVTAP, because
      WITH_MACVTAP is always defined with value 0 or 1.
      
      Also export virVMOperationType{To|From}String unconditional,
      because they are used unconditional in the domain config code.
      474b1c14
  7. 01 12月, 2010 6 次提交
    • J
      Fix warning when macvtap support is disabled · 45147ca3
      Jean-Baptiste Rouault 提交于
      45147ca3
    • J
      72bce49d
    • H
      Fall back to QEMUD_SAVE_FORMAT_RAW if compression method fails. · 1b6f13bb
      Hu Tao 提交于
      When dumping a domain, it's reasonable to save dump-file in raw format
      if dump format is misconfigured or the corresponding compress program
      is not available rather then fail dumping.
      1b6f13bb
    • S
      802.1Qbg: use pre-associate state at beginning of inc. migr · c2b38277
      Stefan Berger 提交于
      This patch introduces the usage of the pre-associate state of the IEEE 802.1Qbg standard on incoming VM migration on the target host. It is in response to bugzilla entry 632750.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=632750
      
      For being able to differentiate the exact reason as to why a macvtap device is being created, either due to a VM creation or an incoming VM migration, I needed to pass that reason as a parameter from wherever qemudStartVMDaemon is being called in order to determine whether to send an ASSOCIATE (VM creation) or a PRE-ASSOCIATE (incoming VM migration) towards lldpad.
      
      I am also fixing a problem with the virsh domainxml-to-native call on the way.
      
      Gerhard successfully tested the patch with a recent blade network 802.1Qbg-compliant switch.
      
      The patch should not have any side-effects on the 802.1Qbh support in libvirt, but Roopa (cc'ed) may want to verify this.
      c2b38277
    • G
      OpenVZ: Fix some overwritten error codes · 2d626c7d
      Guido Günther 提交于
      Don't overwrite errors during domain creation/definition to ease
      tracking down problems.
      2d626c7d
    • G
      OpenVZ: take veid from vmdef->name when defining new domains · 50a7c59b
      Guido Günther 提交于
      We currently use the next free veid although there's one given in the
      domain xml. This currently breaks defining new domains since vmdef->name
      and veid don't match leading to the following error later on:
      
          error: Failed to define domain from 110.xml
          error: internal error Could not set UUID
      
      Since silently ignoring vmdef->name is not nice respect it instead. We
      avoid veid collisions in the upper levels already.
      50a7c59b
  8. 30 11月, 2010 2 次提交
    • M
      Log client errors in libvirtd at debug priority · abff683f
      Matthias Bolte 提交于
      This reverts commit
      
       Log all errors at level INFO to stop polluting syslog
       04bd0360.
      
      and makes virRaiseErrorFull() log errors at debug priority
      when called from inside libvirtd. This stops libvirtd from
      polluting it's own log with client errors at error priority
      that'll be reported and logged on the client side anyway.
      abff683f
    • W
      correct the arguments of migrate_speed · 4f7162d1
      Wen Congyang 提交于
      When we set migrate_speed by json, we receive the following
      error message:
      libvirtError: internal error unable to execute QEMU command
      'migrate_set_speed': Invalid parameter type, expected: number
      
      The reason is that: the arguments of migrate_set_speed
      by json is json number, not json string.
      Signed-off-by: NWen Congyang <wency@cn.fujitsu.com>
      4f7162d1
  9. 29 11月, 2010 1 次提交
  10. 25 11月, 2010 7 次提交
    • J
      Fix host CPU counting on unusual NUMA topologies · ac9dd4a6
      Jiri Denemark 提交于
      The nodeinfo structure includes
      
          nodes   : the number of NUMA cell, 1 for uniform mem access
          sockets : number of CPU socket per node
          cores   : number of core per socket
          threads : number of threads per core
      
      which does not work well for NUMA topologies where each node does not
      consist of integral number of CPU sockets.
      
      We also have VIR_NODEINFO_MAXCPUS macro in public libvirt.h which
      computes maximum number of CPUs as (nodes * sockets * cores * threads).
      
      As a result, we can't just change sockets to report total number of
      sockets instead of sockets per node. This would probably be the easiest
      since I doubt anyone is using the field directly. But because of the
      macro, some apps might be using sockets indirectly.
      
      This patch leaves sockets to be the number of CPU sockets per node (and
      fixes qemu driver to comply with this) on machines where sockets can be
      divided by nodes. If we can't divide sockets by nodes, we behave as if
      there was just one NUMA node containing all sockets. Apps interested in
      NUMA should consult capabilities XML, which is what they probably do
      anyway.
      
      This way, the only case in which apps that care about NUMA may break is
      on machines with funky NUMA topology. And there is a chance libvirt
      wasn't able to start any guests on those machines anyway (although it
      depends on the topology, total number of CPUs and kernel version).
      Nothing changes at all for apps that don't care about NUMA.
      ac9dd4a6
    • E
      security, storage: plug memory leaks for security_context_t · d95488dc
      Eric Blake 提交于
      security_context_t happens to be a typedef for char*, and happens to
      begin with a string usable as a raw context string.  But in reality,
      it is an opaque type that may or may not have additional information
      after the first NUL byte, where that additional information can
      include pointers that can only be freed via freecon().
      
      Proof is from this valgrind run of daemon/libvirtd:
      
      ==6028== 839,169 (40 direct, 839,129 indirect) bytes in 1 blocks are definitely lost in loss record 274 of 274
      ==6028==    at 0x4A0515D: malloc (vg_replace_malloc.c:195)
      ==6028==    by 0x3022E0D48C: selabel_open (label.c:165)
      ==6028==    by 0x3022E11646: matchpathcon_init_prefix (matchpathcon.c:296)
      ==6028==    by 0x3022E1190D: matchpathcon (matchpathcon.c:317)
      ==6028==    by 0x4F9D842: SELinuxRestoreSecurityFileLabel (security_selinux.c:382)
      
      800k is a lot of memory to be leaking.
      
      * src/storage/storage_backend.c
      (virStorageBackendUpdateVolTargetInfoFD): Avoid leak on error.
      * src/security/security_selinux.c
      (SELinuxReserveSecurityLabel, SELinuxGetSecurityProcessLabel)
      (SELinuxRestoreSecurityFileLabel): Use correct function to free
      security_context_t.
      d95488dc
    • E
      network: plug memory leak · d90babe9
      Eric Blake 提交于
      * src/conf/network_conf.c (virNetworkDHCPRangeDefParseXML): Free
      xml strings when no longer referenced.
      d90babe9
    • E
      maint: prohibit most uses of xmlGetProp · 416c09bc
      Eric Blake 提交于
      Making this change makes it easier to spot the memory leaks
      that will be fixed in the next patch.
      
      * cfg.mk (sc_prohibit_xmlGetProp): New rule.
      * .x-sc_prohibit_xmlGetProp: New exception.
      * Makefile.am (EXTRA_DIST): Ship exception file.
      * tools/virsh.c (cmdDetachInterface, cmdDetachDisk): Adjust
      offenders.
      * src/conf/storage_conf.c (virStoragePoolDefParseSource):
      Likewise.
      * src/conf/network_conf.c (virNetworkDHCPRangeDefParseXML)
      (virNetworkIPParseXML): Likewise.
      416c09bc
    • E
      qemu: plug memory leak · 117246e0
      Eric Blake 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=656795
      
      * src/qemu/qemu_monitor.c (qemuMonitorFree): Also free the buffer.
      117246e0
    • E
      build: enforce files.h usage · f1fe9671
      Eric Blake 提交于
      * cfg.mk (sc_prohibit_close): New syntax-check rule.
      * src/util/pci.c (pciWaitForDeviceCleanup): Fix violation.
      * .x-sc_prohibit_close: New exceptions.
      * Makefile.am (EXTRA_DIST): Distribute new file.
      f1fe9671
    • M
      Always close drivers when a virConnectPtr is released · d8b36749
      Matthias Bolte 提交于
      virConnectClose calls virUnrefConnect which in turn closes
      all open drivers when the refcount of that connection dropped
      to zero. This works fine when you free all other objects that
      hold a ref to the connection before you close it, because in
      this case virUnrefConnect is the one that removes the last
      ref to the connection.
      
      But it doesn't work when you close the connection first before
      freeing the other objects. This is because the other virUnref*
      functions call virReleaseConnect when they detect that the
      connection's refcount dropped to zero. In this case another
      virUnref* function (different from virUnrefConnect) removes the
      last ref to the connection. This results in not closing the
      open drivers and leaking things that should have been cleaned
      up in the driver close functions.
      
      To fix this move the driver close calls to virReleaseConnect.
      d8b36749