Files
podman/libpod/sqlite_constraint_cgo.go
MayorFaj d01b7ae534 libpod: add volume rename support
Add a podman volume rename command, REST API endpoint, and bindings for renaming volumes.

The rename updates both the VolumeConfig and VolumeState tables in a single transaction and moves the volume directory on disk, rolling back if the transaction fails. Renaming an anonymous volume converts it to a named volume. Volumes that are in use, mounted, or backed by a volume plugin or the image driver cannot be renamed.

Fixes: #28189
Signed-off-by: MayorFaj <mayorfaj@gmail.com>
2026-06-11 21:56:15 +01:00

19 lines
531 B
Go

//go:build !remote && (linux || freebsd) && cgo
package libpod
import (
"errors"
sqlite3 "github.com/mattn/go-sqlite3"
)
// isSQLiteConstraint reports whether err is a SQLite constraint violation
// (for example a UNIQUE or primary-key conflict). It inspects the typed driver
// error instead of the error message so it stays correct even if the message
// wording changes.
func isSQLiteConstraint(err error) bool {
var sqliteErr sqlite3.Error
return errors.As(err, &sqliteErr) && sqliteErr.Code == sqlite3.ErrConstraint
}