mirror of
https://github.com/containers/podman.git
synced 2026-07-08 22:35:01 -04:00
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>
19 lines
531 B
Go
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
|
|
}
|