示例#1
0
文件: db_update.go 项目: vahe/lxd
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
}
示例#2
0
文件: migrate.go 项目: jameinel/lxd
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)
}