Skip to content

Commit

Permalink
Fix SnapshotClone with engine identity validation enabled
Browse files Browse the repository at this point in the history
Signed-off-by: Eric Weber <eric.weber@suse.com>
  • Loading branch information
ejweber committed Aug 4, 2023
1 parent 9908616 commit 9e29695
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions controller/engine_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1565,8 +1565,8 @@ func cloneSnapshot(engine *longhorn.Engine, engineClientProxy engineapi.EngineCl
}

sourceEngineControllerURL := imutil.GetURL(sourceEngine.Status.StorageIP, sourceEngine.Status.Port)
if err := engineClientProxy.SnapshotClone(engine, snapshotName, sourceEngineControllerURL, sourceEngine.Name,
fileSyncHTTPClientTimeout); err != nil {
if err := engineClientProxy.SnapshotClone(engine, snapshotName, sourceEngineControllerURL,
sourceEngine.Spec.VolumeName, sourceEngine.Name, fileSyncHTTPClientTimeout); err != nil {
// There is only 1 replica during volume cloning,
// so if the cloning failed, it must be that the replica failed to clone.
for _, status := range engine.Status.CloneStatus {
Expand Down
2 changes: 1 addition & 1 deletion engineapi/enginesim.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ func (e *EngineSimulator) BackupRestore(engine *longhorn.Engine, backupTarget, b
return fmt.Errorf(ErrNotImplement)
}

func (e *EngineSimulator) SnapshotClone(engine *longhorn.Engine, snapshotName, fromEngineAddress,
func (e *EngineSimulator) SnapshotClone(engine *longhorn.Engine, snapshotName, fromEngineAddress, fromVolumeName,
fromEngineName string, fileSyncHTTPClientTimeout int64) error {
return fmt.Errorf(ErrNotImplement)
}
Expand Down
4 changes: 2 additions & 2 deletions engineapi/proxy_snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ func (p *Proxy) SnapshotGet(e *longhorn.Engine, name string) (snapshot *longhorn
return recv[name], nil
}

func (p *Proxy) SnapshotClone(e *longhorn.Engine, snapshotName, fromEngineAddress, fromEngineName string,
func (p *Proxy) SnapshotClone(e *longhorn.Engine, snapshotName, fromEngineAddress, fromVolumeName, fromEngineName string,
fileSyncHTTPClientTimeout int64) (err error) {
return p.grpcClient.SnapshotClone(string(e.Spec.BackendStoreDriver), e.Name, e.Spec.VolumeName, p.DirectToURL(e),
snapshotName, fromEngineAddress, fromEngineName, int(fileSyncHTTPClientTimeout))
snapshotName, fromEngineAddress, fromVolumeName, fromEngineName, int(fileSyncHTTPClientTimeout))
}

func (p *Proxy) SnapshotCloneStatus(e *longhorn.Engine) (status map[string]*longhorn.SnapshotCloneStatus, err error) {
Expand Down
4 changes: 2 additions & 2 deletions engineapi/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ func (e *EngineBinary) SnapshotPurgeStatus(*longhorn.Engine) (map[string]*longho

// SnapshotClone calls engine binary
// TODO: Deprecated, replaced by gRPC proxy
func (e *EngineBinary) SnapshotClone(engine *longhorn.Engine, snapshotName, fromEngineAddress, fromEngineName string,
fileSyncHTTPClientTimeout int64) error {
func (e *EngineBinary) SnapshotClone(engine *longhorn.Engine, snapshotName, fromEngineAddress, fromVolumeName,
fromEngineName string, fileSyncHTTPClientTimeout int64) error {
args := []string{"snapshot", "clone", "--snapshot-name", snapshotName, "--from-controller-address",
fromEngineAddress}

Expand Down
2 changes: 1 addition & 1 deletion engineapi/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ type EngineClient interface {
SnapshotBackup(engine *longhorn.Engine, backupName, snapName, backupTarget, backingImageName, backingImageChecksum, compressionMethod string, concurrentLimit int, storageClassName string, labels, credential map[string]string) (string, string, error)
SnapshotBackupStatus(engine *longhorn.Engine, backupName, replicaAddress, replicaName string) (*longhorn.EngineBackupStatus, error)
SnapshotCloneStatus(engine *longhorn.Engine) (map[string]*longhorn.SnapshotCloneStatus, error)
SnapshotClone(engine *longhorn.Engine, snapshotName, fromEngineAddress, fromEngineName string, fileSyncHTTPClientTimeout int64) error
SnapshotClone(engine *longhorn.Engine, snapshotName, fromEngineAddress, fromVolumeName, fromEngineName string, fileSyncHTTPClientTimeout int64) error
SnapshotHash(engine *longhorn.Engine, snapshotName string, rehash bool) error
SnapshotHashStatus(engine *longhorn.Engine, snapshotName string) (map[string]*longhorn.HashStatus, error)

Expand Down

0 comments on commit 9e29695

Please sign in to comment.