Skip to content

Commit cb46ff0

Browse files
author
Joshua Reed
committed
Instance tests work now.
1 parent 6e035f6 commit cb46ff0

File tree

3 files changed

+142
-136
lines changed

3 files changed

+142
-136
lines changed

pkg/cloud/instance.go

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -143,15 +143,10 @@ func (c *client) GetOrCreateVMInstance(
143143
csCluster *infrav1.CloudStackCluster,
144144
userData string) error {
145145

146-
// TODO get zone from capiMachine.
147-
// For now, just get whatever is reliably the first zone.
148-
// This will probably need to be kicked to the controller anyway.
149-
zName := ""
150-
for _, zone := range csCluster.Status.Zones {
151-
zName = zone.Name
152-
break
153-
}
154-
zone := csCluster.Status.Zones[zName]
146+
zone, ok := csCluster.Status.Zones[*capiMachine.Spec.FailureDomain]
147+
if !ok {
148+
return errors.New("FailureDomain zone not found.")
149+
}
155150

156151
// Check if VM instance already exists.
157152
if err := c.ResolveVMInstanceDetails(csMachine); err == nil ||

0 commit comments

Comments
 (0)