Skip to content

Commit

Permalink
Support VM Network Multi-Queue in KubeVirt Provider (#1874)
Browse files Browse the repository at this point in the history
* support enableNetworkMultiQueue in KV VMs

* adjust the tests
  • Loading branch information
moadqassem authored Nov 8, 2024
1 parent 36a68f1 commit b5a4e91
Show file tree
Hide file tree
Showing 16 changed files with 35 additions and 8 deletions.
16 changes: 14 additions & 2 deletions pkg/cloudprovider/provider/kubevirt/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ type Config struct {
TopologySpreadConstraints []corev1.TopologySpreadConstraint
Region string
Zone string
EnableNetworkMultiQueue bool

ProviderNetworkName string
SubnetName string
Expand Down Expand Up @@ -249,6 +250,16 @@ func (p *provider) getConfig(provSpec clusterv1alpha1.ProviderSpec) (*Config, *p
}
}

var enableNetworkMultiQueueSet bool
config.EnableNetworkMultiQueue, enableNetworkMultiQueueSet, err = p.configVarResolver.GetConfigVarBoolValue(rawConfig.VirtualMachine.EnableNetworkMultiQueue)
if err != nil {
return nil, nil, fmt.Errorf(`failed to get value of "enableNetworkMultiQueue" field: %w`, err)
}

if !enableNetworkMultiQueueSet {
config.EnableNetworkMultiQueue = true
}

config.ClusterName, err = p.configVarResolver.GetConfigVarStringValue(rawConfig.ClusterName)
if err != nil {
return nil, nil, fmt.Errorf(`failed to get value of "clusterName" field: %w`, err)
Expand Down Expand Up @@ -744,8 +755,9 @@ func (p *provider) newVirtualMachine(c *Config, pc *providerconfigtypes.Config,
},
Domain: kubevirtv1.DomainSpec{
Devices: kubevirtv1.Devices{
Interfaces: []kubevirtv1.Interface{*defaultBridgeNetwork},
Disks: getVMDisks(c),
Interfaces: []kubevirtv1.Interface{*defaultBridgeNetwork},
Disks: getVMDisks(c),
NetworkInterfaceMultiQueue: ptr.To(c.EnableNetworkMultiQueue),
},
Resources: resourceRequirements,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ spec:
interfaces:
- name: default
bridge: {}
networkInterfaceMultiqueue: true
resources:
limits:
cpu: "2"
Expand Down
1 change: 1 addition & 0 deletions pkg/cloudprovider/provider/kubevirt/testdata/affinity.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ spec:
interfaces:
- name: default
bridge: {}
networkInterfaceMultiqueue: true
resources:
limits:
cpu: "2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ spec:
interfaces:
- name: default
bridge: {}
networkInterfaceMultiqueue: true
resources:
limits:
cpu: "2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ spec:
interfaces:
- name: default
bridge: {}
networkInterfaceMultiqueue: true
resources:
limits:
cpu: "2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ spec:
interfaces:
- name: default
bridge: {}
networkInterfaceMultiqueue: true
networks:
- name: default
pod: {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ spec:
interfaces:
- name: default
bridge: {}
networkInterfaceMultiqueue: true
networks:
- name: default
pod: {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ spec:
interfaces:
- name: default
bridge: {}
networkInterfaceMultiqueue: true
resources:
limits:
cpu: "2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ spec:
interfaces:
- name: default
bridge: {}
networkInterfaceMultiqueue: true
resources:
limits:
cpu: "2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ spec:
interfaces:
- name: default
bridge: {}
networkInterfaceMultiqueue: true
resources:
limits:
cpu: "2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ spec:
interfaces:
- name: default
bridge: {}
networkInterfaceMultiqueue: true
resources:
limits:
cpu: "2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ spec:
interfaces:
- name: default
bridge: {}
networkInterfaceMultiqueue: true
resources:
limits:
cpu: "2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ spec:
interfaces:
- name: default
bridge: {}
networkInterfaceMultiqueue: true
resources:
limits:
cpu: "2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ spec:
interfaces:
- name: default
bridge: {}
networkInterfaceMultiqueue: true
resources:
limits:
cpu: "2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ spec:
interfaces:
- name: default
bridge: {}
networkInterfaceMultiqueue: true
resources:
limits:
cpu: "2"
Expand Down
13 changes: 7 additions & 6 deletions pkg/cloudprovider/provider/kubevirt/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,13 @@ type VirtualMachine struct {
// Instancetype is optional.
Instancetype *kubevirtv1.InstancetypeMatcher `json:"instancetype,omitempty"`
// Preference is optional.
Preference *kubevirtv1.PreferenceMatcher `json:"preference,omitempty"`
Template Template `json:"template,omitempty"`
DNSPolicy providerconfigtypes.ConfigVarString `json:"dnsPolicy,omitempty"`
DNSConfig *corev1.PodDNSConfig `json:"dnsConfig,omitempty"`
Location *Location `json:"location,omitempty"`
ProviderNetwork *ProviderNetwork `json:"providerNetwork,omitempty"`
Preference *kubevirtv1.PreferenceMatcher `json:"preference,omitempty"`
Template Template `json:"template,omitempty"`
DNSPolicy providerconfigtypes.ConfigVarString `json:"dnsPolicy,omitempty"`
DNSConfig *corev1.PodDNSConfig `json:"dnsConfig,omitempty"`
Location *Location `json:"location,omitempty"`
ProviderNetwork *ProviderNetwork `json:"providerNetwork,omitempty"`
EnableNetworkMultiQueue providerconfigtypes.ConfigVarBool `json:"enableNetworkMultiQueue,omitempty"`
}

// Flavor.
Expand Down

0 comments on commit b5a4e91

Please sign in to comment.