@@ -92,7 +92,7 @@ func createOpenStackMachineTemplate(ctx context.Context, cl client.Client, mapiP
9292 Expect (mapiProviderSpec .Tags ).ToNot (BeNil ())
9393 Expect (len (mapiProviderSpec .Tags )).To (BeNumerically (">" , 0 ))
9494
95- var image string
95+ var image openstackv1. ImageParam
9696 var rootVolume * openstackv1.RootVolume
9797
9898 if mapiProviderSpec .RootVolume != nil {
@@ -106,14 +106,15 @@ func createOpenStackMachineTemplate(ctx context.Context, cl client.Client, mapiP
106106 },
107107 },
108108 }
109+ image .ID = ptr .To (mapiProviderSpec .RootVolume .SourceUUID )
109110 } else {
110- image = mapiProviderSpec .Image
111+ image . Filter = & openstackv1. ImageFilter { Name : & mapiProviderSpec .Image }
111112 }
112113
113114 // NOTE(stephenfin): We intentionally ignore additional security for now.
114115 var securityGroupParam openstackv1.SecurityGroupParam
115116 securityGroup := mapiProviderSpec .SecurityGroups [0 ]
116- if securityGroup .UUID != "" {
117+ if securityGroup .UUID != "" {openstackv1. ImageParam { Filter : & openstackv1. ImageFilter { Name : & image }}
117118 securityGroupParam = openstackv1.SecurityGroupParam {ID : & securityGroup .UUID }
118119 } else {
119120 securityGroupParam = openstackv1.SecurityGroupParam {Filter : & openstackv1.SecurityGroupFilter {Name : securityGroup .Name }}
@@ -130,7 +131,7 @@ func createOpenStackMachineTemplate(ctx context.Context, cl client.Client, mapiP
130131 CloudName : "openstack" ,
131132 Name : "openstack-cloud-credentials" ,
132133 },
133- Image : openstackv1. ImageParam { Filter : & openstackv1. ImageFilter { Name : & image }} ,
134+ Image : image ,
134135 RootVolume : rootVolume ,
135136 SecurityGroups : securityGroups ,
136137 }
0 commit comments