This commit is contained in:
shoopea
2022-04-16 21:30:47 +08:00
parent ed261141f5
commit 2ae1737081
2 changed files with 17 additions and 13 deletions

22
app.go
View File

@@ -433,13 +433,15 @@ func (a AppConfig) CheckZFS() error {
return fmt.Errorf("No path %s on source", string(src))
}
for _, dest := range a.Destinations {
if !cfg.Box[dest.Box()].ZFSIsZFS(dest.Path() + "/" + src.Box() + "/" + src.Path()) {
err := cfg.Box[dest.Box()].ZFSCreateZFS(dest.Path() + "/" + src.Box() + "/" + src.Path())
if err != nil {
if *debugFlag {
log.Printf("AppConfig.CheckZFS : %s : Error creating %s on %s", a.Name, dest.Path()+"/"+src.Box()+"/"+src.Path(), dest.Box())
if cfg.Box[dest.Box()].online {
if !cfg.Box[dest.Box()].ZFSIsZFS(dest.Path() + "/" + src.Box() + "/" + src.Path()) {
err := cfg.Box[dest.Box()].ZFSCreateZFS(dest.Path() + "/" + src.Box() + "/" + src.Path())
if err != nil {
if *debugFlag {
log.Printf("AppConfig.CheckZFS : %s : Error creating %s on %s", a.Name, dest.Path()+"/"+src.Box()+"/"+src.Path(), dest.Box())
}
return err
}
return err
}
}
}
@@ -658,9 +660,11 @@ func (a AppConfig) CleanupSnapshot() error {
cleanupSnapshot := make(map[string]string)
for _, dest := range a.Destinations {
for _, src := range a.Sources {
cleanupSnapshot[src.Box()] = cleanupSnapshot[src.Box()] + " " + src.Path()
cleanupSnapshot[dest.Box()] = cleanupSnapshot[dest.Box()] + " " + dest.Path() + "/" + src.Box() + "/" + src.Path()
if cfg.Box[dest.Box()].online {
for _, src := range a.Sources {
cleanupSnapshot[src.Box()] = cleanupSnapshot[src.Box()] + " " + src.Path()
cleanupSnapshot[dest.Box()] = cleanupSnapshot[dest.Box()] + " " + dest.Path() + "/" + src.Box() + "/" + src.Path()
}
}
}