1. 03 6月, 2017 2 次提交
  2. 04 3月, 2017 2 次提交
  3. 29 8月, 2016 1 次提交
    • R
      tests: fix segfault in objecteventtest · 61148074
      Roman Bogorodskiy 提交于
      Test 12 from objecteventtest (createXML add event) segaults on FreeBSD
      with bus error.
      
      At some point it calls testNodeDeviceDestroy() from the test driver. And
      it fails when it tries to unlock the device in the "out:" label of this
      function.
      
      Unlocking fails because the previous step was a call to
      virNodeDeviceObjRemove from conf/node_device_conf.c. This function
      removes the given device from the device list and cleans up the object,
      including destroying of its mutex. However, it does not nullify the pointer
      that was given to it.
      
      As a result, we end up in testNodeDeviceDestroy() here:
      
       out:
          if (obj)
              virNodeDeviceObjUnlock(obj);
      
      And instead of skipping this, we try to do Unlock and fail because of
      malformed mutex.
      
      Change virNodeDeviceObjRemove to use double pointer and set pointer to
      NULL.
      61148074
  4. 08 6月, 2016 1 次提交
  5. 10 5月, 2016 1 次提交
  6. 22 5月, 2015 1 次提交
    • M
      node_device: fix libvirt build if WITH_HAL is defined · b903b3b0
      Maxim Nestratov 提交于
      commit ffc40b63 changed uniond _virNodeDevCapData into a typedef
      named virNodeDevCapData with a struct that contains the union as well
      as a type enum. This change necessitated changing every reference to
      "caps->type" into "caps->data.type", but the author of that patch
      failed to test a build "WITH_HAL". This patch fixes the one place in
      the hal backend that needed changing.
      b903b3b0
  7. 18 5月, 2015 3 次提交
    • L
      node_device: replace duplicated code in hal and udev backends · d52d7a64
      Laine Stump 提交于
      Both the hal and udev drivers call virPCI*() functions to the the
      SRIOV VF/PF info about PCI devices, and the UDEV backend calls
      virPCI*() to get IOMMU group info. Since there is now a single
      function call in node_device_linux_sysfs.c to do all of this, replace
      all that code in the two backends with calls to
      nodeDeviceSysfsGetPCIRelatedDevCaps().
      
      Note that this results in the HAL driver (probably) unnecessarily
      calling virPCIDevieAddressGetIOMMUGroupNum(), but in the case that the
      host doesn't support IOMMU groups, that function turns into a NOP (it
      returns -2, which causes the caller to skip the call to
      virPCIDeviceAddressGetIOMMUGroupAddresses()). So in the worst case it
      is a few extra cycles spent, and in the best case a mythical platform
      that supported IOMMU groups but used HAL rather than UDEV would gain
      proper reporting of IOMMU group info.
      d52d7a64
    • L
      node device: prepare node_device_linux_sysfs.c to add more functions · d2a57815
      Laine Stump 提交于
      This file contains only a single function, detect_scsi_host_caps(),
      which is declared in node_device_driver.h and called from both the hal
      and udev backends. Other things common to the hal and udev drivers
      can be placed in that file though. As a prelude to adding further
      functions, this patch renames the existing function to something
      closer in line with other internal libvirt function names
      (nodeDeviceSysfsGetSCSIHostCaps()), and puts the declarations into a
      separate .h file.
      d2a57815
    • L
      conf: make virNodeDevCapData an official type · ffc40b63
      Laine Stump 提交于
      For some reason a union (_virNodeDevCapData) that had only been
      declared inside the toplevel struct virNodeDevCapsDef was being used
      as an argument to functions all over the place. Since it was only a
      union, the "type" attribute wasn't necessarily sent with it. While
      this works, it just seems wrong.
      
      This patch creates a toplevel typedef for virNodeDevCapData and
      virNodeDevCapDataPtr, making it a struct that has the type attribute
      as a member, along with an anonymous union of everything that used to
      be in union _virNodeDevCapData. This way we only have to change the
      following:
      
        s/union _virNodeDevCapData */virNodeDevCapDataPtr /
      
      and
      
        s/caps->type/caps->data.type/
      
      This will make me feel less guilty when adding functions that need a
      pointer to one of these.
      ffc40b63
  8. 27 1月, 2015 2 次提交
    • D
      Removing probing of secondary drivers · 55ea7be7
      Daniel P. Berrange 提交于
      For stateless, client side drivers, it is never correct to
      probe for secondary drivers. It is only ever appropriate to
      use the secondary driver that is associated with the
      hypervisor in question. As a result the ESX & HyperV drivers
      have both been forced to do hacks where they register no-op
      drivers for the ones they don't implement.
      
      For stateful, server side drivers, we always just want to
      use the same built-in shared driver. The exception is
      virtualbox which is really a stateless driver and so wants
      to use its own server side secondary drivers. To deal with
      this virtualbox has to be built as 3 separate loadable
      modules to allow registration to work in the right order.
      
      This can all be simplified by introducing a new struct
      recording the precise set of secondary drivers each
      hypervisor driver wants
      
      struct _virConnectDriver {
          virHypervisorDriverPtr hypervisorDriver;
          virInterfaceDriverPtr interfaceDriver;
          virNetworkDriverPtr networkDriver;
          virNodeDeviceDriverPtr nodeDeviceDriver;
          virNWFilterDriverPtr nwfilterDriver;
          virSecretDriverPtr secretDriver;
          virStorageDriverPtr storageDriver;
      };
      
      Instead of registering the hypervisor driver, we now
      just register a virConnectDriver instead. This allows
      us to remove all probing of secondary drivers. Once we
      have chosen the primary driver, we immediately know the
      correct secondary drivers to use.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      55ea7be7
    • D
      Remove use of nodeDevicePrivateData from nodeDev driver · 60b966b3
      Daniel P. Berrange 提交于
      The node device driver can rely on its global state instead
      of the connect private data.
      60b966b3
  9. 15 11月, 2014 1 次提交
  10. 04 9月, 2014 1 次提交
    • E
      maint: use consistent if-else braces in conf and friends · ff78ff7c
      Eric Blake 提交于
      I'm about to add a syntax check that enforces our documented
      HACKING style of always using matching {} on if-else statements.
      
      This patch focuses on code shared between multiple drivers.
      
      * src/conf/domain_conf.c (virDomainFSDefParseXML)
      (virSysinfoParseXML, virDomainNetDefParseXML)
      (virDomainWatchdogDefParseXML)
      (virDomainRedirFilterUSBDevDefParseXML): Correct use of {}.
      * src/conf/interface_conf.c (virInterfaceDefParseDhcp)
      (virInterfaceDefParseIp, virInterfaceVlanDefFormat)
      (virInterfaceDefParseStartMode, virInterfaceDefParseBondMode)
      (virInterfaceDefParseBondMiiCarrier)
      (virInterfaceDefParseBondArpValid): Likewise.
      * src/conf/node_device_conf.c (virNodeDevCapStorageParseXML):
      Likewise.
      * src/conf/nwfilter_conf.c (virNWFilterRuleDetailsParse)
      (virNWFilterRuleParse, virNWFilterDefParseXML): Likewise.
      * src/conf/secret_conf.c (secretXMLParseNode): Likewise.
      * src/cpu/cpu_x86.c (x86Baseline, x86FeatureLoad, x86ModelLoad):
      Likewise.
      * src/network/bridge_driver.c (networkKillDaemon)
      (networkDnsmasqConfContents): Likewise.
      * src/node_device/node_device_hal.c (dev_refresh): Likewise.
      * src/nwfilter/nwfilter_gentech_driver.c (virNWFilterInstantiate):
      Likewise.
      * src/nwfilter/nwfilter_ebiptables_driver.c
      (_iptablesCreateRuleInstance): Likewise.
      * src/storage/storage_backend_disk.c
      (virStorageBackendDiskBuildPool): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      ff78ff7c
  11. 21 7月, 2014 1 次提交
  12. 13 5月, 2014 1 次提交
  13. 25 3月, 2014 1 次提交
  14. 18 3月, 2014 1 次提交
  15. 21 11月, 2013 1 次提交
    • E
      maint: fix comma style issues: remaining code · e44a9a70
      Eric Blake 提交于
      Most of our code base uses space after comma but not before;
      fix the remaining uses before adding a syntax check.
      
      * src/network/bridge_driver.c: Consistently use commas.
      * src/node_device/node_device_hal.c: Likewise.
      * src/node_device/node_device_udev.c: Likewise.
      * src/storage/storage_backend_rbd.c: Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      e44a9a70
  16. 01 11月, 2013 1 次提交
    • R
      nodedev_hal: fix segfault when virDBusGetSystemBus fails · 87176d0c
      Ryota Ozaki 提交于
      Thie patch fixes the segfault:
          error : nodeStateInitialize:658 : DBus not available,
            disabling HAL driver: internal error: Unable to get DBus
            system bus connection: Failed to connect to socket
            /var/run/dbus/system_bus_socket: No such file or directory
          error : nodeStateInitialize:719 :  ?:
          Caught Segmentation violation dumping internal log buffer:
      
      This segfault occurs at the below VIR_ERROR:
        failure:
            if (dbus_error_is_set(&err)) {
                VIR_ERROR(_("%s: %s"), err.name, err.message);
      
      When virDBusGetSystemBus fails, the code jumps to the above failure
      path. However, the err variable is not correctly initialized
      before calling virDBusGetSystemBus. As a result, dbus_error_is_set
      may pass over the uninitialized err variable whose name or
      message may point to somewhere unknown memory region, which
      causes a segfault on VIR_ERROR.
      
      The new code initializes the err variable before calling
      virDBusGetSystemBus.
      Signed-off-by: NRyota Ozaki <ozaki.ryota@gmail.com>
      87176d0c
  17. 11 7月, 2013 1 次提交
  18. 18 6月, 2013 1 次提交
    • O
      nodedev_hal: Enumerate scsi generic device · dd451f3a
      Osier Yang 提交于
      The xml outputed by HAL backend for scsi generic device:
      
      <device>
        <name>pci_8086_2922_scsi_host_scsi_device_lun0_scsi_generic</name>
        <path>/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_generic/sg0</path>
        <parent>pci_8086_2922_scsi_host_scsi_device_lun0</parent>
        <capability type='scsi_generic'>
          <char>/dev/sg0</char>
        </capability>
      </device>
      dd451f3a
  19. 03 6月, 2013 1 次提交
  20. 09 5月, 2013 1 次提交
  21. 08 5月, 2013 1 次提交
  22. 03 5月, 2013 1 次提交
  23. 25 4月, 2013 1 次提交
  24. 24 4月, 2013 4 次提交
  25. 25 3月, 2013 2 次提交
    • O
      nodedev: Fix the improper logic when enumerating SRIOV VF · 9a3ff01d
      Osier Yang 提交于
      virPCIGetVirtualFunctions returns 0 even if there is no "virtfn"
      entry under the device sysfs path.
      
      And virPCIGetVirtualFunctions returns -1 when it fails to get
      the PCI config space of one VF, however, with keeping the
      the VFs already detected.
      
      That's why udevProcessPCI and gather_pci_cap use logic like:
      
      if (!virPCIGetVirtualFunctions(syspath,
                                     &data->pci_dev.virtual_functions,
                                     &data->pci_dev.num_virtual_functions) ||
          data->pci_dev.num_virtual_functions > 0)
          data->pci_dev.flags |= VIR_NODE_DEV_CAP_FLAG_PCI_VIRTUAL_FUNCTION;
      
      to tag the PCI device with "virtual_function" cap.
      
      However, this results in a VF will aslo get "virtual_function" cap.
      
      This patch fixes it by:
        * Ignoring the VF which has failure of getting PCI config space
          (given that the successfully detected VFs are kept , it makes
          sense to not give up on the failure of one VF too) with a warning,
          so virPCIGetVirtualFunctions will not return -1 except out of memory.
      
        * Free the allocated *virtual_functions when out of memory
      
      And thus the logic can be changed to:
      
          /* Out of memory */
          int ret = virPCIGetVirtualFunctions(syspath,
                                              &data->pci_dev.virtual_functions,
                                              &data->pci_dev.num_virtual_functions);
      
          if (ret < 0 )
              goto out;
          if (data->pci_dev.num_virtual_functions > 0)
              data->pci_dev.flags |= VIR_NODE_DEV_CAP_FLAG_PCI_VIRTUAL_FUNCTION;
      9a3ff01d
    • O
      nodedev: Refactor the helpers · 4360a098
      Osier Yang 提交于
      This adds two util functions (virIsCapableFCHost and virIsCapableVport),
      and rename helper check_fc_host_linux as detect_scsi_host_caps,
      check_capable_vport_linux is removed, as it's abstracted to the util
      function virIsCapableVport. detect_scsi_host_caps nows detect both
      the fc_host and vport_ops capabilities. "stat(2)" is replaced with
      "access(2)" for saving.
      
      * src/util/virutil.h:
        - Declare virIsCapableFCHost and virIsCapableVport
      * src/util/virutil.c:
        - Implement virIsCapableFCHost and virIsCapableVport
      * src/node_device/node_device_linux_sysfs.c:
        - Remove check_capable_vport_linux
        - Rename check_fc_host_linux as detect_scsi_host_caps, and refactor
          it a bit to detect both fc_host and vport_os capabilities
      * src/node_device/node_device_driver.h:
        - Change/remove the related declarations
      * src/node_device/node_device_udev.c: (Use detect_scsi_host_caps)
      * src/node_device/node_device_hal.c: (Likewise)
      * src/node_device/node_device_driver.c (Likewise)
      4360a098
  26. 12 2月, 2013 1 次提交
  27. 06 2月, 2013 1 次提交
    • E
      build: fix build of HAL node backend · 542fbfb0
      Eric Blake 提交于
      Commit 20253560 missed uses of PCI functions in the older HAL-related
      code, probably because hal-devel is no longer available in latest Fedora.
      
      * src/node_device/node_device_hal.c (gather_pci_cap): Reflect
      function rename.
      542fbfb0
  28. 21 12月, 2012 4 次提交