1. 22 3月, 2012 1 次提交
    • J
      qemu: Use unlimited speed when migrating to file · 9f71368d
      Jiri Denemark 提交于
      This reverts commit 61f2b6ba and most of
      commit d8916dc8, which effectively
      brings back commit ef1065cf written by
      Jim Fehlig:
      
      The qemu migration speed default is 32MiB/s as defined in migration.c
      
      /* Migration speed throttling */
      static int64_t max_throttle = (32 << 20);
      
      There's no need to throttle migration when targeting a file, so set
      migration speed to unlimited prior to migration, and restore to libvirt
      default value after migration.
      
      Default units is MB for migrate_set_speed monitor command, so
      (INT64_MAX / (1024 * 1024)) is used for unlimited migration speed.
      
      This was reverted because migration to file could not be canceled and
      even monitored since qemu was not processing any monitor commands until
      the migration finished. This is now different as we make sure the
      file descriptor we pass to qemu is able to properly report EAGAIN.
      Recent qemu changes might have helped as well.
      
      I tested managedsave with this patch in and indeed, it is 10x faster
      while I can still monitor its progress.
      9f71368d
  2. 21 3月, 2012 2 次提交
    • A
      python: Avoid memory leaks on libvirt_virNodeGetMemoryStats · 53b45aa4
      Alex Jia 提交于
      Detected by valgrind. Leaks are introduced in commit 17c77955.
      
      * python/libvirt-override.c (libvirt_virNodeGetMemoryStats): fix memory leaks
      and improve codes return value.
      
      For details, please see the following link:
      RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=770944Signed-off-by: NAlex Jia <ajia@redhat.com>
      53b45aa4
    • E
      python: always include config.h first · 2791b8ab
      Eric Blake 提交于
      On RHEL 5.7, I got this compilation failure:
      
      In file included from /usr/include/python2.4/pyport.h:98,
                       from /usr/include/python2.4/Python.h:55,
                       from libvirt.c:3:
      ../gnulib/lib/time.h:468: error: expected ';', ',' or ')' before '__timer'
      
      Turns out that our '#define restrict __restrict' from config.h wasn't
      being picked up.  Gnulib _requires_ that all .c files include <config.h>
      first, otherwise the gnulib header overrides tend to misbehave.
      
      Problem introduced by patch c700613b.
      
      * python/generator.py (buildStubs): Include <config.h> first.
      2791b8ab
  3. 20 3月, 2012 6 次提交
    • M
      Minor docs fix · e22789de
      Martin Kletzander 提交于
      End tag for "host" element was missing in example configuration
      e22789de
    • L
      conf: forbid use of multicast mac addresses · 00072373
      Laine Stump 提交于
      A few times libvirt users manually setting mac addresses have
      complained of a networking failure that ends up being due to a multicast
      mac address being used for a guest interface. This patch prevents that
      by logging an error and failing if a multicast mac address is
      encountered in each of the three following cases:
      
      1) domain xml <interface> mac address.
      2) network xml bridge mac address.
      3) network xml dhcp/host mac address.
      
      There are several other places where a mac address can be input that
      aren't controlled in this manner because failure to do so has no
      consequences (e.g., if the address will be used to search through
      existing interfaces for a match).
      
      The RNG has been updated to add multiMacAddr and uniMacAddr along with
      the existing macAddr, and macAddr was switched to uniMacAddr where
      appropriate.
      00072373
    • L
      conf: return immediately on error in dhcp host element · 43d635ca
      Laine Stump 提交于
      If an error was encountered parsing a dhcp host entry mac address or
      name, parsing would continue and log a less descriptive error that
      might make it more difficult to notice the true nature of the problem.
      
      This patch returns immediately on logging the first error.
      43d635ca
    • L
      util: fail attempts to use same mac address for guest and tap · 5d571045
      Laine Stump 提交于
      This patch is in response to:
      
        https://bugzilla.redhat.com/show_bug.cgi?id=798467
      
      If a guest's tap device is created using the same MAC address the
      guest uses for its own network card (which connects to the tap
      device), the Linux kernel will log the following message and traffic
      will not pass:
      
       kernel: vnet9: received packet with own address as source address
      
      This patch disallows MAC addresses with a first byte of 0xFE, but only in
      the case that the MAC address is used for a guest interface that's
      connected by way of a standard tap device. (In other words, the
      validation is done at runtime at the same place the MAC address is
      modified for the tap device, rather than when mac address is parsed,
      the idea being that it is then we know for sure the address will be
      problematic.)
      5d571045
    • M
      Cpu mapping cleanup · d675a922
      Martin Kletzander 提交于
      Using inheritance, this patch cleans up the cpu_map.xml file and also
      sorts all CPU features according to the feature and registry
      values. Model features are sorted the same way as foeatures in the
      specification.
      Also few models that are related were organized together and parts of
      the XML are marked with comments
      d675a922
    • E
      snapshot: make quiesce a bit safer · 7c736bab
      Eric Blake 提交于
      If a guest is paused, we were silently ignoring the quiesce flag,
      which results in unclean snapshots, contrary to the intent of the
      flag.  Since we can't quiesce without guest agent support, we should
      instead fail if the guest is not running.
      
      Meanwhile, if we attempt a quiesce command, but the guest agent
      doesn't respond, and we time out, we may have left the command
      pending on the guest's queue, and when the guest resumes parsing
      commands, it will freeze even though our command is no longer
      around to issue a thaw.  To be safe, we must _always_ pair every
      quiesce call with a counterpart thaw, even if the quiesce call
      failed due to a timeout, so that if a guest wakes up and starts
      processing a command backlog, it will not get stuck in a frozen
      state.
      
      * src/qemu/qemu_driver.c (qemuDomainSnapshotCreateDiskActive):
      Always issue thaw after a quiesce, even if quiesce failed.
      (qemuDomainSnapshotFSThaw): Add a parameter.
      7c736bab
  4. 19 3月, 2012 1 次提交
  5. 17 3月, 2012 1 次提交
  6. 16 3月, 2012 6 次提交
    • D
      Fix handling of blkio deviceWeight empty string · f987d175
      Daniel P. Berrange 提交于
      A common coding pattern for changing blkio parameters is
      
        1. virDomainGetBlkioParameters
      
        2. change one or more params
      
        3. virDomainSetBlkioParameters
      
      For this to work, it must be possible to roundtrip through
      the methods without error. Unfortunately virDomainGetBlkioParameters
      will return "" for the deviceWeight parameter for guests by default,
      which virDomainSetBlkioParameters will then reject as invalid.
      
      This fixes the handling of "" to be a no-op, and also improves the
      error message to tell you what was invalid
      f987d175
    • O
      remote: Fix migration leaks · b569c1ab
      Osier Yang 提交于
      How to reproduce:
      
      % valgrind -v --leak-check=full virsh migrate mig \
        qemu+ssh://$dest/system --unsafe
      
      == 8 bytes in 1 blocks are definitely lost in loss record 1 of 28
      ==    at 0x4A04A28: calloc (vg_replace_malloc.c:467)
      ==    by 0x3EB7115FB8: xdr_reference (in /lib64/libc-2.12.so)
      ==    by 0x3EB7115F10: xdr_pointer (in /lib64/libc-2.12.so)
      ==    by 0x4D1EA84: xdr_remote_string (remote_protocol.c:40)
      ==    by 0x4D1EAD8: xdr_remote_domain_migrate_prepare3_ret (remote_protocol.c:4772)
      ==    by 0x4D2FFD2: virNetMessageDecodePayload (virnetmessage.c:382)
      ==    by 0x4D2789C: virNetClientProgramCall (virnetclientprogram.c:382)
      ==    by 0x4D0707D: callWithFD (remote_driver.c:4549)
      ==    by 0x4D070FB: call (remote_driver.c:4570)
      ==    by 0x4D12AEE: remoteDomainMigratePrepare3 (remote_driver.c:4138)
      ==    by 0x4CF7BE9: virDomainMigrateVersion3 (libvirt.c:4815)
      ==    by 0x4CF9432: virDomainMigrate2 (libvirt.c:5454)
      ==
      == LEAK SUMMARY:
      ==    definitely lost: 8 bytes in 1 blocks
      ==    indirectly lost: 0 bytes in 0 blocks
      ==      possibly lost: 0 bytes in 0 blocks
      ==    still reachable: 126,995 bytes in 1,343 blocks
      ==         suppressed: 0 bytes in 0 blocks
      
      This patch also fixes the leaks in remoteDomainMigratePrepare and
      remoteDomainMigratePrepare2.
      b569c1ab
    • A
      libvirt: fix comment typo · 8233dcc7
      Alex Jia 提交于
      * src/libvirt.c (virStorageVolResize): correct comment typo according to
        virStorageVolResizeFlags enum definition.
      Signed-off-by: NAlex Jia <ajia@redhat.com>
      8233dcc7
    • D
      Add support for forcing a private network namespace for LXC guests · 10a8b1f9
      Daniel P. Berrange 提交于
      If no <interface> elements are included in an LXC guest XML
      description, then the LXC guest will just see the host's
      network interfaces. It is desirable to be able to hide the
      host interfaces, without having to define any guest interfaces.
      
      This patch introduces a new feature flag <privnet/> to allow
      forcing of a private network namespace for LXC. In the future
      I also anticipate that we will add <privuser/> to force a
      private user ID namespace.
      
      * src/conf/domain_conf.c, src/conf/domain_conf.h: Add support
        for <privnet/> feature. Auto-set <privnet> if any <interface>
        devices are defined
      * src/lxc/lxc_container.c: Honour request for private network
        namespace
      10a8b1f9
    • P
      lib: Don't access configuration if none is present · 59d0c980
      Peter Krempa 提交于
      Commit e457d5ef adds ability to pass the
      default URI using the client configuration file. If the file is not
      present, it still accesses the NULL config object causing a segfault.
      
      Caught running "make check".
      59d0c980
    • M
      qemuDomainDetachPciDiskDevice: Free allocated cgroup · 362c3b33
      Michal Privoznik 提交于
      This function potentially allocates new virCgroup but never
      frees it.
      362c3b33
  7. 15 3月, 2012 7 次提交
    • L
      Emit graphics events when a SPICE client connects/disconnects · 89ae6a5a
      Laine Stump 提交于
      Wire up the domain graphics event notifications for SPICE. Adapted
      from a RHEL-only patch written by Dan Berrange that used custom
      __com.redhat_SPICE events - equivalent events are now available in
      upstream QEMU (including a SPICE_CONNECTED event, which was missing in
      the __COM.redhat_SPICE version).
      
      * src/qemu/qemu_monitor_json.c: Wire up SPICE graphics events
      89ae6a5a
    • O
      numad: Fix typo and warning · d86120fc
      Osier Yang 提交于
      src/libvirt_private.syms:
        s/virDomainCpuPlacement/virDomainCpuPlacementMode/
      src/qemu/qemu_process.c
        def->mem.cur_balloon expects "llu"
      --
      pushed under build-breaker rule
      d86120fc
    • D
      Add container_uuid env variable to LXC guests · 6e6aa000
      Daniel P. Berrange 提交于
      Systemd has declared that all container virtualization technologies
      should set 'container_uuid' to identify themselves.
      
      http://cgit.freedesktop.org/systemd/systemd/commit/?id=09b967eaa51a39dabb7f238927f67bd682466dbc
      6e6aa000
    • D
      Allow overriding default URI in config file · e457d5ef
      Daniel P. Berrange 提交于
      Currently if the URI passed to virConnectOpen* is NULL, then we
      
       - Look for LIBVIRT_DEFAULT_URI env var
       - Probe for drivers
      
      This changes it so that
      
       - Look for LIBVIRT_DEFAULT_URI env var
       - Look for 'uri_default' in $HOME/.libvirt/libvirt.conf
       - Probe for drivers
      e457d5ef
    • O
      virsh: A bit smarter attach-disk · 6227a220
      Osier Yang 提交于
      Detects the file type of source path if no "--sourcetype" and
      "driver" is specified, instead of always set the disk type as
      "block".
      6227a220
    • A
      virsh: fix invalid free · 68fd6a3b
      Alex Jia 提交于
      * tools/virsh.c (cmdDetachDisk): fix invalid free due to using
        uninitialised value.
      
      * How to reproduce?
      # virsh detach-disk a b
      error: failed to get domain 'a'
      *** glibc detected *** virsh: double free or corruption (out): 0x00007fff410ed1a0 ***
      ======= Backtrace: =========
      /lib64/libc.so.6[0x39cf0750c6]
      /usr/lib/libvirt.so.0(virFree+0x39)[0x7f045938a239]
      virsh[0x41c768]
      virsh[0x415075]
      virsh[0x425d64]
      /lib64/libc.so.6(__libc_start_main+0xfd)[0x39cf01ecdd]
      virsh[0x40a419]
      ======= Memory map: ========
      00400000-0044e000 r-xp 00000000 08:0e 760441                             /usr/bin/virsh
      0064e000-00650000 rw-p 0004e000 08:0e 760441                             /usr/bin/virsh
      ......
      39d7229000-39d722b000 r--p 00029000 08:0e 2183477                        /lib64/libk5crypto.so.3.1
      39d722b000-39d722c000 rw-p 0002b000 08:0e 2183477                        /lib64/lAborted (core dumped)
      Signed-off-by: NAlex Jia <ajia@redhat.com>
      68fd6a3b
    • O
      qemu: Support numad · 0f8e7ae3
      Osier Yang 提交于
      numad is an user-level daemon that monitors NUMA topology and
      processes resource consumption to facilitate good NUMA resource
      alignment of applications/virtual machines to improve performance
      and minimize cost of remote memory latencies. It provides a
      pre-placement advisory interface, so significant processes can
      be pre-bound to nodes with sufficient available resources.
      
      More details: http://fedoraproject.org/wiki/Features/numad
      
      "numad -w ncpus:memory_amount" is the advisory interface numad
      provides currently.
      
      This patch add the support by introducing a new XML attribute
      for <vcpu>. e.g.
      
        <vcpu placement="auto">4</vcpu>
        <vcpu placement="static" cpuset="1-10^6">4</vcpu>
      
      The returned advisory nodeset from numad will be printed
      in domain's dumped XML. e.g.
        <vcpu placement="auto" cpuset="1-10^6">4</vcpu>
      
      If placement is "auto", the number of vcpus and the current
      memory amount specified in domain XML will be used for numad
      command line (numad uses MB for memory amount):
        numad -w $num_of_vcpus:$current_memory_amount / 1024
      
      The advisory nodeset returned from numad will be used to set
      domain process CPU affinity then. (e.g. qemuProcessInitCpuAffinity).
      
      If the user specifies both CPU affinity policy (e.g.
      (<vcpu cpuset="1-10,^7,^8">4</vcpu>) and placement == "auto"
      the specified CPU affinity will be overridden.
      
      Only QEMU/KVM drivers support it now.
      
      See docs update in patch for more details.
      0f8e7ae3
  8. 14 3月, 2012 3 次提交
  9. 13 3月, 2012 5 次提交
    • M
      Added support for AMD Bulldozer CPU · 0ba86207
      Martin Kletzander 提交于
      AMD Bulldozer (or Opteron_G4 as called in QEMU) was added to the list
      of cpu models, flags were taken from upstream qemu cpu specifications
      and should be sorted by bit values (or first occurence in the feature
      specification part of cpu_map.xml).
      
      Based on QEMU upstream commit 885bb0369a4f0abe2c0185178f3cb347cb02cdf1.
      0ba86207
    • M
      graphics: Cleanup port policy · 2e4defdc
      Michal Privoznik 提交于
      Even though we say in documentation setting (tls-)port to -1 is legacy
      compat style for enabling autoport, we're roughly doing this for VNC.
      However, in case of SPICE auto enable autoport iff both port & tlsPort
      are equal -1 as documentation says autoport plays with both.
      2e4defdc
    • G
      qemu: fix segfault when detaching non-existent network device · 19c7980e
      Guannan Ren 提交于
      In qemuDomainDetachNetDevice, detach was being used before it had been
      validated. If no matching device was found, this resulted in a
      dereference of a NULL pointer.
      
      This behavior was a regression introduced in commit
      cf90342b, so it has not been a part of
      any official libvirt release.
      19c7980e
    • J
      qemu: Fix (managed)save and snapshots with host mode CPU · 041109af
      Jiri Denemark 提交于
      When host-model and host-passthrouh CPU modes were introduced, qemu
      driver was properly modify to update guest CPU definition during
      migration so that we use the right CPU at the destination. However,
      similar treatment is needed for (managed)save and snapshots since they
      need to save the exact CPU so that a domain can be properly restored.
      To avoid repetition of such situation, all places that need live XML
      share the code which generates it.
      
      As a side effect, this patch fixes error reporting from
      qemuDomainSnapshotWriteMetadata().
      041109af
    • E
      docs: fix usage example on setting log levels · 98deac7d
      Eric Blake 提交于
      Reported by Michael S. Tsirkin.
      
      * docs/logging.html.in (log_examples): Use correct libvirtd.conf
      syntax.
      98deac7d
  10. 12 3月, 2012 4 次提交
    • E
      cpustats: report user and sys times · 759095f6
      Eric Blake 提交于
      Thanks to cgroups, providing user vs. system time of the overall
      guest is easy to add to our existing API.
      
      * include/libvirt/libvirt.h.in (VIR_DOMAIN_CPU_STATS_USERTIME)
      (VIR_DOMAIN_CPU_STATS_SYSTEMTIME): New constants.
      * src/util/virtypedparam.h (virTypedParameterArrayValidate)
      (virTypedParameterAssign): Enforce checking the result.
      * src/qemu/qemu_driver.c (qemuDomainGetPercpuStats): Fix offender.
      (qemuDomainGetTotalcpuStats): Implement new parameters.
      * tools/virsh.c (cmdCPUStats): Tweak output accordingly.
      759095f6
    • E
      cpustats: collect VM user and sys times · 0d0b4098
      Eric Blake 提交于
      As documented in linux.git/Documentation/cgroups/cpuacct.txt,
      cpuacct.stat returns user and system time in ticks (the same
      unit used in times(2)).  It would be a bit nicer if it were like
      getrusage(2) and reported timeval contents, or like cpuacct.usage
      and in nanoseconds, but we can't be picky.
      
      * src/util/cgroup.h (virCgroupGetCpuacctStat): New function.
      * src/util/cgroup.c (virCgroupGetCpuacctStat): Implement it.
      (virCgroupGetValueStr): Allow for multi-line files.
      * src/libvirt_private.syms (cgroup.h): Export it.
      0d0b4098
    • E
      qemu: support disk filenames with comma · 6e0ff1d4
      Eric Blake 提交于
      If there is a disk file with a comma in the name, QEmu expects a double
      comma instead of a single one (e.g., the file "virtual,disk.img" needs
      to be specified as "virtual,,disk.img" in QEmu's command line). This
      patch fixes libvirt to work with that feature. Fix RHBZ #801036.
      
      Based on an initial patch by Crístian Viana.
      
      * src/util/buf.h (virBufferEscape): Alter signature.
      * src/util/buf.c (virBufferEscape): Add parameter.
      (virBufferEscapeSexpr): Fix caller.
      * src/qemu/qemu_command.c (qemuBuildRBDString): Likewise.  Also
      escape commas in file names.
      (qemuBuildDriveStr): Escape commas in file names.
      * docs/schemas/basictypes.rng (absFilePath): Relax RNG to allow
      commas in input file names.
      * tests/qemuxml2argvdata/*-disk-drive-network-sheepdog.*: Update
      test.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      6e0ff1d4
    • D
      Fix a few typo in translated strings · dd39f13a
      Daniel Veillard 提交于
      this was raised by our hindi localization team
      chandan kumar <chandankumar.093047@gmail.com>
      dd39f13a
  11. 09 3月, 2012 4 次提交