1. 18 2月, 2010 1 次提交
    • M
      Remove unused functions from domain_conf · 07e318b3
      Matthew Booth 提交于
      Remove virDomainDevicePCIAddressEqual and virDomainDeviceDriveAddressEqual,
      which are defined but not used anywhere.
      
      * src/conf/domain_conf.[ch] src/libvirt_private.syms: Remove
        virDomainDevicePCIAddressEqual and virDomainDeviceDriveAddressEqual.
      07e318b3
  2. 12 2月, 2010 1 次提交
  3. 04 2月, 2010 1 次提交
    • C
      Fix log locking problem when using fork() in the library · cd0ef0e0
      Cole Robinson 提交于
      Ad pointed out by Dan Berrange:
      So if some thread in libvirtd is currently executing a logging call,
      while another thread calls virExec(), that other thread no longer
      exists in the child, but its lock is never released. So when the
      child then does virLogReset() it deadlocks.
      
      The only way I see to address this, is for the parent process to call
      virLogLock(), immediately before fork(), and then virLogUnlock()
      afterwards in both parent & child. This will ensure that no other
      thread
      can be holding the lock across fork().
      
      * src/util/logging.[ch] src/libvirt_private.syms: export virLogLock() and
        virLogUnlock()
      * src/util/util.c: lock just before forking and unlock just after - in
        both parent and child.
      cd0ef0e0
  4. 03 2月, 2010 1 次提交
  5. 27 1月, 2010 1 次提交
  6. 23 1月, 2010 1 次提交
    • C
      qemu: Fix race between device rebind and kvm cleanup · be34c3c7
      Chris Lalancette 提交于
      Certain hypervisors (like qemu/kvm) map the PCI bar(s) on
      the host when doing device passthrough.  This can lead to a race
      condition where the hypervisor is still cleaning up the device while
      libvirt is trying to re-attach it to the host device driver.  To avoid
      this situation, we look through /proc/iomem, and if the hypervisor is
      still holding onto the bar (denoted by the string in the matcher variable),
      then we can wait around a bit for that to clear up.
      
      v2: Thanks to review by DV, make sure we wait the full timeout per-device
      Signed-off-by: NChris Lalancette <clalance@redhat.com>
      be34c3c7
  7. 20 1月, 2010 1 次提交
    • J
      Tests for ACS in PCIe switches · 379eb395
      Jiri Denemark 提交于
      New pciDeviceIsAssignable() function for checking whether a given PCI
      device can be assigned to a guest was added. Currently it only checks
      for ACS being enabled on all PCIe switches between root and the PCI
      device. In the future, it could be the right place to check whether a
      device is unbound or bound to a stub driver.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      379eb395
  8. 18 1月, 2010 5 次提交
    • D
      Introduce device aliases · 5da9c980
      Daniel P. Berrange 提交于
      This patch introduces the support for giving all devices a short,
      unique name, henceforth known as a 'device alias'.  These aliases
      are not set by the end user, instead being assigned by the hypervisor
      if it decides it want to support this concept.
      
      The QEMU driver sets them whenever using the -device arg syntax
      and uses them for improved hotplug/hotunplug. it is the intent
      that other APIs (block / interface stats & device hotplug) be
      able to accept device alias names in the future.
      
      The XML syntax is
      
         <alias name="video0"/>
      
      This may appear in any type of device that supports device info.
      
      * src/conf/domain_conf.c, src/conf/domain_conf.h: Add a 'alias'
        field to virDomainDeviceInfo struct & parse/format it in XML
      * src/libvirt_private.syms: Export virDomainDefClearDeviceAliases
      * src/qemu/qemu_conf.c: Replace use of "nic_name" field with the
        standard device alias
      * src/qemu/qemu_driver.c: Clear device aliases at shutdown
      5da9c980
    • D
      Clear assigned PCI devices at shutdown · 774c757e
      Daniel P. Berrange 提交于
      The PCI device addresses are only valid while the VM is running,
      since they are auto-assigned by QEMU. After shutdown they must
      all be cleared. Future QEMU driver enhancement will allow for
      persistent PCI address assignment
      
      * src/conf/domain_conf.h, src/conf/domain_conf.c, src/libvirt_private.syms
        Add virDomainDefClearPCIAddresses() method for wiping out auto assigned
        PCI addresses
      * src/qemu/qemu_driver.c: Clear PCI addresses at VM shutdown
      774c757e
    • D
      Auto-add disk controllers based on defined disks · b030084f
      Daniel P. Berrange 提交于
      Existing applications using libvirt are not aware of the disk
      controller concept. Thus, after parsing the <disk> definitions
      in the XML, it is neccessary to create <controller> elements
      to satisfy all requested disks, as per their defined drive
      addresses
      
      * src/conf/domain_conf.c, src/conf/domain_conf.h,
        src/libvirt_private.syms: Add virDomainDefAddDiskControllers()
        method for populating disk controllers, and call it after
        parsing disk definitions.
      * src/qemu/qemu_conf.c: Call virDomainDefAddDiskControllers()
        when doing ARGV -> XML conversion
      * tests/qemuxml2argvdata/qemuxml2argv*.xml: Add disk controller
        data to all data files which don't have it already
      b030084f
    • D
      Properly support SCSI drive hotplug · 3a6bf1bb
      Daniel P. Berrange 提交于
      The current SCSI hotplug support attaches a brand new SCSI controller
      for every disk. This is broken because the semantics differ from those
      used when starting the VM initially. In the latter case, each SCSI
      controller is filled before a new one is added.
      
      If the user specifies an high drive index (sdazz) then at initial
      startup, many intermediate SCSI controllers may be added with no
      drives.
      
      This patch changes SCSI hotplug so that it exactly matches the
      behaviour of initial startup. First the SCSI controller number is
      determined for the drive to be hotplugged. If any controller upto
      and including that controller number is not yet present, it is
      attached. Then finally the drive is attached to the last controller.
      
      NB, this breaks SCSI hotunplug, because there is no 'drive_del'
      command in current QEMU. Previous SCSI hotunplug was broken in
      any case because it was unplugging the entire controller, not
      just the drive in question.
      
      A future QEMU will allow proper SCSI hotunplug of a drive.
      
      This patch is derived from work done by Wolfgang Mauerer on disk
      controllers.
      
      * src/qemu/qemu_driver.c: Fix SCSI hotplug to add a drive to
       the correct controller, instead of just attaching a new
        controller.
      * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h,
        src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_json.h,
        src/qemu/qemu_monitor_text.c, src/qemu/qemu_monitor_text.h: Add
        support for 'drive_add' command
      3a6bf1bb
    • W
      Implement SCSI controller hotplug/unplug for QEMU · da9d937b
      Wolfgang Mauerer 提交于
      This patch allows for explicit hotplug/unplug of SCSI controllers.
      Ordinarily this is not required, since QEMU/libvirt will attach
      a new SCSI controller whenever one is required. Allowing explicit
      hotplug of controllers though, enables the caller to specify a
      static PCI address, instead of auto-assigning the next available
      PCI slot. Or it will when we have static PCI addressing.
      
      This patch is derived from Wolfgang Mauerer's disk controller
      patch series.
      
      * src/qemu/qemu_driver.c: Support hotplug & unplug of SCSI
        controllers
      * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h,
        src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_json.h,
        src/qemu/qemu_monitor_text.c, src/qemu/qemu_monitor_text.h: Add
        new API for attaching PCI SCSI controllers
      da9d937b
  9. 16 1月, 2010 3 次提交
    • W
      Add new domain device: "controller" · 74ec5e65
      Wolfgang Mauerer 提交于
      This augments virDomainDevice with a <controller> element
      that is used to represent disk controllers (e.g., scsi
      controllers). The XML format is given by
      
        <controller type="scsi" index="<num>">
           <address type="pci" domain="0xNUM" bus="0xNUM" slot="0xNUM"/>
        </controller>
      
      where type denotes the disk interface (scsi, ide,...), index
      is an integer that identifies the controller for association
      with disks, and the <address> element specifies the controller
      address on the PCI bus as described in previous commits
      The address element can be omitted; in this case, an address
      will be assigned automatically.
      
      Most of the code in this patch is from Wolfgang Mauerer's
      previous disk controller series
      
       * docs/schemas/domain.rng: Define syntax for <controller>
         XML element
       * src/conf/domain_conf.c, src/conf/domain_conf.h: Define
         virDomainControllerDef struct, and routines for parsing
         and formatting XML
      * src/libvirt_private.syms: Add virDomainControllerInsert
         and virDomainControllerDefFree
      74ec5e65
    • D
      Set default disk controller/bus/unit props · 776e37e1
      Daniel P. Berrange 提交于
      When parsing the <disk> element specification, if no <address>
      is provided for the disk, then automatically assign one based on
      the <target dev='sdXX'/> device name. This provides for backwards
      compatability with existing applications using libvirt, while also
      allowing new apps to have complete fine grained control.
      
      * src/conf/domain_conf.h, src/conf/domain_conf.c,
        src/libvirt_private.syms: Add virDomainDiskDefAssignAddress()
        for assigning a controller/bus/unit address based on disk target
      * src/qemu/qemu_conf.c: Call virDomainDiskDefAssignAddress() after
        generating XML from ARGV
      * tests/qemuxml2argvdata/*.xml: Add in drive address information
        to all XML files
      776e37e1
    • D
      Introduce a standardized data structure for device addresses · 1b0cce7d
      Daniel P. Berrange 提交于
      All guest devices now use a common device address structure
      summarized by:
      
        enum virDomainDeviceAddressType {
          VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE,
          VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI,
        };
      
        struct _virDomainDevicePCIAddress {
          unsigned int domain;
          unsigned int bus;
          unsigned int slot;
          unsigned int function;
        };
      
        struct _virDomainDeviceInfo {
          int type;
          union {
              virDomainDevicePCIAddress pci;
          } addr;
        };
      
      This replaces the anonymous structs in Disk/Net/Hostdev data
      structures. Where available, the address is *always* printed
      in the XML file, instead of being hidden in the internal state
      file.
      
        <address type='pci' domain='0x0000' bus='0x1e' slot='0x07' function='0x0'/>
      
      The structure definition is based on Wolfgang Mauerer's disk
      controller patch series.
      
      * docs/schemas/domain.rng: Define the <address> syntax and
        associate it with disk/net/hostdev devices
      * src/conf/domain_conf.h, src/conf/domain_conf.c,
        src/libvirt_private.syms: APIs for parsing/formatting address
        information. Also remove the QEMU specific 'pci_addr' attributes
      * src/qemu/qemu_driver.c: Replace use of 'pci_addr' attrs with
        new standardized format.
      1b0cce7d
  10. 12 1月, 2010 1 次提交
    • C
      virterror: Add virSetError · fd5eb45b
      Cole Robinson 提交于
      Can be used to re-set an old error, which may have been squashed by
      other functions (like cleanup routines). Will be used in subsequent patches
      fd5eb45b
  11. 23 12月, 2009 2 次提交
  12. 18 12月, 2009 2 次提交
    • J
      Adds CPU selection infrastructure · 7286882c
      Jiri Denemark 提交于
      Each driver supporting CPU selection must fill in host CPU capabilities.
      When filling them, drivers for hypervisors running on the same node as
      libvirtd can use cpuNodeData() to obtain raw CPU data. Other drivers,
      such as VMware, need to implement their own way of getting such data.
      Raw data can be decoded into virCPUDefPtr using cpuDecode() function.
      
      When implementing virConnectCompareCPU(), a hypervisor driver can just
      call cpuCompareXML() function with host CPU capabilities.
      
      For each guest for which a driver supports selecting CPU models, it must
      set the appropriate feature in guest's capabilities:
      
          virCapabilitiesAddGuestFeature(guest, "cpuselection", 1, 0)
      
      Actions needed when a domain is being created depend on whether the
      hypervisor understands raw CPU data (currently CPUID for i686, x86_64
      architectures) or symbolic names has to be used.
      
      Typical use by hypervisors which prefer CPUID (such as VMware and Xen):
      
      - convert guest CPU configuration from domain's XML into a set of raw
        data structures each representing one of the feature policies:
      
          cpuEncode(conn, architecture, guest_cpu_config,
                    &forced_data, &required_data, &optional_data,
                    &disabled_data, &forbidden_data)
      
      - create a mask or whatever the hypervisor expects to see and pass it
        to the hypervisor
      
      Typical use by hypervisors with symbolic model names (such as QEMU):
      
      - get raw CPU data for a computed guest CPU:
      
          cpuGuestData(conn, host_cpu, guest_cpu_config, &data)
      
      - decode raw data into virCPUDefPtr with a possible restriction on
        allowed model names:
      
          cpuDecode(conn, guest, data, n_allowed_models, allowed_models)
      
      - pass guest->model and guest->features to the hypervisor
      
      * src/cpu/cpu.c src/cpu/cpu.h src/cpu/cpu_generic.c
        src/cpu/cpu_generic.h src/cpu/cpu_map.c src/cpu/cpu_map.h
        src/cpu/cpu_x86.c src/cpu/cpu_x86.h src/cpu/cpu_x86_data.h
      * configure.in: check for CPUID instruction
      * src/Makefile.am: glue the new files in
      * src/libvirt_private.syms: add new private symbols
      * po/POTFILES.in: add new cpu files containing translatable strings
      7286882c
    • J
      XML parsing/formating code for CPU flags · 6695818c
      Jiri Denemark 提交于
      * include/libvirt/virterror.h src/util/virterror.c: add new domain
        VIR_FROM_CPU for errors
      * src/conf/cpu_conf.c src/conf/cpu_conf.h: new parsing module
      * src/Makefile.am proxy/Makefile.am: include new files
      * src/conf/capabilities.[ch] src/conf/domain_conf.[ch]: reference
        new code
      * src/libvirt_private.syms: private export of new entry points
      6695818c
  13. 10 12月, 2009 3 次提交
    • M
      remove iptablesReloadRules() and related code · 4ecf9c65
      Mark McLoughlin 提交于
      We don't use this method of reloading rules anymore, so we can just
      kill the code.
      
      This simplifies things a lot because we no longer need to keep a
      table of the rules we've added.
      
      * src/util/iptables.c: kill iptablesReloadRules()
      4ecf9c65
    • M
      remove all traces of lokkit support · 3b3305d8
      Mark McLoughlin 提交于
      Long ago we tried to use Fedora's lokkit utility in order to register
      our iptables rules so that 'service iptables restart' would
      automatically load our rules.
      
      There was one fatal flaw - if the user had configured iptables without
      lokkit, then we would clobber that configuration by running lokkit.
      
      We quickly disabled lokkit support, but never removed it. Let's do
      that now.
      
      The 'my virtual network stops working when I restart iptables' still
      remains. For all the background on this saga, see:
      
        https://bugzilla.redhat.com/227011
      
      * src/util/iptables.c: remove lokkit support
      
      * configure.in: remove --enable-lokkit
      
      * libvirt.spec.in: remove the dirs used only for saving rules for lokkit
      
      * src/Makefile.am: ditto
      
      * src/libvirt_private.syms, src/network/bridge_driver.c,
        src/util/iptables.h: remove references to iptablesSaveRules
      3b3305d8
    • M
      Add virBufferFreeAndReset() and replace free() · 1b9d0744
      Matthias Bolte 提交于
      Replace free(virBufferContentAndReset()) with virBufferFreeAndReset().
      Update documentation and replace all remaining calls to free() with
      calls to VIR_FREE(). Also add missing calls to virBufferFreeAndReset()
      and virReportOOMError() in OOM error cases.
      1b9d0744
  14. 08 12月, 2009 1 次提交
    • D
      Introduce callbacks for serializing domain object private data to XML · c5358c0e
      Daniel P. Berrange 提交于
      Now that drivers are using a private domain object state blob,
      the virDomainObjFormat/Parse methods are no longer able to
      directly serialize all neccessary state to/from XML. It is
      thus neccessary to introduce a pair of callbacks fo serializing
      private state.
      
      The code for serializing vCPU PIDs and the monitor device
      config can now move out of domain_conf.c and into the
      qemu_driver.c where they belong.
      
      * src/conf/capabilities.h: Add callbacks for serializing private
        state to/from XML
      * src/conf/domain_conf.c, src/conf/domain_conf.h: Remove the
        monitor, monitor_chr, monitorWatch, nvcpupids and vcpupids
        fields from virDomainObjPtr. Remove code that serialized
        those fields
      * src/libvirt_private.syms: Export virXPathBoolean
      * src/qemu/qemu_driver.c: Add callbacks for serializing monitor
        and vcpupid data to/from XML
      * src/qemu/qemu_monitor.h, src/qemu/qemu_monitor.c: Pass monitor
        char device config into qemuMonitorOpen directly.
      c5358c0e
  15. 07 12月, 2009 1 次提交
    • D
      Introduce a simple API for handling JSON data · 9428f2ce
      Daniel P. Berrange 提交于
      This introduces simple API for handling JSON data. There is
      an internal data structure 'virJSONValuePtr' which stores a
      arbitrary nested JSON value (number, string, array, object,
      nul, etc).  There are APIs for constructing/querying objects
      and APIs for parsing/formatting string formatted JSON data.
      
      This uses the YAJL library for parsing/formatting from
      
       http://lloyd.github.com/yajl/
      
      * src/util/json.h, src/util/json.c: Data structures and APIs
        for representing JSON data, and parsing/formatting it
      * configure.in: Add check for yajl library
      * libvirt.spec.in: Add build requires for yajl
      * src/Makefile.am: Add json.c/h
      * src/libvirt_private.syms: Export JSON symbols to drivers
      9428f2ce
  16. 05 12月, 2009 1 次提交
  17. 27 11月, 2009 1 次提交
  18. 23 11月, 2009 1 次提交
    • D
      Pull schedular affinity code out into a separate module · 37f415da
      Daniel P. Berrange 提交于
      * src/Makefile.am: Add processinfo.h/processinfo.c
      * src/util/processinfo.c, src/util/processinfo.h: Module providing
        APIs for getting/setting process CPU affinity
      * src/qemu/qemu_driver.c: Switch over to new APIs for schedular
        affinity
      * src/libvirt_private.syms: Export virProcessInfoSetAffinity
        and virProcessInfoGetAffinity to internal drivers
      37f415da
  19. 13 11月, 2009 1 次提交
    • D
      Implement a node device backend using libudev · 3ad6dcf3
      David Allan 提交于
      * configure.in: add new --with-udev, disabled by default, and requiring
        libudev > 145
      * src/node_device/node_device_udev.c src/node_device/node_device_udev.h:
        the new node device backend
      * src/node_device/node_device_linux_sysfs.c: moved node_device_hal_linux.c
        to a better file name
      * src/conf/node_device_conf.c src/conf/node_device_conf.h: add a couple
        of fields in node device definitions, and an API to look them up,
        remove a couple of unused fields from previous patch.
      * src/node_device/node_device_driver.c src/node_device/node_device_driver.h:
        plug the new driver
      * po/POTFILES.in src/Makefile.am src/libvirt_private.syms: add the new
        files and symbols
      * src/util/util.h src/util/util.c: add a new convenience macro
        virBuildPath and virBuildPathInternal() function
      3ad6dcf3
  20. 10 11月, 2009 3 次提交
    • D
      Add reference counting on virDomainObjPtr objects · a340f913
      Daniel P. Berrange 提交于
      Add reference counting on the virDomainObjPtr objects. With the
      forthcoming asynchronous QEMU monitor, it will be neccessary to
      release the lock on virDomainObjPtr while waiting for a monitor
      command response. It is neccessary to ensure one thread can't
      delete a virDomainObjPtr while another is waiting. By introducing
      reference counting threads can make sure objects they are using
      are not accidentally deleted while unlocked.
      
      * src/conf/domain_conf.h, src/conf/domain_conf.c: Add
        virDomainObjRef/Unref APIs, remove virDomainObjFree
      * src/openvz/openvz_conf.c: replace call to virDomainObjFree
        with virDomainObjUnref
      a340f913
    • D
      Add a new timed condition variable wait API · e40438fa
      Daniel P. Berrange 提交于
      * src/util/threads.h, src/util/threads-pthread.c,
        src/libvirt_private.syms: Add virCondWaitUntil()
      e40438fa
    • D
      Make pciDeviceList struct opaque · dd9e9c3b
      Daniel P. Berrange 提交于
      * src/util/pci.c, src/util/pci.h: Make the pciDeviceList struct
        opaque to callers of the API. Add accessor methods for managing
        devices in the list
      * src/qemu/qemu_driver.c: Update to use APIs instead of directly
        accessing pciDeviceList fields
      dd9e9c3b
  21. 09 11月, 2009 1 次提交
    • G
      Removes the ebtablesSaveRules() function · df4c57ae
      Gerhard Stenzel 提交于
      As it was basically unimplemented and more confusing than useful
      at the moment.
      * src/libvirt_private.syms: remove from internal symbols list
      * src/qemu/qemu_bridge_filter.c src/util/ebtables.c: remove code and
        one use of the unimplemented function
      df4c57ae
  22. 06 11月, 2009 1 次提交
  23. 04 11月, 2009 1 次提交
    • G
      New ebtables module wrapper · 1fc3816d
      Gerhard Stenzel 提交于
      * configure.in: look for ebtables binary location if present
      * src/Makefile.am: add the new module
      * src/util/ebtables.[ch]: new module and internal APIs around
        the ebtables binary
      * src/libvirt_private.syms: export the symbols only internally
      1fc3816d
  24. 02 11月, 2009 1 次提交
    • M
      More network utility functions · c3cc4f8b
      Matthew Booth 提交于
      * src/util/network.[ch] Add functions for address->text and get/set
        port number
      * src/libvirt_private.syms: add new entry points
      c3cc4f8b
  25. 30 10月, 2009 1 次提交
  26. 29 10月, 2009 1 次提交
    • D
      Convert virDomainObjListPtr to use a hash of domain objects · a3adcce7
      Daniel P. Berrange 提交于
      The current virDomainObjListPtr object stores domain objects in
      an array. This means that to find a particular objects requires
      O(n) time, and more critically acquiring O(n) mutex locks.
      
      The new impl replaces the array with a virHashTable, keyed off
      UUID. Finding a object based on UUID is now O(1) time, and only
      requires a single mutex lock. Finding by name/id is unchanged
      in complexity.
      
      In changing this, all code which iterates over the array had
      to be updated to use a hash table iterator function callback.
      Several of the functions which were identically duplicating
      across all drivers were pulled into domain_conf.c
      
      * src/conf/domain_conf.h, src/conf/domain_conf.c: Change
        virDomainObjListPtr to use virHashTable. Add a initializer
        method virDomainObjListInit, and rename virDomainObjListFree
        to virDomainObjListDeinit, since its not actually freeing
        the container, only its contents. Also add some convenient
        methods virDomainObjListGetInactiveNames,
        virDomainObjListGetActiveIDs and virDomainObjListNumOfDomains
        which can be used to implement the correspondingly named
        public API entry points in drivers
      * src/libvirt_private.syms: Export new methods from domain_conf.h
      * src/lxc/lxc_driver.c, src/opennebula/one_driver.c,
        src/openvz/openvz_conf.c, src/openvz/openvz_driver.c,
        src/qemu/qemu_driver.c, src/test/test_driver.c,
        src/uml/uml_driver.c, src/vbox/vbox_tmpl.c: Update all code
        to deal with hash tables instead of arrays for domains
      a3adcce7
  27. 28 10月, 2009 2 次提交