1. 17 2月, 2017 6 次提交
  2. 07 1月, 2017 1 次提交
    • J
      nodedev: Add the ability to create vHBA by parent wwnn/wwpn or fabric_wwn · 2b13361b
      John Ferlan 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1349696
      
      When creating a vHBA, the process is to feed XML to nodeDeviceCreateXML
      that lists the <parent> scsi_hostX to use to create the vHBA. However,
      between reboots, it's possible that the <parent> changes its scsi_hostX
      to scsi_hostY and saved XML to perform the creation will either fail or
      create a vHBA using the wrong parent.
      
      So add the ability to provide "wwnn" and "wwpn" or "fabric_wwn" to
      the <parent> instead of a name of the scsi_hostN that is the parent.
      The allowed XML will thus be:
      
        <parent>scsi_host3</parent>  (current)
      
      or
      
        <parent wwnn='$WWNN' wwpn='$WWPN'/>
      
      or
      
        <parent fabric_wwn='$WWNN'/>
      
      Using the wwnn/wwpn or fabric_wwn ensures the same 'scsi_hostN' is
      selected between hardware reconfigs or host reboots. The fabric_wwn
      Using the wwnn/wwpn pair will provide the most specific search option,
      while fabric_wwn will at least ensure usage of the same SAN, but maybe
      not the same scsi_hostN.
      
      This patch will add the new fields to the nodedev.rng for input purposes
      only since the input XML is essentially thrown away, no need to Format
      the values since they'd already be printed as part of the scsi_host
      data block.
      
      New API virNodeDeviceGetParentHostByWWNs will take the parent "wwnn" and
      "wwpn" in order to search the list of devices for matching capability
      data fields wwnn and wwpn.
      
      New API virNodeDeviceGetParentHostByFabricWWN will take the parent "fabric_wwn"
      in order to search the list of devices for matching capability data field
      fabric_wwn.
      2b13361b
  3. 05 1月, 2017 2 次提交
  4. 02 9月, 2016 1 次提交
    • X
      conf: Fix initialization value of 'multi' in PCI address · f7658da6
      Xian Han Yu 提交于
      The 'multi' element in PCI address struct used as 'virTristateSwitch',
      and its default value is 'VIR_TRISTATE_SWITCH_ABSENT'. Current PCI
      process use 'false' to initialization 'multi', which is ambiguously
      for assignment or comparison. This patch use '{0}' to initialize
      the whole PCI address struct, which fix the 'multi' initialization
      and makes code more simplify and explicitly.
      Signed-off-by: NXian Han Yu <xhyubj@linux.vnet.ibm.com>
      f7658da6
  5. 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
  6. 25 5月, 2016 1 次提交
  7. 10 5月, 2016 1 次提交
  8. 02 5月, 2016 3 次提交
  9. 04 4月, 2016 1 次提交
    • M
      nodedev: Fix parsing of generated XMLs · 17a94ba7
      Martin Kletzander 提交于
      Commit d77ffb68 added not only reporting of the PCI header type, but
      also parsing of that information.  However, because there was no parsing
      done for the other sub-PCI capabilities, if there was any other
      capability then a valid header type name (like phys_function or
      virt_functions) the parsing would fail.  This prevented passing node
      device XMLs that we generated into our own functions when dealing with,
      e.g. with SRIOV cards.
      
      Instead of reworking the whole parsing, just fix this one occurence and
      remove a test for it for the time being.  Future patches will deal with
      the rest.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      17a94ba7
  10. 22 3月, 2016 1 次提交
  11. 19 3月, 2016 1 次提交
  12. 16 3月, 2016 1 次提交
  13. 25 11月, 2015 1 次提交
    • L
      conf: support reporting maxCount attribute for virtual_functions cap · 0d210c47
      Laine Stump 提交于
      Report the maximum possible number of VFs for an SRIOV PF, like this:
      
         <capability type='virtual_functions' maxCount='7'>
            ...
         </capability>
      
      I've just discovered that the virtual_functions and physical_functions
      capabilities are not supported in the virNodeDeviceParse functions,
      only in virNodeDeviceFormat (I suppose because they are only reported,
      not set from XML). This should probably be remedied, but is less
      immediately useful than the current patch.
      0d210c47
  14. 18 5月, 2015 1 次提交
    • 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
  15. 12 5月, 2015 1 次提交
  16. 13 3月, 2015 1 次提交
    • J
      Introduce virBitmapIsBitSet · 22fd3ac3
      Ján Tomko 提交于
      A helper that never returns an error and treats bits out of bitmap range
      as false.
      
      Use it everywhere we use ignore_value on virBitmapGetBit, or loop over
      the bitmap size.
      22fd3ac3
  17. 12 3月, 2015 1 次提交
  18. 05 3月, 2015 1 次提交
    • J
      SRIOV NIC offload feature discovery · c9027d8f
      James Chapman 提交于
      Adding functionality to libvirt that will allow it
      query the ethtool interface for the availability
      of certain NIC HW offload features
      
      Here is an example of the feature XML definition:
      
      <device>
      <name>net_eth4_90_e2_ba_5e_a5_45</name>
        <path>/sys/devices/pci0000:00/0000:00:03.0/0000:08:00.1/net/eth4</path>
        <parent>pci_0000_08_00_1</parent>
        <capability type='net'>
          <interface>eth4</interface>
          <address>90:e2:ba:5e:a5:45</address>
          <link speed='10000' state='up'/>
          <feature name='rx'/>
          <feature name='tx'/>
          <feature name='sg'/>
          <feature name='tso'/>
          <feature name='gso'/>
          <feature name='gro'/>
          <feature name='rxvlan'/>
          <feature name='txvlan'/>
          <feature name='rxhash'/>
          <capability type='80203'/>
        </capability>
      </device>
      Signed-off-by: NJán Tomko <jtomko@redhat.com>
      c9027d8f
  19. 05 2月, 2015 1 次提交
    • S
      nodedev: check/add for scsi_host caps for ListDevices · e8fcac8e
      Shivaprasad G Bhat 提交于
      Commit id '652a2ec6' introduced two new node device capability flags
      and the ability to use those flags as a way to search for a specific
      subset of a 'scsi_host' device - namely a 'fc_host' and/or 'vports'.
      The code modified the virNodeDeviceCapMatch whichs allows for searching
      using the 'virsh nodedev-list [cap]' via virConnectListAllNodeDevices.
      
      However, the original patches did not account for other searches for
      the same capability key from virNodeListDevices using virNodeDeviceHasCap.
      Since 'fc_host' and 'vports' are self defined bits of a 'scsi_host'
      device mere string comparison against the basic/root type is not
      sufficient.
      
      This patch adds the check for the 'fc_host' and 'vports' bits within
      a 'scsi_host' device and allows the following python code to find the
      capabilities for the device:
      
      import libvirt
      conn = libvirt.openReadOnly('qemu:///system')
      fc = conn.listDevices('fc_host', 0)
      print(fc)
      fc = conn.listDevices('vports', 0)
      print(fc)
      Signed-off-by: NShivaprasad G Bhat <sbhat@linux.vnet.ibm.com>
      e8fcac8e
  20. 03 12月, 2014 1 次提交
    • J
      Replace virNodeDeviceFree with virObjectUnref · e3b456de
      John Ferlan 提交于
      Since virNodeDeviceFree will call virObjectUnref anyway, let's just use that
      directly so as to avoid the possibility that we inadvertently clear out
      a pending error message when using the public API.
      e3b456de
  21. 15 11月, 2014 1 次提交
  22. 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
  23. 20 8月, 2014 1 次提交
  24. 06 8月, 2014 1 次提交
    • P
      Node Devices: Fix nodedev-list for fc_host & vports. · 8d4740c1
      Prerna Saxena 提交于
      In a system with Fiber Channel Host Adapters, a query to list all Fibre Channel
      HBAs OR Vports currently returns empty list:
        $ virsh nodedev-list --cap fc_host
      
        $
      
      Libvirt correctly discovers properties for all HBAs. However, the reporting
      fails because of incorrect flag comparison while filtering these types.
      
      This is fixed by removing references to 'VIR_CONNECT_LIST_NODE_DEVICES_CAP_*'
      for comparison and replacing those with 'VIR_NODE_DEV_CAP_*'
      
      Introduced by original commit id '652a2ec6'
      Signed-off-by: NPrerna Saxena <prerna@linux.vnet.ibm.com>
      8d4740c1
  25. 29 7月, 2014 4 次提交
    • C
      nodedev: fix a uninitialized variable build failure · 71ee25f5
      Chen Hanxiao 提交于
      Fix a -Werror=maybe-uninitialized warning
      Signed-off-by: NChen Hanxiao <chenhanxiao@cn.fujitsu.com>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      71ee25f5
    • E
      nodedev: fix pci express memory leak · c6a4d268
      Eric Blake 提交于
      Leak introduced in commit 16ebf10f (v1.2.6), detected by valgrind:
      
      ==9816== 216 (96 direct, 120 indirect) bytes in 6 blocks are definitely lost in loss record 665 of 821
      ==9816==    at 0x4A081D4: calloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==9816==    by 0x50836FB: virAlloc (viralloc.c:144)
      ==9816==    by 0x1DBDBE27: udevProcessPCI (node_device_udev.c:546)
      ==9816==    by 0x1DBDD79D: udevGetDeviceDetails (node_device_udev.c:1293)
      
      * src/util/virpci.h (virPCIEDeviceInfoFree): New prototype.
      * src/util/virpci.c (virPCIEDeviceInfoFree): New function.
      * src/conf/node_device_conf.c (virNodeDevCapsDefFree): Clear
      pci_express under pci case.
      (virNodeDevCapPCIDevParseXML): Avoid leak.
      * src/node_device/node_device_udev.c (udevProcessPCI): Likewise.
      * src/libvirt_private.syms (virpci.h): Export it.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      c6a4d268
    • E
      nodedev: move pci express types to virpci.h · be05c141
      Eric Blake 提交于
      Finding virPCIE* code is more intuitive if located in virpci.h
      instead of node_device_conf.h.
      
      * src/conf/node_device_conf.h (virPCIELinkSpeed, virPCIELink)
      (virPCIEDeviceInfo): Move...
      * src/util/virpci.h: ...here.
      * src/conf/node_device_conf.c (virPCIELinkSpeed): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      be05c141
    • E
      nodedev: let compiler help us on switches · 3261895a
      Eric Blake 提交于
      The compiler can alert us to places where we need to expand switch
      statements because we add a new enum value, but only if we don't
      have a default case.
      
      * src/conf/node_device_conf.c (virNodeDeviceDefFormat)
      (virNodeDevCapsDefParseXML, virNodeDevCapsDefFree): Drop default
      case.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      3261895a
  26. 22 7月, 2014 1 次提交
    • J
      Add unique_id to nodedev output · f3271f4c
      John Ferlan 提交于
      Add an optional unique_id parameter to nodedev.  Allows for easier lookup
      and display of the unique_id value in order to document for use with
      scsi_host code.
      f3271f4c
  27. 03 7月, 2014 1 次提交
    • J
      Use virBufferCheckError everywhere we report OOM error · 92a8e72f
      Ján Tomko 提交于
      Replace:
      if (virBufferError(&buf)) {
          virBufferFreeAndReset(&buf);
          virReportOOMError();
          ...
      }
      
      with:
      if (virBufferCheckError(&buf) < 0)
          ...
      
      This should not be a functional change (unless some callers
      misused the virBuffer APIs - a different error would be reported
      then)
      92a8e72f
  28. 16 6月, 2014 1 次提交
  29. 12 6月, 2014 1 次提交
    • M
      virNodeDevCapPCIDevParseXML: Initialize numa_node variable · bab45585
      Michal Privoznik 提交于
      With one of my recent patches (1c702778) libvirt's capable of
      reporting NUMA node locality for PCI devices. The node ID is
      stored in pci_dev.numa_node variable. However, since zero is
      valid NUMA node ID, the default is -1 as it is in kernel too.
      So, if the PCI device is not tied to any specific NUMA node, the
      default is then NOT printed into XML. Therefore, when parsing
      node device XML, the <node/> element is optional. But currently,
      if it's not there, we must set sane default, otherwise after
      parsing in the memory representation doesn't match the XML. We
      are already doing this in other place: udevProcessPCI().
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      bab45585