Skip to content

Commit

Permalink
feat(v2/storage-network): create instance with storage IP
Browse files Browse the repository at this point in the history
longhorn/longhorn-6450

Signed-off-by: Chin-Ya Huang <chin-ya.huang@suse.com>
  • Loading branch information
c3y1huang committed Feb 3, 2025
1 parent b890f3e commit 7bffa9e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions controller/engine_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,13 @@ func (ec *EngineController) CreateInstance(obj interface{}) (*longhorn.InstanceP
return nil, err
}

instanceManagerPod, err := ec.ds.GetPod(im.Name)
if err != nil {
return nil, errors.Wrapf(err, "failed to get pod for instance manager %v", im.Name)
}

instanceManagerStorageIP := ec.ds.GetStorageIPFromPod(instanceManagerPod)

return c.EngineInstanceCreate(&engineapi.EngineInstanceCreateRequest{
Engine: e,
VolumeFrontend: frontend,
Expand All @@ -490,8 +497,8 @@ func (ec *EngineController) CreateInstance(obj interface{}) (*longhorn.InstanceP
DataLocality: v.Spec.DataLocality,
EngineCLIAPIVersion: cliAPIVersion,
UpgradeRequired: false,
InitiatorAddress: im.Status.IP,
TargetAddress: im.Status.IP,
InitiatorAddress: instanceManagerStorageIP,
TargetAddress: instanceManagerStorageIP,
})
}

Expand Down

0 comments on commit 7bffa9e

Please sign in to comment.