File tree Expand file tree Collapse file tree 3 files changed +142
-136
lines changed Expand file tree Collapse file tree 3 files changed +142
-136
lines changed Original file line number Diff line number Diff line change @@ -143,15 +143,10 @@ func (c *client) GetOrCreateVMInstance(
143
143
csCluster * infrav1.CloudStackCluster ,
144
144
userData string ) error {
145
145
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
+ }
155
150
156
151
// Check if VM instance already exists.
157
152
if err := c .ResolveVMInstanceDetails (csMachine ); err == nil ||
You can’t perform that action at this time.
0 commit comments