1. 15 5月, 2012 7 次提交
    • O
      qemu: Set memory policy using cgroup if placement is auto · be9f6ecb
      Osier Yang 提交于
      Like for 'static' placement, when the memory policy mode is
      'strict', set the memory policy by writing the advisory nodeset
      returned from numad to cgroup file cpuset.mems,
      be9f6ecb
    • O
      qemu: Use the CPU index in capabilities to map NUMA node to cpu list. · d1bdeca8
      Osier Yang 提交于
      On some of the NUMA platforms, the CPU index in each NUMA node
      grows non-consecutive. While on other platforms, it can be inconsecutive,
      E.g.
      
      % numactl --hardware
      available: 4 nodes (0-3)
      node 0 cpus: 0 4 8 12 16 20 24 28
      node 0 size: 131058 MB
      node 0 free: 86531 MB
      node 1 cpus: 1 5 9 13 17 21 25 29
      node 1 size: 131072 MB
      node 1 free: 127070 MB
      node 2 cpus: 2 6 10 14 18 22 26 30
      node 2 size: 131072 MB
      node 2 free: 127758 MB
      node 3 cpus: 3 7 11 15 19 23 27 31
      node 3 size: 131072 MB
      node 3 free: 127226 MB
      node distances:
      node   0   1   2   3
        0:  10  20  20  20
        1:  20  10  20  20
        2:  20  20  10  20
        3:  20  20  20  10
      
      This patch is to fix the problem by using the CPU index in
      caps->host.numaCell[i]->cpus[i] to set the bitmask instead of
      assuming the CPU index of the NUMA nodes are always sequential.
      d1bdeca8
    • L
      Assign spapr-vio bus address to ibmvscsi controller · bb725ac1
      Li Zhang 提交于
      For pseries guest, the default controller model is
      ibmvscsi controller, this controller only can work
      on spapr-vio address.
      
      This patch is to assign spapr-vio address type to
      ibmvscsi controller and correct vscsi test case.
      Signed-off-by: NLi Zhang <zhlcindy@linux.vnet.ibm.com>
      bb725ac1
    • D
      sanlock: fix locking for readonly devices · b8012ce9
      David Weber 提交于
      Add ignore param for readonly and shared disk in sanlock
      b8012ce9
    • E
      nodeinfo: add some more tests · 891a7f9e
      Eric Blake 提交于
      Test 2 data grabbed from a 2-core 1-node laptop.
      Test 3 data grabbed from a 48-cpu AMD Magny Cours box.
      
      * tests/nodeinfodata/linux-nodeinfo-sysfs-test-2*: New test data.
      * tests/nodeinfodata/linux-nodeinfo-sysfs-test-3*: Likewise.
      * tests/nodeinfotest.c (mymain): Run them.
      * cfg.mk
      (exclude_file_name_regexp--sc_prohibit_empty_lines_at_EOF): Exempt
      new test files.
      891a7f9e
    • E
      nodeinfo: avoid probing host filesystem during test · 2b366b46
      Eric Blake 提交于
      We had previously weakened our nodeinfotest in order to ignore parsed
      node values, because the parse function was mistakenly relying on
      host files.  A better fix is to avoid using the numactl library, but
      to instead parse the same files that numactl would read, all while
      allowing the files to be relative to our choice of directory.
      
      * src/nodeinfo.c (CPU_SYS_PATH, NODE_SYS_PATH): Replace with...
      (SYSFS_SYSTEM_PATH): ...parent directory.
      (linuxNodeInfoCPUPopulate): Check NUMA nodes from requested
      directory (by inlining numactl code).
      (nodeGetCPUmap, nodeGetMemoryStats): Adjust macro use.
      * tests/nodeinfotest.c (linuxTestCompareFiles, linuxTestNodeInfo):
      Update test to match.
      2b366b46
    • E
      nodeinfo: drop static variable · 88f12a36
      Eric Blake 提交于
      We were wasting time to malloc a copy of a constant string, then
      copy it into static storage, for every call to nodeGetInfo.  At
      least we were lucky that it was a constant source, and thus not
      subject to even worse issues with one thread clobbering the static
      storage while another was using it.  This gets rid of the waste,
      by passing the string through the stack instead, as well as renaming
      internal functions to better match our conventions.
      
      * src/nodeinfo.c (sysfs_path): Delete.
      (get_cpu_value, count_thread_siblings, parse_socket): Add
      parameter, and rename...
      (virNodeGetCpuValue, virNodeCountThreadSiblings)
      (virNodeParseSocket): ... into a common namespace.
      (cpu_online, parse_core): Inline into callers.
      (linuxNodeInfoCPUPopulate): Update caller.
      (nodeGetInfo): Drop a useless malloc.
      88f12a36
  2. 14 5月, 2012 4 次提交
    • E
      build: really silence the 32-bit warning · 5f89c860
      Eric Blake 提交于
      Commit cdce2f42 tried to silence a compiler warning on 32-bit builds,
      but the gcc shipped with RHEL 5 is old enough that the type conversion
      via multiplication by 1 was insufficient for the task.
      
      * src/qemu/qemu_monitor.c (qemuMonitorBlockJob): Previous attempt
      didn't get past all gcc versions.
      5f89c860
    • E
      maint: fix AUTHORS · aaf36b15
      Eric Blake 提交于
      Use the address specified in the actual commit, to placate
      'make syntax-check'.
      aaf36b15
    • W
      Use XDG Base Directories instead of storing in home directory · 32a9aac2
      William Jon McCann 提交于
      As defined in:
      http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
      
      This offers a number of advantages:
       * Allows sharing a home directory between different machines, or
      sessions (eg. using NFS)
       * Cleanly separates cache, runtime (eg. sockets), or app data from
      user settings
       * Supports performing smart or selective migration of settings
      between different OS versions
       * Supports reseting settings without breaking things
       * Makes it possible to clear cache data to make room when the disk
      is filling up
       * Allows us to write a robust and efficient backup solution
       * Allows an admin flexibility to change where data and settings are stored
       * Dramatically reduces the complexity and incoherence of the
      system for administrators
      32a9aac2
    • D
      Release of libvirt-0.9.12 · a25d5cfd
      Daniel Veillard 提交于
      * configure.ac docs/news.html.in libvirt.spec.in: updates for the release
      * po/*.po: pushed new sources and synchronized new languages translations
      a25d5cfd
  3. 13 5月, 2012 1 次提交
    • M
      esx: Fix memory leaks in error paths related to transferred ownership · 3b9a1295
      Matthias Bolte 提交于
      Appending an item to a list transfers ownership of that item to the
      list owner. But an error can occur in between item allocation and
      appending it to the list. In this case the item has to be freed
      explicitly. This was not done in some special cases resulting in
      possible memory leaks.
      
      Reported by Coverity.
      3b9a1295
  4. 11 5月, 2012 6 次提交
    • P
      qemu: Don't skip detection of virtual cpu's on non KVM targets · c8335269
      Peter Krempa 提交于
      This patch lifts the limit of calling thread detection code only on KVM
      guests. With upstream qemu the thread mappings are reported also on
      non-KVM machines.
      
      QEMU adopted the thread_id information from the kvm branch.
      
      To remain compatible with older upstream versions of qemu the check is
      attempted but the failure to detect threads (or even run the monitor
      command - on older versions without SMP support) is treated non-fatal
      and the code reports one vCPU with pid of the hypervisor (in same
      fashion this was done on non-KVM guests).
      c8335269
    • P
      qemu: Re-detect virtual cpu threads after cpu hot (un)plug. · 3163682b
      Peter Krempa 提交于
      After a cpu hotplug the qemu driver did not refresh information about
      virtual processors used by qemu and their corresponding threads. This
      patch forces a re-detection as is done on start of QEMU.
      
      This ensures that correct information is reported by the
      virDomainGetVcpus API and "virsh vcpuinfo".
      
      A failure to obtain the thread<->vcpu mapping is treated non-fatal and
      the mapping is not updated in a case of failure as not all versions of
      QEMU report this in the info cpus command.
      3163682b
    • P
      qemu: Refactor qemuDomainSetVcpusFlags · e99ad93d
      Peter Krempa 提交于
      This patch changes a switch statement into ifs when handling live vs.
      configuration modifications getting rid of redundant code in case when
      both live and persistent configuration gets changed.
      e99ad93d
    • E
      build: fix stamp file name · c0057d9a
      Eric Blake 提交于
      Ever since commit c964b6aa, make was trying to find the timestamp
      of '""./apibuild.py".stamp"', but only touching 'apibuild.py.stamp',
      and thus always rebuilding.  Reported by Daniel P. Berrange.
      
      * docs/Makefile.am (APIBUILD, APIBUILD_STAMP): Omit bogus quotes.
      c0057d9a
    • G
      usb: fix crash when failing to attach a second usb device · ab5fb8f3
      Guannan Ren 提交于
      when failing to attach another usb device to a domain for some reason
      which has one use device attached before, the libvirtd crashed.
      The crash is caused by null-pointer dereference error in invoking
      usbDeviceListSteal passed in NULL value usb variable.
      commit 05abd150 introduces the bug.
      ab5fb8f3
    • E
      docs: mention migration issue of which credentials are used · 38bd605b
      Eric Blake 提交于
      Based on a report by Seth Vidal.  Just because _you_ can use virsh
      to connect to both source and destinations does not mean that libvirtd
      on the source (aka _root_) can likewise connect to the destination;
      this matters when setting up a peer-to-peer migration instead of a
      native one.
      
      * docs/migration.html.in: Mention that in peer-to-peer, the owner
      of the source libvirtd (usually root) must be able to connect to
      the destination.
      38bd605b
  5. 10 5月, 2012 4 次提交
    • O
      build: Fix the typo in configure.ac · eecee94c
      Osier Yang 提交于
      s/nuamd/numad/,
      eecee94c
    • A
      conf: Fix memory leaks in virStoragePoolDefParseSource · 15e0b20a
      Alex Jia 提交于
      Detected by valgrind. Leaks are introduced in commit 122fa379.
      
      src/conf/storage_conf.c: fix memory leaks.
      
      How to reproduce?
      $ make && make -C tests check TESTS=storagepoolxml2xmltest
      $ cd tests && valgrind -v --leak-check=full ./storagepoolxml2xmltest
      
      actual result:
      ==28571== LEAK SUMMARY:
      ==28571==    definitely lost: 40 bytes in 5 blocks
      ==28571==    indirectly lost: 0 bytes in 0 blocks
      ==28571==      possibly lost: 0 bytes in 0 blocks
      ==28571==    still reachable: 1,054 bytes in 21 blocks
      ==28571==         suppressed: 0 bytes in 0 blocks
      Signed-off-by: NAlex Jia <ajia@redhat.com>
      15e0b20a
    • E
      qemu: fix build when !HAVE_NUMACTL · 5c650b98
      Eric Blake 提交于
      Commit 97010eb1 forgot to change the other side of an #ifdef.
      
      * src/qemu/qemu_process.c (qemuProcessInitNumaMemoryPolicy): Add
      argument.
      5c650b98
    • J
      Report error when parsing character device target type · 10a87145
      Jim Fehlig 提交于
      No useful error was being reported when an invalid character device
      target type is specified in the domainXML. E.g.
      
          ...
          <console type="pty">
            <source path="/dev/pts/2"/>
            <target type="kvm" port="0"/>
          </console>
          ...
      
      resulted in
      
      error: Failed to define domain from x.xml
      error: An error occurred, but the cause is unknown
      
      With this small patch, the error is more helpful
      
      error: Failed to define domain from x.xml
      error: XML error: unknown target type 'kvm' specified for character device
      10a87145
  6. 09 5月, 2012 10 次提交
    • J
      netlink: Fix build with libnl-3 · d9d39e62
      Jiri Denemark 提交于
      Commit 64297313 added three direct
      references to nl_handle_* instead of using our aliases which hide
      differences between libnl-3 and libnl-1.
      d9d39e62
    • O
      numad: Update comments in libvirt.spec.in · b736e722
      Osier Yang 提交于
      Not only support CPU placement now.
      b736e722
    • O
      numad: Check numactl-devel if compiled with numad support · b0f32445
      Osier Yang 提交于
      Since now we pre-set memory policy using libnuma to fully
      drive numad, it needs to check numactl-devel if "with_numad"
      is "yes".
      
      configure with groups "--with-numad=yes --with-numactl=yes",
      "--with-numad=no --with-numactl=yes", "--with-numad=yes
      --with-numactl=yes" works fine after the change.
      b0f32445
    • O
      numad: Divide cur_balloon by 1024 before passing it to numad · a00efdda
      Osier Yang 提交于
      Numad expects MB by default.
      a00efdda
    • O
      numad: Always output 'placement' of <vcpu> · d70f2e11
      Osier Yang 提交于
      <vcpu> is not an optional node. The value for its 'placement'
      actually always defaults to 'static' in the underlying codes.
      (Even no 'cpuset' and 'placement' is specified, the domain
      process will be pinned to all the available pCPUs).
      d70f2e11
    • O
      numad: Copy 'placement' of <numatune> to <vcpu> by default · 8d26a7fd
      Osier Yang 提交于
      With this patch, one can also fully drive numad by:
      
        <vcpu>2</vcpu>
        <numatune>
          <memory placement='auto'/>
        </numatune>
      
      New tests are added.
      8d26a7fd
    • O
      numad: Set memory policy from numad advisory nodeset · 97010eb1
      Osier Yang 提交于
      Though numad will manage the memory allocation of task dynamically,
      it wants management application (libvirt) to pre-set the memory
      policy according to the advisory nodeset returned from querying numad,
      (just like pre-bind CPU nodeset for domain process), and thus the
      performance could benefit much more from it.
      
      This patch introduces new XML tag 'placement', value 'auto' indicates
      whether to set the memory policy with the advisory nodeset from numad,
      and its value defaults to the value of <vcpu> placement, or 'static'
      if 'nodeset' is specified. Example of the new XML tag's usage:
      
        <numatune>
          <memory placement='auto' mode='interleave'/>
        </numatune>
      
      Just like what current "numatune" does, the 'auto' numa memory policy
      setting uses libnuma's API too.
      
      If <vcpu> "placement" is "auto", and <numatune> is not specified
      explicitly, a default <numatume> will be added with "placement"
      set as "auto", and "mode" set as "strict".
      
      The following XML can now fully drive numad:
      
      1) <vcpu> placement is 'auto', no <numatune> is specified.
      
         <vcpu placement='auto'>10</vcpu>
      
      2) <vcpu> placement is 'auto', no 'placement' is specified for
         <numatune>.
      
         <vcpu placement='auto'>10</vcpu>
         <numatune>
           <memory mode='interleave'/>
         </numatune>
      
      And it's also able to control the CPU placement and memory policy
      independently. e.g.
      
      1) <vcpu> placement is 'auto', and <numatune> placement is 'static'
      
         <vcpu placement='auto'>10</vcpu>
         <numatune>
           <memory mode='strict' nodeset='0-10,^7'/>
         </numatune>
      
      2) <vcpu> placement is 'static', and <numatune> placement is 'auto'
      
         <vcpu placement='static' cpuset='0-24,^12'>10</vcpu>
         <numatune>
           <memory mode='interleave' placement='auto'/>
         </numatume>
      
      A follow up patch will change the XML formatting codes to always output
      'placement' for <vcpu>, even it's 'static'.
      97010eb1
    • E
      snapshot: allow block devices past cgroup · 8be304ec
      Eric Blake 提交于
      It turns out that when cgroups are enabled, the use of a block device
      for a snapshot target was failing with EPERM due to libvirt failing
      to add the block device to the cgroup whitelist.  See also
      https://bugzilla.redhat.com/show_bug.cgi?id=810200
      
      * src/qemu/qemu_driver.c
      (qemuDomainSnapshotCreateSingleDiskActive)
      (qemuDomainSnapshotUndoSingleDiskActive): Account for cgroup.
      (qemuDomainSnapshotCreateDiskActive): Update caller.
      8be304ec
    • A
      tests: add some self-documentation to tests · 75d155ec
      Alon Levy 提交于
      Alon tried './qemuxml2argvtest --help' to figure out a test failure,
      but it didn't help.  The information is in HACKING, but it doesn't
      hurt to make the tests also provide their own help.
      Signed-off-by: NAlon Levy <alevy@redhat.com>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      75d155ec
    • A
      domain_conf: add "default" to list of valid spice channels · ba97e4ed
      Alon Levy 提交于
      qemu's behavior in this case is to change the spice server behavior to
      require secure connection to any channel not otherwise specified as
      being in plaintext mode. libvirt doesn't currently allow requesting this
      (via plaintext-channel=<channel name>).
      
      RHBZ: 819499
      Signed-off-by: NAlon Levy <alevy@redhat.com>
      ba97e4ed
  7. 08 5月, 2012 7 次提交
    • A
      domain_conf: add "usbredir" to list of valid spice channels · 4e78ffb6
      Alon Levy 提交于
      Add "usbredir" channel to list of recognized spice channels.
      
      RHBZ: 819498
      Signed-off-by: NAlon Levy <alevy@redhat.com>
      4e78ffb6
    • E
      build: avoid link failure on Windows · 0ca336b3
      Eric Blake 提交于
      We only know -lpthread exists on platforms where we build
      threads-pthread.c; but when we build threads-win32.c, LIB_PTHREAD
      is empty.
      
      * tests/Makefile.am (shunloadtest_LDADD): Use correct library.
      0ca336b3
    • J
      virsh: avoid heap corruption leading to virsh abort · c6694ab8
      Jim Meyering 提交于
      * tools/virsh.c (vshParseSnapshotDiskspec): Fix off-by-3 memmove
      that would corrupt heap when parsing escaped --diskspec comma.
      Bug introduced via commit v0.9.4-260-g35d52b56.
      c6694ab8
    • L
      util: set src_pid for virNetlinkCommand when appropriate · cc073771
      Laine Stump 提交于
      Until now, the nl_pid of the source address of every message sent by
      virNetlinkCommand has been set to the value of getpid(). Most of the
      time this doesn't matter, and in the one case where it does
      (communication with lldpad), it previously was the proper thing to do,
      because the netlink event service (which listens on a netlink socket
      for unsolicited messages from lldpad) coincidentally always happened
      to bind with a local nl_pid == getpid().
      
      With the fix for:
      
        https://bugzilla.redhat.com/show_bug.cgi?id=816465
      
      that particular nl_pid is now effectively a reserved value, so the
      netlink event service will always bind to something else
      (coincidentally "getpid() + (1 << 22)", but it really could be
      anything). The result is that communication between lldpad and
      libvirtd is broken (lldpad gets a "disconnected" error when it tries
      to send a directed message).
      
      The solution to this problem caused by a solution, is to query the
      netlink event service's nlhandle for its "local_port", and send that
      as the source nl_pid (but only when sending to lldpad, of course - in
      other cases we maintain the old behavior of sending getpid()).
      
      There are two cases where a message is being directed at lldpad - one
      in virNetDevLinkDump, and one in virNetDevVPortProfileOpSetLink.
      
      The case of virNetDevVPortProfileOpSetLink is simplest to explain -
      only if !nltarget_kernel, i.e. the message isn't targetted for the
      kernel, is the dst_pid set (by calling
      virNetDevVPortProfileGetLldpadPid()), so only in that case do we call
      virNetlinkEventServiceLocalPid() to set src_pid.
      
      For virNetDevLinkDump, it's a bit more complicated. The call to
      virNetDevVPortProfileGetLldpadPid() was effectively up one level (in
      virNetDevVPortProfileOpCommon), although obscured by an unnecessary
      passing of a function pointer. This patch removes the function
      pointer, and calls virNetDevVPortProfileGetLldpadPid() directly in
      virNetDevVPortProfileOpCommon - if it's doing this, it knows that it
      should also call virNetlinkEventServiceLocalPid() to set src_pid too;
      then it just passes src_pid and dst_pid down to
      virNetDevLinkDump. Since (src_pid == 0 && dst_pid == 0) implies that
      the kernel is the destination, there is no longer any need to send
      nltarget_kernel as an arg to virNetDevLinkDump, so it's been removed.
      
      The disparity between src_pid being int and dst_pid being uint32_t may
      be a bit disconcerting to some, but I didn't want to complicate
      virNetlinkEventServiceLocalPid() by having status returned separately
      from the value.
      cc073771
    • L
      util: function to get local nl_pid used by netlink event socket · c99e9375
      Laine Stump 提交于
      This value will be needed to set the src_pid when sending netlink
      messages to lldpad. It is part of the solution to:
      
        https://bugzilla.redhat.com/show_bug.cgi?id=816465
      
      Note that libnl's port generation algorithm guarantees that the
      nl_socket_get_local_port() will always be > 0 (since it is "getpid() +
      (n << 22>" where n is always < 1024), so it is okay to cast the
      uint32_t to int (thus allowing us to use -1 as an error sentinel).
      c99e9375
    • L
      util: allow specifying both src and dst pid in virNetlinkCommand · cca7bb1f
      Laine Stump 提交于
      Until now, virNetlinkCommand has assumed that the nl_pid in the source
      address of outgoing netlink messages should always be the return value
      of getpid(). In most cases it actually doesn't matter, but in the case
      of communication with lldpad, lldpad saves this info and later uses it
      to send netlink messages back to libvirt. A recent patch to fix Bug
      816465 changed the order of the universe such that the netlink event
      service socket is no longer bound with nl_pid == getpid(), so lldpad
      could no longer send unsolicited messages to libvirtd. Adding src_pid
      as an argument to virNetlinkCommand() is the first step in notifying
      lldpad of the proper address of the netlink event service socket.
      cca7bb1f
    • L
      util: fix libvirtd startup failure due to netlink error · 64297313
      Laine Stump 提交于
      This is part of the solution to the problem detailed in:
      
        https://bugzilla.redhat.com/show_bug.cgi?id=816465
      
      and further detailed in
      
        https://www.redhat.com/archives/libvir-list/2012-May/msg00202.htm
      
      A short explanation is included in the comments of the patch itself.
      
      Note that this patch by itself breaks communication between lldpad and
      libvirtd, so the other 3 patches in the series must be applied at the
      same time as this patch.
      64297313
  8. 07 5月, 2012 1 次提交