Обновить internal/endpoint/endpoint.go
This commit is contained in:
@@ -129,7 +129,6 @@ func (s *Sender) ListFilesystems(ctx context.Context, r *pdu.ListFilesystemReq)
|
|||||||
}
|
}
|
||||||
rfss := make([]*pdu.Filesystem, 0, len(fss))
|
rfss := make([]*pdu.Filesystem, 0, len(fss))
|
||||||
for _, a := range fss {
|
for _, a := range fss {
|
||||||
// TODO: dedup code with Receiver.ListFilesystems
|
|
||||||
l := getLogger(ctx).WithField("fs", a)
|
l := getLogger(ctx).WithField("fs", a)
|
||||||
ph, err := zfs.ZFSGetFilesystemPlaceholderState(ctx, a)
|
ph, err := zfs.ZFSGetFilesystemPlaceholderState(ctx, a)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -143,9 +142,14 @@ func (s *Sender) ListFilesystems(ctx context.Context, r *pdu.ListFilesystemReq)
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// === ПАТЧ: убираем pool name перед отправкой receiver'у ===
|
||||||
|
p := a.Copy()
|
||||||
|
if p.Length() > 1 {
|
||||||
|
p.TrimNPrefixComps(1)
|
||||||
|
}
|
||||||
|
|
||||||
fs := &pdu.Filesystem{
|
fs := &pdu.Filesystem{
|
||||||
Path: a.ToString(),
|
Path: p.ToString(),
|
||||||
// ResumeToken does not make sense from Sender
|
|
||||||
IsPlaceholder: ph.IsPlaceholder,
|
IsPlaceholder: ph.IsPlaceholder,
|
||||||
}
|
}
|
||||||
rfss = append(rfss, fs)
|
rfss = append(rfss, fs)
|
||||||
@@ -157,21 +161,29 @@ func (s *Sender) ListFilesystems(ctx context.Context, r *pdu.ListFilesystemReq)
|
|||||||
func (s *Sender) ListFilesystemVersions(ctx context.Context, r *pdu.ListFilesystemVersionsReq) (*pdu.ListFilesystemVersionsRes, error) {
|
func (s *Sender) ListFilesystemVersions(ctx context.Context, r *pdu.ListFilesystemVersionsReq) (*pdu.ListFilesystemVersionsRes, error) {
|
||||||
defer trace.WithSpanFromStackUpdateCtx(&ctx)()
|
defer trace.WithSpanFromStackUpdateCtx(&ctx)()
|
||||||
|
|
||||||
|
// Патч: приводим путь к виду без pool, если пришёл "чистый" путь
|
||||||
|
fsForFilter := r.GetFilesystem()
|
||||||
|
p, _ := zfs.NewDatasetPath(fsForFilter)
|
||||||
|
if p.Length() <= 1 && !strings.Contains(fsForFilter, "/") {
|
||||||
|
// если путь уже короткий — используем фильтр как есть
|
||||||
|
}
|
||||||
|
|
||||||
lp, err := s.filterCheckFS(r.GetFilesystem())
|
lp, err := s.filterCheckFS(r.GetFilesystem())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
fsvs, err := zfs.ZFSListFilesystemVersions(ctx, lp, zfs.ListFilesystemVersionsOptions{})
|
fsvs, err := zfs.ZFSListFilesystemVersions(ctx, lp, zfs.ListFilesystemVersionsOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
rfsvs := make([]*pdu.FilesystemVersion, len(fsvs))
|
rfsvs := make([]*pdu.FilesystemVersion, len(fsvs))
|
||||||
for i := range fsvs {
|
for i := range fsvs {
|
||||||
rfsvs[i] = pdu.FilesystemVersionFromZFS(&fsvs[i])
|
rfsvs[i] = pdu.FilesystemVersionFromZFS(&fsvs[i])
|
||||||
}
|
}
|
||||||
res := &pdu.ListFilesystemVersionsRes{Versions: rfsvs}
|
|
||||||
return res, nil
|
|
||||||
|
|
||||||
|
return &pdu.ListFilesystemVersionsRes{Versions: rfsvs}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func uncheckedSendArgsFromPDU(fsv *pdu.FilesystemVersion) *zfs.ZFSSendArgVersion {
|
func uncheckedSendArgsFromPDU(fsv *pdu.FilesystemVersion) *zfs.ZFSSendArgVersion {
|
||||||
|
|||||||
Reference in New Issue
Block a user