Skip to content

Commit 4437705

Browse files
pierreprinettik8s-ci-robot
authored andcommitted
Stop Instance creation on invalid Network spec (#466)
Before triggering the creation of a new Instance in OpenStack, the Machine's Network section is used to fetch actual NetworkIDs from OpenStack. Before this change, if no OpenShift subnet was found based on the subnet filters, the Instance spec was sent to OpenStack with an empty Network segment, resulting in an error. With this change, Create returns an error to the caller if no matching networks are found in Openstack.
1 parent db74690 commit 4437705

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pkg/cloud/services/compute/instance.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,10 @@ func (s *Service) InstanceCreate(clusterName string, machine *clusterv1.Machine,
130130
}
131131
}
132132
}
133+
if len(nets) == 0 {
134+
return nil, fmt.Errorf("no network was found or provided. Please check your machine configuration and try again")
135+
}
136+
133137
portsList := []servers.Network{}
134138
for _, net := range nets {
135139
if net.networkID == "" {

0 commit comments

Comments
 (0)