@@ -132,14 +132,15 @@ func (actuator portActuator) ListOSResourcesForImport(ctx context.Context, obj o
132132 }
133133
134134 listOpts := ports.ListOpts {
135- Name : string (ptr .Deref (filter .Name , "" )),
136- Description : string (ptr .Deref (filter .Description , "" )),
137- NetworkID : ptr .Deref (network .Status .ID , "" ),
138- ProjectID : ptr .Deref (project .Status .ID , "" ),
139- Tags : tags .Join (filter .Tags ),
140- TagsAny : tags .Join (filter .TagsAny ),
141- NotTags : tags .Join (filter .NotTags ),
142- NotTagsAny : tags .Join (filter .NotTagsAny ),
135+ Name : string (ptr .Deref (filter .Name , "" )),
136+ Description : string (ptr .Deref (filter .Description , "" )),
137+ NetworkID : ptr .Deref (network .Status .ID , "" ),
138+ ProjectID : ptr .Deref (project .Status .ID , "" ),
139+ Tags : tags .Join (filter .Tags ),
140+ TagsAny : tags .Join (filter .TagsAny ),
141+ NotTags : tags .Join (filter .NotTags ),
142+ NotTagsAny : tags .Join (filter .NotTagsAny ),
143+ AdminStateUp : filter .AdminStateUp ,
143144 }
144145
145146 return actuator .osClient .ListPort (ctx , listOpts ), nil
@@ -191,10 +192,11 @@ func (actuator portActuator) CreateResource(ctx context.Context, obj *orcv1alpha
191192 }
192193
193194 createOpts := ports.CreateOpts {
194- NetworkID : * network .Status .ID ,
195- Name : getResourceName (obj ),
196- Description : string (ptr .Deref (resource .Description , "" )),
197- ProjectID : projectID ,
195+ NetworkID : * network .Status .ID ,
196+ Name : getResourceName (obj ),
197+ Description : string (ptr .Deref (resource .Description , "" )),
198+ ProjectID : projectID ,
199+ AdminStateUp : resource .AdminStateUp ,
198200 }
199201
200202 if len (resource .AllowedAddressPairs ) > 0 {
@@ -361,6 +363,7 @@ func (actuator portActuator) updateResource(ctx context.Context, obj orcObjectPT
361363 handleDescriptionUpdate (baseUpdateOpts , resource , osResource )
362364 handleAllowedAddressPairsUpdate (baseUpdateOpts , resource , osResource )
363365 handleSecurityGroupRefsUpdate (baseUpdateOpts , resource , osResource , secGroupMap )
366+ handleAdminStateUpUpdate (baseUpdateOpts , resource , osResource )
364367 updateOpts = baseUpdateOpts
365368 }
366369
@@ -527,6 +530,15 @@ func handlePortSecurityUpdate(updateOpts ports.UpdateOptsBuilder, resource *reso
527530 return updateOpts
528531}
529532
533+ func handleAdminStateUpUpdate (updateOpts * ports.UpdateOpts , resource * resourceSpecT , osResouce * osResourceT ) {
534+ adminStateUp := resource .AdminStateUp
535+ if adminStateUp != nil {
536+ if * adminStateUp != osResouce .AdminStateUp {
537+ updateOpts .AdminStateUp = adminStateUp
538+ }
539+ }
540+ }
541+
530542type portHelperFactory struct {}
531543
532544var _ helperFactory = portHelperFactory {}
0 commit comments