1. 19 2月, 2014 1 次提交
  2. 18 2月, 2014 4 次提交
  3. 14 2月, 2014 2 次提交
  4. 13 2月, 2014 1 次提交
    • C
      Improve virConf parse to handle LXC config format · 3daa1483
      Cédric Bosdonnat 提交于
      virConf now honours a VIR_CONF_FLAG_LXC_FORMAT flag to handle LXC
      configuration files. The differences are that property names can
      contain '.' character and values are all strings without any bounding
      quotes.
      
      Provide a new virConfWalk function calling a handler on all non-comment
      values. This function will be used by the LXC conversion code to loop
      over LXC configuration lines.
      3daa1483
  5. 07 2月, 2014 1 次提交
  6. 04 2月, 2014 1 次提交
    • J
      utils: Introduce functions for kernel module manipulation · 4a2179ea
      John Ferlan 提交于
      virKModConfig()        - Return a buffer containing kernel module configuration
      virKModLoad()          - Load a specific module into the kernel configuration
      virKModUnload()        - Unload a specific module from the kernel configuration
      virKModIsBlacklisted() - Determine whether a module is blacklisted within
                               the kernel configuration
      4a2179ea
  7. 31 1月, 2014 2 次提交
    • D
      Push nwfilter update locking up to top level · 6e5c79a1
      Daniel P. Berrange 提交于
      The NWFilter code has as a deadlock race condition between
      the virNWFilter{Define,Undefine} APIs and starting of guest
      VMs due to mis-matched lock ordering.
      
      In the virNWFilter{Define,Undefine} codepaths the lock ordering
      is
      
        1. nwfilter driver lock
        2. virt driver lock
        3. nwfilter update lock
        4. domain object lock
      
      In the VM guest startup paths the lock ordering is
      
        1. virt driver lock
        2. domain object lock
        3. nwfilter update lock
      
      As can be seen the domain object and nwfilter update locks are
      not acquired in a consistent order.
      
      The fix used is to push the nwfilter update lock upto the top
      level resulting in a lock ordering for virNWFilter{Define,Undefine}
      of
      
        1. nwfilter driver lock
        2. nwfilter update lock
        3. virt driver lock
        4. domain object lock
      
      and VM start using
      
        1. nwfilter update lock
        2. virt driver lock
        3. domain object lock
      
      This has the effect of serializing VM startup once again, even if
      no nwfilters are applied to the guest. There is also the possibility
      of deadlock due to a call graph loop via virNWFilterInstantiate
      and virNWFilterInstantiateFilterLate.
      
      These two problems mean the lock must be turned into a read/write
      lock instead of a plain mutex at the same time. The lock is used to
      serialize changes to the "driver->nwfilters" hash, so the write lock
      only needs to be held by the define/undefine methods. All other
      methods can rely on a read lock which allows good concurrency.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      6e5c79a1
    • D
      Add a read/write lock implementation · c065984b
      Daniel P. Berrange 提交于
      Add virRWLock backed up by a POSIX rwlock primitive
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      c065984b
  8. 30 1月, 2014 3 次提交
    • O
      qemu: Don't fail if the SCSI host device is shareable between domains · fd243fc4
      Osier Yang 提交于
      It doesn't make sense to fail if the SCSI host device is specified
      as "shareable" explicitly between domains (NB, it works if and only
      if the device is specified as "shareable" for *all* domains,
      otherwise it fails).
      
      To fix the problem, this patch introduces an array for virSCSIDevice
      struct, which records all the names of domain which are using the
      device (note that the recorded domains must specify the device as
      shareable).  And the change on the data struct brings on many
      subsequent changes in the code.
      
      Prior to this patch, the "shareable" tag didn't work as expected,
      it actually work like "non-shareable".  So this patch also added notes
      in formatdomain.html to declare the fact.
      
      * src/util/virscsi.h:
        - Remove virSCSIDeviceGetUsedBy
        - Change definition of virSCSIDeviceGetUsedBy and virSCSIDeviceListDel
        - Add virSCSIDeviceIsAvailable
      
      * src/util/virscsi.c:
        - struct virSCSIDevice: Change "used_by" to be an array; Add
          "n_used_by" as the array count
        - virSCSIDeviceGetUsedBy: Removed
        - virSCSIDeviceFree: frees the "used_by" array
        - virSCSIDeviceSetUsedBy: Copy the domain name to avoid potential
          memory corruption
        - virSCSIDeviceIsAvailable: New
        - virSCSIDeviceListDel: Change the logic, for device which is already
          in the list, just remove the corresponding entry in "used_by". And
          since it's only used in one place, we can safely removing the code
          to find out the dev in the list first.
        - Copyright updating
      
      * src/libvirt_private.sys:
        - virSCSIDeviceGetUsedBy: Remove
        - virSCSIDeviceIsAvailable: New
      
      * src/qemu/qemu_hostdev.c:
        - qemuUpdateActiveScsiHostdevs: Check if the device existing before
          adding it to the list;
        - qemuPrepareHostdevSCSIDevices: Error out if the not all domains
          use the device as "shareable"; Also don't try to add the device
          to the activeScsiHostdevs list if it already there; And make
          more sensible error w.r.t the current "shareable" value in
          driver->activeScsiHostdevs.
        - qemuDomainReAttachHostScsiDevices: Change the logic according
          to the changes on helpers.
      Signed-off-by: NOsier Yang <jyang@redhat.com>
      fd243fc4
    • M
      Revert "networkAllocateActualDevice: Set QoS for bridgeless networks too" · 122cd169
      Michal Privoznik 提交于
      This reverts commit 2996e6be
      and some parts of 2636dc8c.
      
      The former one tried to implement QoS setting on bridgeless networks.
      However, as discussed upstream [1], the patch is far away from being
      useful in even a single case. The whole idea of network QoS is to have
      aggregated limits over several interfaces. This patch is doing
      completely the opposite when merging two QoS settings (from the network
      and the domain interface) into one which is then set at the domain
      interface itself, not the network.
      
      The latter one is the test for the previous one. Now none of them makes
      sense.
      
      1: https://www.redhat.com/archives/libvir-list/2014-January/msg01441.html
      
      Conflicts:
      	tests/virnetdevbandwidthtest.c: New test has been introduced since
          then.
      122cd169
    • M
      virCommand: Introduce virCommandSetDryRun · 550a2cef
      Michal Privoznik 提交于
      There are some units within libvirt that utilize virCommand API to run
      some commands and deserve own unit testing. These units are, however,
      not desired to be rewritten to dig virCommand API usage out. As a great
      example virNetDevBandwidth could be used. The problem with the bandwidth
      unit is: it uses virCommand API heavily. Therefore we need a mechanism
      to not really run a command, but rather see its string representation
      after which we can decide if the unit construct the correct sequence of
      commands or not.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      550a2cef
  9. 27 1月, 2014 1 次提交
    • M
      networkAllocateActualDevice: Set QoS for bridgeless networks too · 2996e6be
      Michal Privoznik 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1055484
      
      Currently, libvirt's XML schema of network allows QoS to be defined for
      every network even though it has no bridge. For instance:
      
      <network>
          <name>vdsm-no-bridge</name>
          <forward mode='passthrough'>
            <interface dev='em1.10'/>
          </forward>
          <bandwidth>
              <inbound average='1000' peak='5000' burst='1024'/>
              <outbound average='1000' burst='1024'/>
          </bandwidth>
      </network>
      
      The bandwidth limitations can be, however, applied even on such
      networks. In fact, they are going to be applied on the interface that
      will be connected to the network on a domain startup. This approach,
      however, has one limitation. With bridged networks, there are two points
      where QoS can be set: bridge and domain interface. The lower limit of
      the two is enforced then. For instance, if the interface has 10Mbps
      average, but the network only 1Mbps, there's no way for interface to
      transmit packets faster than the 1Mbps limit. With two points this is
      enforced by kernel.  With only one point, we must combine both QoS
      settings into one which is set afterwards. Look at
      virNetDevBandwidthMinimal() and you'll understand immediately what I
      mean.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      2996e6be
  10. 23 1月, 2014 1 次提交
    • O
      util: Add "shareable" field for virSCSIDevice struct · 2b66504d
      Osier Yang 提交于
      Unlike the host devices of other types, SCSI host device XML supports
      "shareable" tag. This patch introduces it for the virSCSIDevice struct
      for a later patch use (to detect if the SCSI device is shareable when
      preparing the SCSI host device in QEMU driver).
      2b66504d
  11. 21 1月, 2014 1 次提交
    • F
      spice: expose the QEMU disable file transfer option · 08d07e5f
      Francesco Romani 提交于
      spice-server offers an API to disable file transfer messages
      on the agent channel between the client and the guest.
      This is supported in qemu through the disable-agent-file-xfer option.
      
      This patch exposes this option to libvirt.
      Adds a new element 'filetransfer', with one property,
      'enable', which accepts a boolean.
      Default is enabled, for backward compatibility.
      
      Depends on the capability exported in the first patch of the series.
      Signed-off-by: NFrancesco Romani <fromani@redhat.com>
      08d07e5f
  12. 20 1月, 2014 2 次提交
  13. 16 1月, 2014 1 次提交
    • E
      event: add notion of remoteID for filtering client network events · a59097e5
      Eric Blake 提交于
      In order to mirror a server with per-object filtering, the client
      needs to track which server callbackID is servicing the client
      callback.  This patch introduces the notion of a serverID, as
      well as the plumbing to use it for network events, although the
      actual complexity of using per-object filtering in the remote
      driver is deferred to a later patch.
      
      * src/conf/object_event.h (virObjectEventStateEventID): Add parameter.
      (virObjectEventStateQueueRemote, virObjectEventStateSetRemote):
      New prototypes.
      (virObjectEventStateRegisterID): Move...
      * src/conf/object_event_private.h: ...here, and add parameter.
      (_virObjectEvent): Add field.
      * src/conf/network_event.h (virNetworkEventStateRegisterClient): New
      prototype.
      * src/conf/object_event.c (_virObjectEventCallback): Add field.
      (virObjectEventStateSetRemote): New function.
      (virObjectEventStateQueue): Make wrapper around...
      (virObjectEventStateQueueRemote): New function.
      (virObjectEventCallbackListCount): Tweak return count when remote
      id matching is used.
      (virObjectEventCallbackLookup, virObjectEventStateRegisterID):
      Tweak registration when remote id matching will be used.
      (virObjectEventNew): Default to no remote id.
      (virObjectEventCallbackListAddID): Likewise, but set remote id
      when one is available.
      (virObjectEventCallbackListRemoveID)
      (virObjectEventCallbackListMarkDeleteID): Adjust return value when
      remote id was set.
      (virObjectEventStateEventID): Query existing id.
      (virObjectEventDispatchMatchCallback): Require matching event id.
      (virObjectEventStateCallbackID): Adjust caller.
      * src/conf/network_event.c (virNetworkEventStateRegisterClient): New
      function.
      (virNetworkEventStateRegisterID): Update caller.
      * src/conf/domain_event.c (virDomainEventStateRegister)
      (virDomainEventStateRegisterID): Update callers.
      * src/remote/remote_driver.c
      (remoteConnectNetworkEventRegisterAny)
      (remoteConnectNetworkEventDeregisterAny)
      (remoteConnectDomainEventDeregisterAny): Likewise.
      (remoteEventQueue): Hoist earlier to avoid forward declaration,
      and add parameter.  Adjust all callers.
      * src/libvirt_private.syms (conf/object_event.h): Drop function.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      a59097e5
  14. 08 1月, 2014 1 次提交
    • L
      Fix bridge configuration when OUTPUT policy is DROP on the host · 538daf7f
      Lénaïc Huard 提交于
      When the host is configured with very restrictive firewall (default policy
      is DROP for all chains, including OUTPUT), the bridge driver for Linux
      adds netfilter entries to allow DHCP and DNS requests to go from the VM
      to the dnsmasq of the host.
      
      The issue that this commit fixes is the fact that a DROP policy on the OUTPUT
      chain blocks the DHCP replies from the host’s dnsmasq to the VM.
      As DHCP replies are sent in UDP, they are not caught by any --ctstate ESTABLISHED
      rule and so, need to be explicitly allowed.
      Signed-off-by: NLénaïc Huard <lenaic@lhuard.fr.eu.org>
      538daf7f
  15. 04 1月, 2014 1 次提交
    • E
      event: fix doc typos, and doc more public methods · 6742fb0b
      Eric Blake 提交于
      While working on events, I found a number of minor issues; I'm
      hoisting these to the front rather than doing it piecemeal in
      the patches where I first noticed bad or missing documentation.
      
      * src/conf/object_event.c: Fix grammar, document all parameters
      of public functions, wrap some long lines.
      * src/conf/object_event.h: Likewise.
      * src/conf/network_event.c: Likewise.
      * src/conf/domain_event.c: Likewise (except for the large number
      of event creation functions).
      * src/libvirt_private.cyms (conf/object_event.h): Split...
      (conf/network_event.h): ...to account for new file.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      6742fb0b
  16. 12 12月, 2013 1 次提交
  17. 11 12月, 2013 1 次提交
    • C
      Added Network events API and virNetworkEventLifecycle. · 9ff38c54
      Cédric Bosdonnat 提交于
      Define the public API for (de-)registering network events
      and the callbacks for receiving lifecycle events. The lifecycle
      event includes a 'detail' parameter to match the domain lifecycle
      event data, but this is currently unused.
      
      The network events related code goes into its own set of internal
      files src/conf/network_event.[ch]
      9ff38c54
  18. 10 12月, 2013 5 次提交
  19. 03 12月, 2013 1 次提交
    • P
      qemu: Refactor qemuTranslateDiskSourcePool · e1a4d08b
      Peter Krempa 提交于
      Before this patch, the translation function still needs a second ugly
      helper function to actually format the command line for qemu. But if we
      do the right stuff in the translation function, we don't have to bother
      with the second function any more.
      
      This patch removes the messy qemuBuildVolumeString function and changes
      qemuTranslateDiskSourcePool to set stuff up correctly so that the
      regular code paths meant for volumes can be used to format the command
      line correctly.
      
      For this purpose a new helper "qemuDiskGetActualType()" is introduced to
      return the type of the volume in a pool.
      
      As a part of the refactor the qemuTranslateDiskSourcePool function is
      fixed to do decisions based on the pool type instead of the volume type.
      This allows to separate pool-type-specific stuff more clearly and will
      ease addition of other pool types that will require certain other
      operations to get the correct pool source.
      
      The previously fixed tests should make sure that we don't break stuff
      that was working before.
      e1a4d08b
  20. 02 12月, 2013 2 次提交
  21. 28 11月, 2013 2 次提交
  22. 27 11月, 2013 1 次提交
  23. 12 11月, 2013 1 次提交
  24. 07 11月, 2013 3 次提交
    • E
      storage: always probe type with buffer · 348b4e25
      Eric Blake 提交于
      This gets rid of another stat() per volume, as well as cutting
      bytes read in half, when populating the volumes of a directory
      pool during a pool refresh.  Not to mention that it provides an
      interface that can let gluster pools also probe file types.
      
      * src/util/virstoragefile.h (virStorageFileProbeFormatFromFD):
      Delete.
      (virStorageFileProbeFormatFromBuf): New prototype.
      (VIR_STORAGE_MAX_HEADER): New constant, based on...
      * src/util/virstoragefile.c (STORAGE_MAX_HEAD): ...old name.
      (vmdk4GetBackingStore, virStorageFileGetMetadataInternal)
      (virStorageFileProbeFormat): Adjust clients.
      (virStorageFileProbeFormatFromFD): Delete.
      (virStorageFileProbeFormatFromBuf): Export.
      * src/storage/storage_backend_fs.c (virStorageBackendProbeTarget):
      Adjust client.
      * src/libvirt_private.syms (virstoragefile.h): Adjust exports.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      348b4e25
    • E
      storage: refactor backing chain division of labor · 3ead2e7d
      Eric Blake 提交于
      Future patches will want to learn metadata about a file using
      a buffer that was already parsed in order to probe the file's
      format.  Rather than reopening and re-reading the file, it makes
      sense to separate getting file contents from actually parsing
      those contents.
      
      * src/util/virstoragefile.c (virStorageFileGetMetadataFromBuf)
      (virStorageFileGetMetadataFromFDInternal): New functions.
      (virStorageFileGetMetadataInternal): Hoist fstat() and read() into
      callers.
      (virStorageFileGetMetadataFromFD)
      (virStorageFileGetMetadataRecurse): Rework clients.
      * src/util/virstoragefile.h (virStorageFileGetMetadataFromBuf):
      New prototype.
      * src/libvirt_private.syms (virstoragefile.h): Export it.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      3ead2e7d
    • E
      storage: avoid short reads while chasing backing chain · 5327fad4
      Eric Blake 提交于
      Our backing file chain code was not very robust to an ill-timed
      EINTR, which could lead to a short read causing us to randomly
      treat metadata differently than usual.  But the existing
      virFileReadLimFD forces an error if we don't read the entire
      file, even though we only care about the header of the file.
      So add a new virFile function that does what we want.
      
      * src/util/virfile.h (virFileReadHeaderFD): New prototype.
      * src/util/virfile.c (virFileReadHeaderFD): New function.
      * src/libvirt_private.syms (virfile.h): Export it.
      * src/util/virstoragefile.c (virStorageFileGetMetadataInternal)
      (virStorageFileProbeFormatFromFD): Use it.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      5327fad4