Skip to content

Commit fdb0584

Browse files
maiquebRamLavi
andcommitted
networking, virt: generalize conflict detection
This way we can ensure appropriate cases are caught in a generic way. With it, we can safely expect to find IP conflicts when there are duplicate IPs in the network. In future commits, we will be able to catch MAC conflicts when there are duplicate MACs in the network Co-authored-by: Ram Lavi <[email protected]> Signed-off-by: Miguel Duarte Barroso <[email protected]>
1 parent 13fdf10 commit fdb0584

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

test/extended/networking/livemigration.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,14 +559,26 @@ func duplicateVM(cli *kubevirt.Client, vmNamespace, vmName string) {
559559
Expect(json.Unmarshal([]byte(originalVMIRawAnnotations), &originalVMIAnnotations)).To(Succeed())
560560

561561
var vmiCreationOptions []kubevirt.Option
562+
var vmiExpectations []func()
562563
if requestedIPs, hasIPRequests := originalVMIAnnotations[kvIPRequestsAnnot]; hasIPRequests {
563564
vmiCreationOptions = append(
564565
vmiCreationOptions,
565566
kubevirt.WithAnnotations(ipRequests(requestedIPs)),
566567
)
568+
vmiExpectations = append(vmiExpectations, func() {
569+
waitForVMPodEventWithMessage(
570+
cli,
571+
vmNamespace,
572+
duplicateVMName,
573+
"IP is already allocated",
574+
2*time.Minute,
575+
)
576+
})
567577
}
568578
Expect(cli.CreateVMIFromSpec(vmNamespace, duplicateVMName, vmiSpec, vmiCreationOptions...)).To(Succeed())
569-
waitForVMPodEventWithMessage(cli, vmNamespace, duplicateVMName, "IP is already allocated", 2*time.Minute)
579+
for _, expectation := range vmiExpectations {
580+
expectation()
581+
}
570582
}
571583

572584
func waitForVMPodEventWithMessage(vmClient *kubevirt.Client, vmNamespace, vmName, expectedEventMessage string, timeout time.Duration) {

0 commit comments

Comments
 (0)