@@ -20,7 +20,6 @@ import (
20
20
"crypto/md5"
21
21
"encoding/hex"
22
22
"fmt"
23
- "sort"
24
23
"strings"
25
24
26
25
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -92,7 +91,6 @@ func ApplyVirtualMachineSpec(
92
91
class * virtv2.VirtualMachineClass ,
93
92
ipAddress string ,
94
93
networkSpec network.InterfaceSpecList ,
95
- vmmacs []* virtv2.VirtualMachineMACAddress ,
96
94
) error {
97
95
if err := kvvm .SetRunPolicy (vm .Spec .RunPolicy ); err != nil {
98
96
return err
@@ -108,7 +106,7 @@ func ApplyVirtualMachineSpec(
108
106
}
109
107
110
108
kvvm .SetMetadata (vm .ObjectMeta )
111
- setNetwork (kvvm , networkSpec , vmmacs )
109
+ setNetwork (kvvm , networkSpec )
112
110
kvvm .SetTablet ("default-0" )
113
111
kvvm .SetNodeSelector (vm .Spec .NodeSelector , class .Spec .NodeSelector .MatchLabels )
114
112
kvvm .SetTolerations (vm .Spec .Tolerations , class .Spec .Tolerations )
@@ -254,23 +252,12 @@ func ApplyVirtualMachineSpec(
254
252
return nil
255
253
}
256
254
257
- func setNetwork (kvvm * KVVM , networkSpec network.InterfaceSpecList , vmmacs [] * virtv2. VirtualMachineMACAddress ) {
255
+ func setNetwork (kvvm * KVVM , networkSpec network.InterfaceSpecList ) {
258
256
kvvm .ClearNetworkInterfaces ()
259
257
kvvm .SetNetworkInterface (network .NameDefaultInterface , "" )
260
258
261
- sort .Slice (vmmacs , func (i , j int ) bool {
262
- return vmmacs [i ].CreationTimestamp .Before (& vmmacs [j ].CreationTimestamp )
263
- })
264
-
265
- var macAddresses []string
266
- for _ , vmmac := range vmmacs {
267
- if vmmac != nil && vmmac .Status .Address != "" {
268
- macAddresses = append (macAddresses , vmmac .Status .Address )
269
- }
270
- }
271
-
272
- for i , n := range networkSpec {
273
- kvvm .SetNetworkInterface (n .InterfaceName , macAddresses [i ])
259
+ for _ , n := range networkSpec {
260
+ kvvm .SetNetworkInterface (n .InterfaceName , n .MAC )
274
261
}
275
262
}
276
263
0 commit comments