[libvirt] [PATCH 2/2] net: Drop the NetLegacy structure, always use Netdev instead

Markus Armbruster armbru at redhat.com
Tue Dec 10 11:09:23 UTC 2019


Thomas Huth <thuth at redhat.com> writes:

> Now that the "name" parameter is gone, there is hardly any difference
> between NetLegacy and Netdev anymore. Drop NetLegacy and always use
> Netdev to simplify the code quite a bit.
>
> Signed-off-by: Thomas Huth <thuth at redhat.com>

Took me a minute to see the actual difference.

Here's Netdev:

    { 'union': 'Netdev',
      'base': { 'id': 'str', 'type': 'NetClientDriver' },
      'discriminator': 'type',
      'data': {
        'nic':      'NetLegacyNicOptions',
        'user':     'NetdevUserOptions',
        'tap':      'NetdevTapOptions',
        'l2tpv3':   'NetdevL2TPv3Options',
        'socket':   'NetdevSocketOptions',
        'vde':      'NetdevVdeOptions',
        'bridge':   'NetdevBridgeOptions',
        'hubport':  'NetdevHubPortOptions',
        'netmap':   'NetdevNetmapOptions',
        'vhost-user': 'NetdevVhostUserOptions' } }

    { 'enum': 'NetClientDriver',
      'data': [ 'none', 'nic', 'user', 'tap', 'l2tpv3', 'socket', 'vde',
                'bridge', 'hubport', 'netmap', 'vhost-user' ] }

Here's NetLegacy:

    { 'struct': 'NetLegacy',
      'data': {
        '*id':   'str',
        'opts':  'NetLegacyOptions' } }

    { 'union': 'NetLegacyOptions',
      'base': { 'type': 'NetLegacyOptionsType' },
      'discriminator': 'type',
      'data': {
        'nic':      'NetLegacyNicOptions',
        'user':     'NetdevUserOptions',
        'tap':      'NetdevTapOptions',
        'l2tpv3':   'NetdevL2TPv3Options',
        'socket':   'NetdevSocketOptions',
        'vde':      'NetdevVdeOptions',
        'bridge':   'NetdevBridgeOptions',
        'netmap':   'NetdevNetmapOptions',
        'vhost-user': 'NetdevVhostUserOptions' } }

    { 'enum': 'NetLegacyOptionsType',
      'data': ['none', 'nic', 'user', 'tap', 'l2tpv3', 'socket', 'vde',
               'bridge', 'netmap', 'vhost-user'] }

Difference: NetLegacy wraps the union in @opts.




More information about the libvir-list mailing list