• S
    vepa: parsing for 802.1Qb{g|h} XML · a8f75d2c
    Stefan Berger 提交于
    This patch parses the following two XML descriptions, one for
    802.1Qbg and one for 802.1Qbh, and stores the data internally.
    The actual triggering of the switch setup protocol has not been
    implemented here but the relevant code to do that should go into
    the functions associatePortProfileId() and disassociatePortProfileId().
    
       <interface type='direct'>
          <source dev='eth0.100' mode='vepa'/>
          <model type='virtio'/>
          <virtualport type='802.1Qbg'>
            <parameters managerid='12' typeid='0x123456' typeidversion='1'
             instanceid='fa9b7fff-b0a0-4893-8e0e-beef4ff18f8f'/>
          </virtualport>
          <filterref filter='clean-traffic'/>
        </interface>
    
        <interface type='direct'>
          <source dev='eth0.100' mode='vepa'/>
          <model type='virtio'/>
          <virtualport type='802.1Qbh'>
            <parameters profileid='my_profile'/>
          </virtualport>
        </interface>
    
    I'd suggest to use this patch as a base for triggering the setup
    protocol with the 802.1Qb{g|h} switch.
    
    Several rounds of changes were made to this patch. The
    following is a list of these changes.
    - Renamed structure virVirtualPortProfileDef to virVirtualPortProfileParams
      as per Daniel Berrange's request
    - Addressing Daniel Berrange's comments:
     - removing macvtap.h's dependency on domain_conf.h by
       moving the virVirtualPortProfileDef structure into macvtap.h
       and not passing virtDomainNetDefPtr to any functions in
       macvtap.c
    - Addressed most of Chris Wright's comments:
      - indicating error in case virtualport XML node cannot be parsed
        properly
      - parsing hex and decimal numbers using virStrToLong_ui() with
        parameter '0' for base
      - tgifname (target interface name) variable wasn't necessary
        to pass to openMacvtapTap function anymore
    - assigning the virtual port data structure to the virDomainNetDef
      only if it was previously parsed
    - make sure that the error code returned by openMacvtapTap() is a negative n
      in case the associatePortProfileId() function failed.
    - renaming vsi in the XML to virtualport
    - replace all occurrences of vsi in the source as well
    - removing mode and MAC address parameters from the functions that
      will communicate with the hareware diretctly or indirectly
    - moving the associate and disassociate functions to the end of the
      file for subsequent patches to easier make them generally available
      for export
    - passing the macvtap interface name rather than the link device since
      this otherwise gives funny side effects when using netlink messages
      where IFLA_IFNAME and IFLA_ADDRESS are specified and the link dev
      all of a sudden gets the MAC address of the macvtap interface.
    - Removing rc = -1 error indications in the case of 802.1Qbg|h setup in case
      we wanted to use hook scripts for the setup and so the setup doesn't fail
      here.
    - if instance ID UUID is not supplied it will automatically be generated
      - adapted schema to make instance ID UUID optional
      - added test case
    - parser and XML generator have been separated into their own
      functions so they can be re-used elsewhere (passthrough case
      for example)
    - Adapted XML parser and generator support the above shown type
      (802.1Qbg, 802.1Qbh).
    - Adapted schema to above XML
    - Adapted test XML to above XML
    - Passing through the VM's UUID which seems to be necessary for
      802.1Qbh -- sorry no host UUID
    - adding virtual function ID to association function, in case it's
      necessary to use (for SR-IOV)
    a8f75d2c
domain_conf.h 31.0 KB