Ensure Macvtap NICs can use a model

Defaults to virtio like a bridged NIC. Otherwise performance is abysmal.
This commit is contained in:
Joshua Boniface 2021-06-22 02:38:16 -04:00
parent 07dbd55f03
commit 7d2a3b5361
2 changed files with 4 additions and 3 deletions

View File

@ -574,9 +574,10 @@ def vm_networks_add(config, vm, network, macaddr, model, sriov, sriov_mode, rest
)
# Add a macvtap SR-IOV network
elif sriov_mode == 'macvtap':
device_string = '<interface type="direct"><mac address="{macaddr}"/><source dev="{network}" mode="passthrough"/></interface>'.format(
device_string = '<interface type="direct"><mac address="{macaddr}"/><source dev="{network}" mode="passthrough"/><model type="{model}"/></interface>'.format(
macaddr=macaddr,
network=network
network=network,
model=model
)
else:
return False, "ERROR: Invalid SR-IOV mode specified."

View File

@ -1317,7 +1317,7 @@ def vm_network_get(domain, raw):
)
@click.option(
'-m', '--model', 'model', default='virtio',
help='The model for the interface; must be a valid libvirt model. Not used for SR-IOV NETs.'
help='The model for the interface; must be a valid libvirt model. Not used for "netdev" SR-IOV NETs.'
)
@click.option(
'-s', '--sriov', 'sriov', is_flag=True, default=False,