Skip to content

Commit

Permalink
ovirt_vm : Add support for specifying nic interface type
Browse files Browse the repository at this point in the history
  • Loading branch information
shantur committed Mar 26, 2021
1 parent 0874017 commit 9c47007
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions ovirt/resource_ovirt_vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,21 @@ func resourceOvirtVM() *schema.Resource {
Optional: true,
ForceNew: true,
},
"interface": {
Type: schema.TypeString,
Required: false,
Optional: true,
ForceNew: true,
ValidateFunc: validation.StringInSlice([]string{
string(ovirtsdk4.NICINTERFACE_E1000),
string(ovirtsdk4.NICINTERFACE_PCI_PASSTHROUGH),
string(ovirtsdk4.NICINTERFACE_RTL8139),
string(ovirtsdk4.NICINTERFACE_RTL8139_VIRTIO),
string(ovirtsdk4.NICINTERFACE_SPAPR_VLAN),
string(ovirtsdk4.NICINTERFACE_VIRTIO),
}, false),
Default: string(ovirtsdk4.NICINTERFACE_VIRTIO),
},
},
},
},
Expand Down Expand Up @@ -1459,6 +1474,7 @@ func ovirtAttachNics(n []interface{}, vmID string, meta interface{}) error {
ovirtsdk4.NewNicBuilder().
Name(nic["name"].(string)).
Mac(mac).
Interface(ovirtsdk4.NicInterface(nic["interface"].(string))).
VnicProfile(
ovirtsdk4.NewVnicProfileBuilder().
Id(nic["vnic_profile_id"].(string)).
Expand Down

0 comments on commit 9c47007

Please sign in to comment.