func dbUpdatesApplyAll(d *Daemon) error { currentVersion := dbGetSchema(d.db) backup := false for _, update := range dbUpdates { if update.version <= currentVersion { continue } if !d.MockMode && !backup { shared.LogInfof("Updating the LXD database schema. Backup made as \"lxd.db.bak\"") err := shared.FileCopy(shared.VarPath("lxd.db"), shared.VarPath("lxd.db.bak")) if err != nil { return err } backup = true } err := update.apply(currentVersion, d) if err != nil { return err } currentVersion = update.version } return nil }
func CollectCRIULogFile(c container, imagesDir string, function string, method string) error { t := time.Now().Format(time.RFC3339) newPath := shared.LogPath(c.Name(), fmt.Sprintf("%s_%s_%s.log", function, method, t)) return shared.FileCopy(filepath.Join(imagesDir, fmt.Sprintf("%s.log", method)), newPath) }