1. 28 1月, 2012 3 次提交
  2. 27 1月, 2012 1 次提交
    • 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
  3. 26 1月, 2012 1 次提交
    • 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
  4. 25 1月, 2012 1 次提交
  5. 20 1月, 2012 2 次提交
    • E
      error: drop old-style error reporting · c2551bea
      Eric Blake 提交于
      While we still don't want to enable gcc's new -Wformat-literal
      warning, I found a rather easy case where the warning could be
      reduced, by getting rid of obsolete error-reporting practices.
      This is the last place where we were passing the (unused) net
      and conn arguments for constructing an error.
      
      * src/util/virterror_internal.h (virErrorMsg): Delete prototype.
      (virReportError): Delete macro.
      * src/util/virterror.c (virErrorMsg): Make static.
      * src/libvirt_private.syms (virterror_internal.h): Drop export.
      * src/util/conf.c (virConfError): Convert to macro.
      (virConfErrorHelper): New function, and adjust error calls.
      * src/xen/xen_hypervisor.c (virXenErrorFunc): Delete.
      (xenHypervisorGetSchedulerType)
      (xenHypervisorGetSchedulerParameters)
      (xenHypervisorSetSchedulerParameters)
      (xenHypervisorDomainBlockStats)
      (xenHypervisorDomainInterfaceStats)
      (xenHypervisorDomainGetOSType)
      (xenHypervisorNodeGetCellsFreeMemory, xenHypervisorGetVcpus):
      Update callers.
      c2551bea
    • E
      util: add new file for virTypedParameter utils · 61ca98b0
      Eric Blake 提交于
      Preparation for another patch that refactors common patterns
      into the new file for fewer lines of code overall.
      
      * src/util/util.h (virTypedParameterArrayClear): Move...
      * src/util/virtypedparam.h: ...to new file.
      (virTypedParameterArrayValidate, virTypedParameterAssign): New
      prototypes.
      * src/util/util.c (virTypedParameterArrayClear): Likewise.
      * src/util/virtypedparam.c: New file.
      * po/POTFILES.in: Mark file for translation.
      * src/Makefile.am (UTIL_SOURCES): Build it.
      * src/libvirt_private.syms (util.h): Split...
      (virtypedparam.h): to new section.
      (virkeycode.h): Sort.
      * daemon/remote.c: Adjust callers.
      * tools/virsh.c: Likewise.
      61ca98b0
  6. 19 1月, 2012 2 次提交
  7. 18 1月, 2012 2 次提交
    • D
      Fix startup of LXC containers with filesystems containing symlinks · c53ba61b
      Daniel P. Berrange 提交于
      Given an LXC guest with a root filesystem path of
      
        /export/lxc/roots/helloworld/root
      
      During startup, we will pivot the root filesystem to end up
      at
      
        /.oldroot/export/lxc/roots/helloworld/root
      
      We then try to open
      
        /.oldroot/export/lxc/roots/helloworld/root/dev/pts
      
      Now consider if '/export/lxc' is an absolute symlink pointing
      to '/media/lxc'. The kernel will try to open
      
        /media/lxc/roots/helloworld/root/dev/pts
      
      whereas it should be trying to open
      
        /.oldroot//media/lxc/roots/helloworld/root/dev/pts
      
      To deal with the fact that the root filesystem can be moved,
      we need to resolve symlinks in *any* part of the filesystem
      source path.
      
      * src/libvirt_private.syms, src/util/util.c,
        src/util/util.h: Add virFileResolveAllLinks to resolve
        all symlinks in a path
      * src/lxc/lxc_container.c: Resolve all symlinks in filesystem
        paths during startup
      c53ba61b
    • D
      Add new attribute wrpolicy to <driver> element · d9e0d820
      Deepak C Shetty 提交于
      This introduces new attribute wrpolicy with only supported
      value as immediate. This will be an optional
      attribute with no defaults. This helps specify whether
      to skip the host page cache.
      
      When wrpolicy is specified, meaning when wrpolicy=immediate
      a writeback is explicitly initiated for the dirty pages in
      the host page cache as part of the guest file write operation.
      
      Usage:
      <filesystem type='mount' accessmode='passthrough'>
        <driver type='path' wrpolicy='immediate'/>
        <source dir='/export/to/guest'/>
        <target dir='mount_tag'/>
      </filesystem>
      
      Currently this only works with type='mount' for the QEMU/KVM driver.
      Signed-off-by: NDeepak C Shetty <deepakcs@linux.vnet.ibm.com>
      d9e0d820
  8. 17 1月, 2012 2 次提交
    • J
      qemu: Add support for host CPU modes · e7201afd
      Jiri Denemark 提交于
      This adds support for host-model and host-passthrough CPU modes to qemu
      driver. The host-passthrough mode is mapped to -cpu host.
      e7201afd
    • J
      cpu: Update guest CPU in host-* mode · 277bc0dc
      Jiri Denemark 提交于
      VIR_DOMAIN_XML_UPDATE_CPU flag for virDomainGetXMLDesc may be used to
      get updated custom mode guest CPU definition in case it depends on host
      CPU. This patch implements the same behavior for host-model and
      host-passthrough CPU modes.
      277bc0dc
  9. 13 1月, 2012 2 次提交
  10. 11 1月, 2012 2 次提交
    • S
      Address side effects of accessing vars via index · 64484d55
      Stefan Berger 提交于
      Address side effect of accessing a variable via an index: Filters
      accessing a variable where an element is accessed that is beyond the
      size of the list (for example $TEST[10] and only 2 elements are available)
      cannot instantiate that filter. Test for this and report proper error
      to user.
      64484d55
    • S
      Introduce possibility to have an iterator per variable · 80e9a5cd
      Stefan Berger 提交于
      This patch introduces the capability to use a different iterator per
      variable.
      
      The currently supported notation of variables in a filtering rule like
      
        <rule action='accept' direction='out'>
           <tcp  srcipaddr='$A' srcportstart='$B'/>
        </rule>
      
      processes the two lists 'A' and 'B' in parallel. This means that A and B
      must have the same number of 'N' elements and that 'N' rules will be 
      instantiated (assuming all tuples from A and B are unique).
      
      In this patch we now introduce the assignment of variables to different
      iterators. Therefore a rule like
      
        <rule action='accept' direction='out'>
           <tcp  srcipaddr='$A[@1]' srcportstart='$B[@2]'/>
        </rule>
      
      will now create every combination of elements in A with elements in B since
      A has been assigned to an iterator with Id '1' and B has been assigned to an
      iterator with Id '2', thus processing their value independently.
      
      The first rule has an equivalent notation of
      
        <rule action='accept' direction='out'>
           <tcp  srcipaddr='$A[@0]' srcportstart='$B[@0]'/>
        </rule>
      80e9a5cd
  11. 03 1月, 2012 1 次提交
    • E
      domiftune: clean up previous patches · 269ce467
      Eric Blake 提交于
      Most severe here is a latent (but currently untriggered) memory leak
      if any hypervisor ever adds a string interface property; the
      remainder are mainly cosmetic.
      
      * include/libvirt/libvirt.h.in (VIR_DOMAIN_BANDWIDTH_*): Move
      macros closer to interface that uses them, and document type.
      * src/libvirt.c (virDomainSetInterfaceParameters)
      (virDomainGetInterfaceParameters): Formatting tweaks.
      * daemon/remote.c (remoteDispatchDomainGetInterfaceParameters):
      Avoid memory leak.
      * src/libvirt_public.syms (LIBVIRT_0.9.9): Sort lines.
      * src/libvirt_private.syms (domain_conf.h): Likewise.
      * src/qemu/qemu_driver.c (qemuDomainSetInterfaceParameters): Fix
      comments, break long lines.
      269ce467
  12. 29 12月, 2011 1 次提交
  13. 25 12月, 2011 1 次提交
  14. 21 12月, 2011 1 次提交
  15. 19 12月, 2011 4 次提交
    • D
      Hide use of timers for domain event dispatch · 34ad1353
      Daniel P. Berrange 提交于
      Currently all drivers using domain events need to provide a callback
      for handling a timer to dispatch events in a clean stack. There is
      no technical reason for dispatch to go via driver specific code. It
      could trivially be dispatched directly from the domain event code,
      thus removing tedious boilerplate code from all drivers
      
      Also fix the libxl & xen drivers to pass 'true' when creating the
      virDomainEventState, since they run inside the daemon & thus always
      expect events to be present.
      
      * src/conf/domain_event.c, src/conf/domain_event.h: Internalize
        dispatch of events from timer callback
      * src/libxl/libxl_driver.c, src/lxc/lxc_driver.c,
        src/qemu/qemu_domain.c, src/qemu/qemu_driver.c,
        src/remote/remote_driver.c, src/test/test_driver.c,
        src/uml/uml_driver.c, src/vbox/vbox_tmpl.c,
        src/xen/xen_driver.c: Remove all timer dispatch functions
      34ad1353
    • D
      Remove decl of all APIs related to domain event callbacks & queues · 2c2d5337
      Daniel P. Berrange 提交于
      The virDomainEventCallbackList and virDomainEventQueue APIs are
      now solely helpers used internally by virDomainEventState APIs.
      Remove their decls from domain_event.h since no driver code should
      need to use them any more.
      
      * src/conf/domain_event.c: Make virDomainEventCallbackList and
        virDomainEventQueue APIs static & remove some unused APIs
      * src/conf/domain_event.h, src/libvirt_private.syms: Remove
        virDomainEventCallbackList and virDomainEventQueue APIs
      2c2d5337
    • D
      Add APIs to allow management of callbacks purely with virDomainEventState · 4f5326c3
      Daniel P. Berrange 提交于
      While virDomainEventState has APIs for managing removal of callbacks,
      while locked, adding callbacks in the first place requires direct
      access to the virDomainEventCallbackList structure. This is not
      threadsafe since it is bypassing the virDomainEventState locks
      
      * src/conf/domain_event.c, src/conf/domain_event.h,
        src/libvirt_private.syms: Add APIs for managing callbacks
        via virDomainEventState.
      4f5326c3
    • D
      Return count of callbacks when registering callbacks · d09f6ba5
      Daniel P. Berrange 提交于
      When registering a callback for a particular event some callers
      need to know how many callbacks already exist for that event.
      While it is possible to ask for a count, this is not free from
      race conditions when threaded. Thus the API for registering
      callbacks should return the count of callbacks. Also rename
      virDomainEventStateDeregisterAny to virDomainEventStateDeregisterID
      
      * src/conf/domain_event.c, src/conf/domain_event.h,
        src/libvirt_private.syms: Return count of callbacks when
        registering callbacks
      * src/libxl/libxl_driver.c, src/libxl/libxl_driver.c,
        src/qemu/qemu_driver.c, src/remote/remote_driver.c,
        src/remote/remote_driver.c, src/uml/uml_driver.c,
        src/vbox/vbox_tmpl.c, src/xen/xen_driver.c: Update
        for change in APIs
      d09f6ba5
  16. 14 12月, 2011 1 次提交
  17. 08 12月, 2011 1 次提交
    • E
      build: fix build with older libxml2 · f59a9417
      Eric Blake 提交于
      On RHEL 5, with libxml2-2.6.26, the build failed with:
      virsh.c: In function 'vshNodeIsSuperset':
      virsh.c:11951: warning: implicit declaration of function 'xmlChildElementCount'
      
      (or if warnings aren't errors, a link failure later on).
      
      * src/util/xml.h (virXMLChildElementCount): New prototype.
      * src/util/xml.c (virXMLChildElementCount): New function.
      * src/libvirt_private.syms (xml.h): Export it.
      * tools/virsh.c (vshNodeIsSuperset): Use it.
      f59a9417
  18. 05 12月, 2011 1 次提交
  19. 30 11月, 2011 6 次提交
    • D
      Remove time APIs from src/util/util.h · a8bb75a3
      Daniel P. Berrange 提交于
      The virTimestamp and virTimeMs functions in src/util/util.h
      duplicate functionality from virtime.h, in a non-async signal
      safe manner. Remove them, and convert all code over to the new
      APIs.
      
      * src/util/util.c, src/util/util.h: Delete virTimeMs and virTimestamp
      * src/lxc/lxc_driver.c, src/qemu/qemu_domain.c,
        src/qemu/qemu_driver.c, src/qemu/qemu_migration.c,
        src/qemu/qemu_process.c, src/util/event_poll.c: Convert to use
        virtime APIs
      a8bb75a3
    • D
      Add internal APIs for dealing with time · 3ec12898
      Daniel P. Berrange 提交于
      The logging APIs need to be able to generate formatted timestamps
      using only async signal safe functions. This rules out using
      gmtime/localtime/malloc/gettimeday(!) and much more.
      
      Introduce a new internal API which is async signal safe.
      
        virTimeMillisNowRaw replacement for gettimeofday. Uses clock_gettime
                            where available, otherwise falls back to the unsafe
                            gettimeofday
      
        virTimeFieldsNowRaw  replacements for gmtime(), convert a timestamp
        virTimeFieldsThenRaw into a broken out set of fields. No localtime()
                             replacement is provided, because converting to
                             local time is not practical with only async signal
                             safe APIs.
      
        virTimeStringNowRaw  replacements for strftime() which print a timestamp
        virTimeStringThenRaw into a string, using a pre-determined format, with
                             a fixed size buffer (VIR_TIME_STRING_BUFLEN)
      
      For each of these there is also a version without the Raw postfix
      which raises a full libvirt error. These versions are not async
      signal safe
      
      * src/Makefile.am, src/util/virtime.c, src/util/virtime.h: New files
      * src/libvirt_private.syms: New APis
      * configure.ac: Check for clock_gettime in -lrt
      * tests/virtimetest.c, tests/Makefile.am: Test new APIs
      3ec12898
    • D
      Remove obsolete virGetPMCapabilities sym from private symbols file · 380110cf
      Daniel P. Berrange 提交于
      Fix the build on Mingw32 by removing the now obsolete
      virGetPMCapabilities symbol from the private exports file
      
      * src/libvirt_private.syms: Remove virGetPMCapabilities
      380110cf
    • D
      Add export of node suspend capabilities APIs · f5272027
      Daniel P. Berrange 提交于
      * src/libvirt_private.syms: Export virNodeSuspendSupportsTarget
        and virNodeSuspendGetTargetMask
      f5272027
    • H
      blkiotune: add qemu support for blkiotune.device_weight · 93ab5859
      Hu Tao 提交于
      Implement setting/getting per-device blkio weights in qemu,
      using the cgroups blkio.weight_device tunable.
      93ab5859
    • H
      blkiotune: add interface for blkiotune.device_weight · 6ac81c8e
      Hu Tao 提交于
      This adds per-device weights to <blkiotune>.  Note that the
      cgroups implementation only supports weights per block device,
      and not per-file within the device; hence this option must be
      global to the domain definition rather than tied to individual
      <devices>/<disk> entries:
      
      <domain ...>
        <blkiotune>
          <device>
            <path>/path/to/block</path>
            <weight>1000</weight>
          </device>
        </blkiotune>
      ..
      
      This patch also adds a parameter --device-weights to virsh command
      blkiotune for setting/getting blkiotune.weight_device for any
      hypervisor that supports it.  All <device> entries under
      <blkiotune> are concatenated into a single string attribute under
      virDomain{Get,Set}BlkioParameters, named "device_weight".
      Signed-off-by: NHu Tao <hutao@cn.fujitsu.com>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      6ac81c8e
  20. 29 11月, 2011 1 次提交
    • S
      Implement the core API to suspend/resume the host · 4ddb37c3
      Srivatsa S. Bhat 提交于
      Add the core functions that implement the functionality of the API.
      Suspend is done by using an asynchronous mechanism so that we can return
      the status to the caller before the host gets suspended. This asynchronous
      operation is achieved by suspending the host in a separate thread of
      execution. However, returning the status to the caller is only best-effort,
      but not guaranteed.
      
      To resume the host, an RTC alarm is set up (based on how long we want to
      suspend) before suspending the host. When this alarm fires, the host
      gets woken up.
      
      Suspend-to-RAM operation on a host running Linux can take upto more than 20
      seconds, depending on the load of the system. (Freezing of tasks, an operation
      preceding any suspend operation, is given up after a 20 second timeout).
      And Suspend-to-Disk can take even more time, considering the time required
      for compaction, creating the memory image and writing it to disk etc.
      So, we do not allow the user to specify a suspend duration of less than 60
      seconds, to be on the safer side, since we don't want to prematurely declare
      failure when we only had to wait for some more time.
      4ddb37c3
  21. 24 11月, 2011 1 次提交
  22. 23 11月, 2011 2 次提交
    • S
      Enable detection of multiple IP addresses · ad6c67cf
      Stefan Berger 提交于
      In preparation of DHCP Snooping and the detection of multiple IP
      addresses per interface:
      
      The hash table that is used to collect the detected IP address of an
      interface can so far only handle one IP address per interface. With
      this patch we extend this to allow it to handle a list of IP addresses.
      
      Above changes the returned variable type of virNWFilterGetIpAddrForIfname()
      from char * to virNWFilterVarValuePtr; adapt all existing functions calling
      this function.
      ad6c67cf
    • S
      Add support for STP filtering · ba3bf00a
      Stefan Berger 提交于
      This patch adds support for filtering of STP (spanning tree protocol) traffic
      to the parser and makes us of the ebtables support for STP filtering. This code
      now enables the filtering of traffic in chains with prefix 'stp'.
      Signed-off-by: NStefan Berger <stefanb@linux.vnet.ibm.com>
      ba3bf00a
  23. 22 11月, 2011 1 次提交
    • S
      Export KVM Host Power Management capabilities · e352b164
      Srivatsa S. Bhat 提交于
      This patch exports KVM Host Power Management capabilities as XML so that
      higher-level systems management software can make use of these features
      available in the host.
      
      The script "pm-is-supported" (from pm-utils package) is run to discover if
      Suspend-to-RAM (S3) or Suspend-to-Disk (S4) is supported by the host.
      If either of them are supported, then a new tag "<power_management>" is
      introduced in the XML under the <host> tag.
      
      However in case the query to check for power management features succeeded,
      but the host does not support any such feature, then the XML will contain
      an empty <power_management/> tag. In the event that the PM query itself
      failed, the XML will not contain any "power_management" tag.
      
      To use this, new APIs could be implemented in libvirt to exploit power
      management features such as S3/S4.
      e352b164