1. 28 1月, 2012 1 次提交
  2. 27 1月, 2012 16 次提交
    • P
      qemu: parse and create -cpu ...,-kvmclock · b66d1bef
      Paolo Bonzini 提交于
      QEMU supports a bunch of CPUID features that are tied to the kvm CPUID
      nodes rather than the processor's.  They are "kvmclock",
      "kvm_nopiodelay", "kvm_mmu", "kvm_asyncpf".  These are not known to
      libvirt and their CPUID leaf might move if (for example) the Hyper-V
      extensions are enabled. Hence their handling would anyway require some
      special-casing.
      
      However, among these the most useful is kvmclock; an additional
      "property" of this feature is that a <timer> element is a better model
      than a CPUID feature.  Although, creating part of the -cpu command-line
      from something other than the <cpu> XML element introduces some
      ugliness.
      Reviewed-by: NJiri Denemark <jdenemar@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      b66d1bef
    • P
      conf: add kvmclock timer · 5a137f36
      Paolo Bonzini 提交于
      Add kvmclock timer to documentation, schema and parsers.  Keep the
      platform timer first since it is kind of special, and alphabetize
      the others when possible (i.e. when it does not change the ABI).
      Reviewed-by: NJiri Denemark <jdenemar@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      5a137f36
    • P
      qemu: do not create useless <cpu> element · df8e6918
      Paolo Bonzini 提交于
      Avoid creating an empty <cpu> element when the QEMU command-line simply
      specifies the default "-cpu qemu32" or "-cpu qemu64".
      
      This requires the previous patch, which lets us represent "-cpu qemu32"
      as <os arch='i686'> in the generated XML.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      df8e6918
    • P
      qemu: get arch name from <cpu> element · d5e88b2c
      Paolo Bonzini 提交于
      The qemu32 CPU model is chosen based on the <os arch=...> name when
      creating the QEMU command line for a 64-bit host.  For the opposite
      transformation we can test the guest CPU model for the "lm" feature.
      If it is absent, def->os.arch needs to be corrected.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      d5e88b2c
    • P
      qemu: detect arch correctly for KVM · 4be541a6
      Paolo Bonzini 提交于
      When running under KVM, the arch is usually set to i686 because
      the name of the emulator is not qemu-system-x86_64.  Use the host
      arch instead.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      4be541a6
    • P
      x86: add kvm32 and kvm64, update qemu64 · ef00a05e
      Paolo Bonzini 提交于
      Recently (or not so recently) QEMU added the kvm32 and kvm64
      architectures, representing a least common denominator of all
      hosts that can run KVM.  Add them to the machine map.
      
      Also, some features that TCG supports were added to qemu64.
      Add them to the cpu_map.xml whenever KVM is guaranteed to support
      those.  We still have to leave some out, because they would not
      be available to guests running on older hosts.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      ef00a05e
    • P
      qemu: parse -enable-kvm · 4a00c099
      Paolo Bonzini 提交于
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      4a00c099
    • E
      qemu: require qmp on new enough qemu · 6e769eba
      Eric Blake 提交于
      The qemu developers have made it clear that modern qemu will no
      longer guarantee human monitor command stability; furthermore,
      some features, such as async events, are only supported via qmp.
      If we are compiled without support for handling JSON, we cannot
      expect to sanely interact with modern qemu.
      
      However, things must continue to build on RHEL 5, where qemu
      is stuck at 0.10, and where yajl is not available.
      
      Another benefit of this patch: future additions of new monitor
      commands need only focus on qemu_monitor_json.c, instead of
      also wasting time with qemu_monitor_text.c.
      
      * src/qemu/qemu_capabilities.c (qemuCapsComputeCmdFlags): Report
      error if yajl is missing but qemu requires qmp.
      (qemuCapsParseHelpStr): Propagate error.
      (qemuCapsExtractVersionInfo): Update caller.
      * tests/qemuhelptest.c (testHelpStrParsing): Likewise.
      6e769eba
    • E
      qemu: support qmp on RHEL/CentOS qemu · ff88cd59
      Eric Blake 提交于
      I'm getting tired of remembering to backport RHEL-specific
      patches when building upstream libvirt on RHEL 6.x or CentOS.
      All the affected versions of RHEL qemu-kvm have backported
      enough patches to a) make JSON useful, and b) modify the
      -help text to mention libvirt as the preferred interface;
      which means this string in the help output is a reliable
      indicator that we can outsmart a strict version check,
      even when upstream qemu 0.12 lacked the needed features.
      
      * src/qemu/qemu_capabilities.c (qemuCapsComputeCmdFlags):
      Recognize particular help string present when enough features were
      backported to be worth using JSON.
      * tests/qemuhelptest.c (mymain): Update tests accordingly.
      ff88cd59
    • S
      nwfilter: Rebuild filters only if new filter is different than current · 823b9033
      Stefan Berger 提交于
      Compare two filters' XML for equality and only rebuild/instantiate the new
      filter if the new and current filters are found to be different. This
      improves performance during an update of a filter with no obvious change
      or the reloading of filters during a 'kill -SIGHUP'
      823b9033
    • S
      nwfilter: Force instantiation of filters upon driver reload · 8fa78dd4
      Stefan Berger 提交于
      Introduce a function that rebuilds all running VMs' filters. Call
      this function when reloading the nwfilter driver.
      
      This addresses a problem introduced by the 2nd patch that typically
      causes no filters to be reinstantiate anymore upon driver reload
      since their XML has not changed. Yet the current behavior is that
      upon a SIGHUP all filters get reinstantiated.
      8fa78dd4
    • J
      qemu: Refactor qemuMonitorGetBlockInfo · 65c27e29
      Jiri Denemark 提交于
      QEMU always sends details about all available block devices as an answer
      for "info block"/"query-block" command. On the other hand, our
      qemuMonitorGetBlockInfo was made for a single block devices queries
      only. Thus, when asking for multiple devices, we asked qemu multiple
      times to always get the same answer from which different parts were
      filtered. This patch makes qemuMonitorGetBlockInfo return a hash table
      of all block devices, which may later be used for getting details about
      specific devices.
      65c27e29
    • J
      apparmor: Fix use of uninitialized random_data · bc1edeb6
      Jiri Denemark 提交于
      Without this, virt-aa-helper would segfault in -c or -r commands.
      bc1edeb6
    • M
      Update VIRT_CONTROL audit record with pid. · 98b01e8f
      Marcelo Cerri 提交于
      Added a new field "vm-pid" to the VIRT_CONTROL audit record. This information
      is useful to correlated another audit events to the events generated by
      libvirt.
      98b01e8f
    • E
      hash: minor touchups · 19896423
      Eric Blake 提交于
      On RHEL5, I got:
      util/virrandom.c:66: warning: nested extern declaration of '_gl_verify_function66' [-Wnested-externs]
      
      The fix is to hoist the verify earlier.  Also some other hodge-podge
      fixes I noticed while reviewing Dan's recent series.
      
      * .gitignore: Ignore new test.
      * src/util/cgroup.c: Bump copyright year.
      * src/util/virhash.c: Fix typo in description.
      * src/util/virrandom.c (virRandomBits): Mark doc comment, and
      hoist assert to silence older gcc.
      19896423
    • M
      util: Include stdint.h because of uint32_t · 89731907
      Michal Privoznik 提交于
      Some files are using uint32_t or int64_t without including
      stdint.h which defines them. Fix this.
      89731907
  3. 26 1月, 2012 11 次提交
    • D
      Remove tabs from libvirt_public.syms & enforce it · 1f7aa0ac
      Daniel P. Berrange 提交于
      * src/libvirt_public.syms: Death to tabs
      * cfg.mk: Check .syms files for tabs
      1f7aa0ac
    • D
      Replace hashing algorithm with murmurhash · 72b41397
      Daniel P. Berrange 提交于
      Recent discussions have illustrated the potential for DOS attacks
      with the hash table implementations used by most languages and
      libraries.
      
         https://lwn.net/Articles/474912/
      
      libvirt has an internal hash table impl, and uses hash tables for
      a variety of purposes. The hash key generation code is pretty
      simple and thus not strongly collision resistant.
      
      This patch replaces the current libvirt hash key generator with
      the (public domain) Murmurhash3 code. In addition every hash
      table now gets a random seed value which is used to perturb the
      hashing code. This should make it impossible to mount any
      practical attack against libvirt hashing code.
      
      * bootstrap.conf: Import bitrotate module
      * src/Makefile.am: Add virhashcode.[ch]
      * src/util/util.c: Make virRandom() return a fixed 32 bit
        integer value.
      * src/util/hash.c, src/util/hash.h, src/util/cgroup.c: Replace
        hash code generation with a call to virHashCodeGen()
      * src/util/virhashcode.h, src/util/virhashcode.c: Add a new
        virHashCodeGen() API using the Murmurhash3 algorithm.
      72b41397
    • D
      Rename hash.h and hash.c to virhash.h and virhash.c · 1d5c7a9f
      Daniel P. Berrange 提交于
      In preparation for the patch to include Murmurhash3, which
      introduces a virhashcode.h and virhashcode.c files, rename
      the existing hash.h and hash.c to virhash.h and virhash.c
      respectively.
      1d5c7a9f
    • D
      Convert various virHash functions to use size_t / uint32 · 9f2bf8fd
      Daniel P. Berrange 提交于
      In preparation for conversion over to use the Murmurhash3
      algorithm, convert various virHash APIs to use size_t or
      uint32 for their return values/parameters, instead of the
      variable size 'unsigned long' or 'int' types
      9f2bf8fd
    • D
      Introduce new API for generating random numbers · e95ef67b
      Daniel P. Berrange 提交于
      The old virRandom() API was not generating good random numbers.
      Replace it with a new API virRandomBits which instead of being
      told the upper limit, gets told the number of bits of randomness
      required.
      
      * src/util/virrandom.c, src/util/virrandom.h: Add virRandomBits,
        and move virRandomInitialize
      * src/util/util.h, src/util/util.c: Delete virRandom and
        virRandomInitialize
      * src/libvirt.c, src/security/security_selinux.c,
        src/test/test_driver.c, src/util/iohelper.c: Update for
        changes from virRandom to virRandomBits
      * src/storage/storage_backend_iscsi.c: Remove bogus call
        to virRandomInitialize & convert to virRandomBits
      e95ef67b
    • M
      storage: Support different wiping algorithms · adb99a05
      Michal Privoznik 提交于
      Currently, we support only filling a volume with zeroes on wiping.
      However, it is not enough as data might still be readable by
      experienced and equipped attacker. Many technical papers have been
      written, therefore we should support other wiping algorithms.
      adb99a05
    • M
      Cast pointer to int using intptr_t · d553554b
      Marc-André Lureau 提交于
      Fix a few warnings with mingw64 x86_64.
      d553554b
    • E
      build: fix header order on mingw · 3d5c139c
      Eric Blake 提交于
      In file included from ../gnulib/lib/unistd.h:51:0,
                       from ../src/util/util.h:30,
                       from rpc/virkeepalive.c:29:
      /usr/x86_64-w64-mingw32/sys-root/mingw/include/winsock2.h:15:2: warning: #warning Please include winsock2.h before windows.h [-Wcpp]
      
      Reported by Marc-André Lureau.
      
      * src/util/threads-win32.h (includes): Pick up winsock2.h before
      windows.h, as required by mingw64.
      3d5c139c
    • M
      errcode is typedef by mingw, rename an argument name · 75d3612e
      Marc-André Lureau 提交于
      Fixes the following warning:
      util/virterror.c:1242:31: warning: declaration of 'errcode' shadows a global declaration [-Wshadow]
      75d3612e
    • M
      Add missing virGetGroupName() · 5f1767e8
      Marc-André Lureau 提交于
      Add missing function if !HAVE_GETPWUID_R.
      5f1767e8
    • C
      storage: Fix any VolLookupByPath if we have an empty logical pool · 275155f6
      Cole Robinson 提交于
      On F16 at least, empty volume groups don't have a directory under /dev.
      The directory only appears once a logical volume is created.
      
      This tickles some behavior in BackendStablePath which ends with
      libvirt sleeping for 5 seconds while waiting for the directory to appear.
      This causes all sorts of problems for the virStorageVolLookupByPath API
      which virtinst uses, even if trying to resolve a path that is independent
      of the logical pool.
      
      In reality we don't even need to do that checking since logical pools
      always have a stable target path. Short circuit the polling in that
      case.
      
      Fixes bug 782261
      275155f6
  4. 25 1月, 2012 9 次提交
    • E
      lxc: export container=lxc-libvirt for systemd · 16dc4ade
      Eric Blake 提交于
      Systemd detects containers based on whether they have
      an environment variable starting with 'container=lxc';
      using a longer name fits the expectations, while also
      allowing detection of who created the container.
      
      Requested by Lennart Poettering, in response to
      https://bugs.freedesktop.org/show_bug.cgi?id=45175
      
      * src/lxc/lxc_container.c (lxcContainerBuildInitCmd): Add another
      env-var.
      16dc4ade
    • D
      Don't bind mount onto a char device for /dev/ptmx in LXC · c30a78c3
      Daniel P. Berrange 提交于
      The current setup code for LXC is bind mounting /dev/pts/ptmx
      on top of a character device /dev/ptmx. This is denied by SELinux
      policy and is just wrong. The target of a bind mount should just
      be a plain file
      
      * src/lxc/lxc_container.c: Don't bind /dev/pts/ptmx onto
        a char device
      c30a78c3
    • D
      Add virFileTouch for creating empty files · ef7efbc6
      Daniel P. Berrange 提交于
      Add a virFileTouch API which ensures that a file will always
      exist, even if zero length
      
      * src/util/virfile.c, src/util/virfile.h,
        src/libvirt_private.syms: Introduce virFileTouch
      ef7efbc6
    • M
      snapshots: Introduce VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE flag · 109593ec
      Michal Privoznik 提交于
      With this flag, virDomainSnapshotCreate will use fs-freeze and
      fs-thaw guest agent commands to quiesce guest's disks.
      109593ec
    • M
      qemu_agent: Create file system freeze and thaw functions · 29bce12a
      Michal Privoznik 提交于
      These functions simply issue command to guest agent which
      should freeze or unfreeze all file systems within guest.
      29bce12a
    • J
      qemu: Emit bootindex even for direct boot · 24a00149
      Jiri Denemark 提交于
      Direct boot (using kernel, initrd, and command line) is used by
      virt-install/virt-manager for network install. While any bootindex has
      no direct effect since -kernel is always first, we need it as a hint for
      SeaBIOS to present disks in the same order as they will be presented
      during normal boot.
      24a00149
    • E
      metadata: group metadata next to description · 4d71ff45
      Eric Blake 提交于
      It's better to group all the metadata together.  This is a
      cosmetic output change; since the RNG allows interleave, it
      doesn't matter where the user stuck it on input, and an XPath
      query will find the same information when parsing the output.
      
      * src/conf/domain_conf.c (virDomainDefFormatInternal): Output
      metadata earlier.
      * docs/formatdomain.html.in: Update documentation.
      * tests/domainsnapshotxml2xmlout/metadata.xml: Update test.
      * tests/qemuxml2xmloutdata/qemuxml2xmlout-metadata.xml: Likewise.
      4d71ff45
    • Z
      Allow custom metadata in domain configuration XML · fa981fc9
      Zeeshan Ali (Khattak) 提交于
      Applications can now insert custom nodes and hierarchies into domain
      configuration XML. Although currently not enforced, applications are
      required to use their own namespaces on every custom node they insert,
      with only one top-level element per namespace.
      fa981fc9
    • L
      virCommandProcessIO(): make poll() usage more robust · d19149dd
      Laszlo Ersek 提交于
      POLLIN and POLLHUP are not mutually exclusive. Currently the following
      seems possible: the child writes 3K to its stdout or stderr pipe, and
      immediately closes it. We get POLLIN|POLLHUP (I'm not sure that's possible
      on Linux, but SUSv4 seems to allow it). We read 1K and throw away the
      rest.
      
      When poll() returns and we're about to check the /revents/ member in a
      given array element, let's map all the revents bits to two (independent)
      ideas: "let's attempt to read()", and "let's attempt to write()". This
      should cover all errors, EOFs, and normal conditions; the read()/write()
      call should report any pending error.
      
      Under this approach, both POLLHUP and POLLERR are mapped to "needs read()"
      if we're otherwise prepared for POLLIN. POLLERR also maps to "needs
      write()" if we're otherwise prepared for POLLOUT. The rest of the mappings
      (POLLPRI etc.) would be easy, but probably useless for pipes.
      
      Additionally, SUSv4 doesn't appear to forbid POLLIN|POLLERR (or
      POLLOUT|POLLERR) set simultaneously. One could argue that the read() or
      write() call would return without blocking in these cases (with an error),
      so POLLIN / POLLOUT would be justified beside POLLERR.
      
      The code now penalizes POLLIN|POLLERR differently from plain POLLERR. The
      former (ie. read() returning -1) is terminal and we jump to cleanup, while
      plain POLLERR masks only the affected file descriptor for the future.
      Let's unify those.
      Signed-off-by: NLaszlo Ersek <lersek@redhat.com>
      d19149dd
  5. 24 1月, 2012 3 次提交
    • A
      src/datatypes.h: fix typo · 3f0a757e
      Alon Levy 提交于
      Signed-off-by: NAlon Levy <alevy@redhat.com>
      3f0a757e
    • D
      Wire up QEMU agent to reboot/shutdown APIs · fb52a399
      Daniel P. Berrange 提交于
      This makes use of the QEMU guest agent to implement the
      virDomainShutdownFlags and virDomainReboot APIs. With
      no flags specified, it will prefer to use the agent, but
      fallback to ACPI. Explicit choice can be made by using
      a suitable flag
      
      * src/qemu/qemu_driver.c: Wire up use of agent
      fb52a399
    • D
      Add new virDomainShutdownFlags API · 0b7ddf9e
      Daniel P. Berrange 提交于
      Add a new API virDomainShutdownFlags and define:
      
          VIR_DOMAIN_SHUTDOWN_DEFAULT        = 0,
          VIR_DOMAIN_SHUTDOWN_ACPI_POWER_BTN = (1 << 0),
          VIR_DOMAIN_SHUTDOWN_GUEST_AGENT    = (1 << 1),
      
      Also define some flags for the reboot API
      
          VIR_DOMAIN_REBOOT_DEFAULT        = 0,
          VIR_DOMAIN_REBOOT_ACPI_POWER_BTN = (1 << 0),
          VIR_DOMAIN_REBOOT_GUEST_AGENT    = (1 << 1),
      
      Although these two APIs currently have the same flags, using
      separate enums allows them to expand separately in the future.
      
      Add stub impls of the new API for all existing drivers
      0b7ddf9e