1. 07 4月, 2011 1 次提交
    • S
      Change locking for udev monitor and callbacks · 28795828
      Serge Hallyn 提交于
      We're seeing bugs apparently resulting from thread unsafety of
      libpciaccess, such as
      https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/726099
      To prevent those, as suggested by danpb on irc, move the
      nodeDeviceLock(driverState) higher into the callers.  In
      particular:
      
        udevDeviceMonitorStartup should hold the lock while calling
        udevEnumerateDevices(), and udevEventHandleCallback should hold it
        over its entire execution.
      
      It's not clear to me whether it is ok to hold the
      nodeDeviceLock while taking the virNodeDeviceObjLock(dev) on a
      device.  If not, then the lock will need to be dropped around
      the calling of udevSetupSystemDev(), and udevAddOneDevice()
      may not actually be safe to call from higher layers with the
      driverstate lock held.
      
      libvirt 0.8.8 with this patch on it seems to work fine for me.
      Assuming it looks ok and I haven't done anything obviously dumb,
      I'll ask the bug submitters to try this patch.
      Signed-off-by: NSerge Hallyn <serge.hallyn@ubuntu.com>
      28795828
  2. 05 4月, 2011 1 次提交
    • E
      build: detect potentential uninitialized variables · 0d166c6b
      Eric Blake 提交于
      Even with -Wuninitialized (which is part of autobuild.sh
      --enable-compile-warnings=error), gcc does NOT catch this
      use of an uninitialized variable:
      
      {
        if (cond)
          goto error;
        int a = 1;
      error:
        printf("%d", a);
      }
      
      which prints 0 (supposing the stack started life wiped) if
      cond was true.  Clang will catch it, but we don't use clang
      as often.  Using gcc -Wjump-misses-init catches it, but also
      gives false positives:
      
      {
        if (cond)
          goto error;
        int a = 1;
        return a;
      error:
        return 0;
      }
      
      Here, a was never used in the scope of the error block, so
      declaring it after goto is technically fine (and clang agrees).
      However, given that our HACKING already documents a preference
      to C89 decl-before-statement, the false positive warning is
      enough of a prod to comply with HACKING.
      
      [Personally, I'd _really_ rather use C99 decl-after-statement
      to minimize scope, but until gcc can efficiently and reliably
      catch scoping and uninitialized usage bugs, I'll settle with
      the compromise of enforcing a coding standard that happens to
      reject false positives if it can also detect real bugs.]
      
      * acinclude.m4 (LIBVIRT_COMPILE_WARNINGS): Add -Wjump-misses-init.
      * src/util/util.c (__virExec): Adjust offenders.
      * src/conf/domain_conf.c (virDomainTimerDefParseXML): Likewise.
      * src/remote/remote_driver.c (doRemoteOpen): Likewise.
      * src/phyp/phyp_driver.c (phypGetLparNAME, phypGetLparProfile)
      (phypGetVIOSFreeSCSIAdapter, phypVolumeGetKey)
      (phypGetStoragePoolDevice)
      (phypVolumeGetPhysicalVolumeByStoragePool)
      (phypVolumeGetPath): Likewise.
      * src/vbox/vbox_tmpl.c (vboxNetworkUndefineDestroy)
      (vboxNetworkCreate, vboxNetworkDumpXML)
      (vboxNetworkDefineCreateXML): Likewise.
      * src/xenapi/xenapi_driver.c (getCapsObject)
      (xenapiDomainDumpXML): Likewise.
      * src/xenapi/xenapi_utils.c (createVMRecordFromXml): Likewise.
      * src/security/security_selinux.c (SELinuxGenNewContext):
      Likewise.
      * src/qemu/qemu_command.c (qemuBuildCommandLine): Likewise.
      * src/qemu/qemu_hotplug.c (qemuDomainChangeEjectableMedia):
      Likewise.
      * src/qemu/qemu_process.c (qemuProcessWaitForMonitor): Likewise.
      * src/qemu/qemu_monitor_text.c (qemuMonitorTextGetPtyPaths):
      Likewise.
      * src/qemu/qemu_driver.c (qemudDomainShutdown)
      (qemudDomainBlockStats, qemudDomainMemoryPeek): Likewise.
      * src/storage/storage_backend_iscsi.c
      (virStorageBackendCreateIfaceIQN): Likewise.
      * src/node_device/node_device_udev.c (udevProcessPCI): Likewise.
      0d166c6b
  3. 22 3月, 2011 1 次提交
  4. 10 2月, 2011 3 次提交
    • D
      Adjust some log levels in udev driver · 7a4bc156
      Daniel P. Berrange 提交于
      Most of te VIR_INFO calls in the udev driver are only relevant
      to developers so can switch to VIR_DEBUG. Failure to initialize
      libpciaccess though is a fatal error
      
      * src/node_device/node_device_udev.c: Adjust log levels
      7a4bc156
    • D
      Support SCSI RAID type & lower log level for unknown types · cd782cc3
      Daniel P. Berrange 提交于
      The Linux kernel headers don't have a value for SCSI type 12,
      but HAL source code shows this to be a 'raid'. Add workaround
      for this type. Lower log level for unknown types since
      this is not a fatal error condition. Include the device sysfs
      path in the log output to allow identification of which device
      has problems.
      
      * src/node_device/node_device_udev.c: Add SCSI RAID type
      cd782cc3
    • D
      Only initialize/cleanup libpciaccess once · 2215050e
      Daniel P. Berrange 提交于
      libpciaccess has many bugs in its pci_system_init/cleanup
      functions that makes calling them multiple times unwise.
      eg it will double close() FDs, and leak other FDs.
      
      * src/node_device/node_device_udev.c: Only initialize
        libpciaccess once
      2215050e
  5. 04 1月, 2011 1 次提交
    • C
      node_device: udev driver does not handle SR-IOV devices · 51798a5d
      Chris Wright 提交于
      The udev driver does not update a PCI device with its SR-IOV capabilities,
      when applicable, the way the hal driver does.  As a result, dumping the
      device's XML will not include the relevant physical or virtual function
      information.
      
      With this patch, the XML is correct:
      
      # virsh nodedev-dumpxml pci_0000_09_00_0
      <device>
        <name>pci_0000_09_00_0</name>
        <parent>pci_0000_00_1c_0</parent>
        <driver>
          <name>vxge</name>
        </driver>
        <capability type='pci'>
          <domain>0</domain>
          <bus>9</bus>
          <slot>0</slot>
          <function>0</function>
          <product id='0x5833'>X3100 Series 10 Gigabit Ethernet PCIe</product>
          <vendor id='0x17d5'>Neterion Inc.</vendor>
          <capability type='virt_functions'>
            <address domain='0x0000' bus='0x0a' slot='0x00' function='0x1'/>
            <address domain='0x0000' bus='0x0a' slot='0x00' function='0x2'/>
            <address domain='0x0000' bus='0x0a' slot='0x00' function='0x3'/>
          </capability>
        </capability>
      </device>
      
      # virsh nodedev-dumpxml pci_0000_0a_00_1
      <device>
        <name>pci_0000_0a_00_1</name>
        <parent>pci_0000_00_1c_0</parent>
        <driver>
          <name>vxge</name>
        </driver>
        <capability type='pci'>
          <domain>0</domain>
          <bus>10</bus>
          <slot>0</slot>
          <function>1</function>
          <product id='0x5833'>X3100 Series 10 Gigabit Ethernet PCIe</product>
          <vendor id='0x17d5'>Neterion Inc.</vendor>
          <capability type='phys_function'>
            <address domain='0x0000' bus='0x09' slot='0x00' function='0x0'/>
          </capability>
        </capability>
      </device>
      
      Cc: Dave Allan <dallan@redhat.com>
      Signed-off-by: NChris Wright <chrisw@redhat.com>
      51798a5d
  6. 02 7月, 2010 1 次提交
  7. 09 6月, 2010 1 次提交
    • D
      Fix leaks in udev device add/remove v3 · e7f3bad4
      David Allan 提交于
      * This patch is a modification of a patch submitted by Nigel Jones.
        It fixes several memory leaks on device addition/removal:
      
      1. Free the virNodeDeviceDefPtr in udevAddOneDevice if the return
         value is non-zero
      
      2. Always release the node device reference after the device has been
         processed.
      
      * Refactored for better readability per the suggestion of clalance
      e7f3bad4
  8. 29 5月, 2010 1 次提交
    • D
      Improve nodedev parent/child relationships · 8b46a7bb
      David Allan 提交于
      * If a nodedev has a parent that we don't want to display, we should
        continue walking up the udev device tree to see if any of its
        earlier ancestors are devices that we display.  It makes the tree
        much nicer looking than having a whole lot of devices hanging off
        the root node.
      8b46a7bb
  9. 28 5月, 2010 1 次提交
    • D
      v2 of Cole's wlan support · 07f6c3a9
      David Allan 提交于
      * Incorporated Jim's feedback (v1 & v2)
      
      * Moved case of DEVTYPE == "wlan" up as it's definitive that we have a network interface.
      
      * Made comment more detailed about the wired case to explain better
        how it differentiates between wired network interfaces and USB
        devices.
      07f6c3a9
  10. 26 5月, 2010 1 次提交
    • D
      Expose a host UUID in the capabilities XML · 60881161
      Daniel P. Berrange 提交于
      Allow for a host UUID in the capabilities XML. Local drivers
      will initialize this from the SMBIOS data. If a sanity check
      shows SMBIOS uuid is invalid, allow an override from the
      libvirtd.conf configuration file
      
      * daemon/libvirtd.c, daemon/libvirtd.conf: Support a host_uuid
        configuration option
      * docs/schemas/capability.rng: Add optional host uuid field
      * src/conf/capabilities.c, src/conf/capabilities.h: Include
        host UUID in XML
      * src/libvirt_private.syms: Export new uuid.h functions
      * src/lxc/lxc_conf.c, src/qemu/qemu_driver.c,
        src/uml/uml_conf.c: Set host UUID in capabilities
      * src/util/uuid.c, src/util/uuid.h: Support for host UUIDs
      * src/node_device/node_device_udev.c: Use the host UUID functions
      * tests/confdata/libvirtd.conf, tests/confdata/libvirtd.out: Add
        new host_uuid config option to test
      60881161
  11. 21 5月, 2010 3 次提交
  12. 12 5月, 2010 1 次提交
  13. 29 4月, 2010 1 次提交
  14. 28 4月, 2010 1 次提交
  15. 06 4月, 2010 1 次提交
  16. 18 3月, 2010 1 次提交
    • E
      maint: make Red Hat copyright notices consistent · 0a336335
      Eric Blake 提交于
      Spell out 'Red Hat, Inc.':
       git grep -i 'Copyright.*Red Hat' | grep -v Inc
      
      Include (C) consistently:
       git grep -i 'Copyright [^(].*Red Hat'
      
      * src/lxc/lxc_container.c: Update copyright formatting.
      * src/node_device/node_device_udev.c: Likewise.
      * src/node_device/node_device_udev.h: Likewise.
      * src/xen/xend_internal.h: Likewise.
      * src/xen/xm_internal.c: Likewise.
      * src/xen/xm_internal.h: Likewise.
      * tests/xmconfigtest.c: Likewise.
      * tests/object-locking.ml: Likewise.
      * tools/virt-pki-validate.in: Likewise.
      * tools/virt-xml-validate.in: Likewise.
      0a336335
  17. 11 3月, 2010 2 次提交
  18. 01 3月, 2010 1 次提交
  19. 10 2月, 2010 1 次提交
  20. 09 2月, 2010 1 次提交
  21. 03 2月, 2010 1 次提交
    • D
      Fix locking for udev device add/remove · 8d42b9b4
      David Allan 提交于
      The original udev node device backend neglected to lock the driverState
      struct containing the device list when adding and removing devices
      * src/node_device/node_device_udev.c: add necessary locks in
        udevRemoveOneDevice() and udevAddOneDevice()
      8d42b9b4
  22. 02 2月, 2010 1 次提交
    • M
      udev: Don't let strtoul parse USB busnum and devnum as octal · 33e25a39
      Matthias Bolte 提交于
      udevGetUintProperty was called with base set to 0 for busnum and devnum.
      With base 0 strtoul parses the number as octal if it start with a 0. But
      busnum and devnum are decimal and udev returns them padded with leading
      zeros. So strtoul parses them as octal. This works for certain decimal
      values like 001-007, but fails for values like 008.
      
      Change udevProcessUSBDevice to use base 10 for busnum and devnum.
      33e25a39
  23. 27 1月, 2010 2 次提交
  24. 21 1月, 2010 1 次提交
  25. 20 1月, 2010 1 次提交
  26. 13 1月, 2010 3 次提交
  27. 11 1月, 2010 1 次提交
  28. 14 12月, 2009 2 次提交
  29. 10 12月, 2009 1 次提交
    • 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
  30. 08 12月, 2009 1 次提交
  31. 19 11月, 2009 1 次提交
    • D
      Removing devicePath member from dev struct · f2f656d4
      Dave Allan 提交于
      I realized that I inadvertently added a member to the def struct to
      contain each device's sysfs path when there was an existing member in the
      dev struct for "OS specific path to device metadat, eg sysfs"  Since the
      udev backend needs to record the sysfs path while it's in the process of
      creating the device, before the dev struct gets allocated, I chose to
      remove the member from the dev struct.
      
      * src/conf/node_device_conf.c src/conf/node_device_conf.h
        src/node_device/node_device_driver.c src/node_device/node_device_hal.c
        src/node_device/node_device_udev.c: remove devicePath from the
        structure and use def->sysfs_path instead
      f2f656d4