mirror of
https://github.com/containers/podman.git
synced 2025-08-06 19:44:14 +08:00

we should not panic podman when it has to deal with a podman4 machine config. instead, we throw a soft error for `machine ls` and in all other cases, we throw a hard error stating that the machine config is incompatible. a future PR will provide instructions on how to recover from this. current idea is something like `podman machine reset` which blows everything away machine-wise. Signed-off-by: Brent Baude <bbaude@redhat.com>
52 lines
1.3 KiB
Go
52 lines
1.3 KiB
Go
package define
|
|
|
|
import (
|
|
"errors"
|
|
"fmt"
|
|
|
|
"github.com/containers/common/pkg/strongunits"
|
|
)
|
|
|
|
var (
|
|
ErrNoSuchVM = errors.New("VM does not exist")
|
|
ErrWrongState = errors.New("VM in wrong state to perform action")
|
|
ErrVMAlreadyExists = errors.New("VM already exists")
|
|
ErrVMAlreadyRunning = errors.New("VM already running or starting")
|
|
ErrMultipleActiveVM = errors.New("only one VM can be active at a time")
|
|
ErrNotImplemented = errors.New("functionality not implemented")
|
|
)
|
|
|
|
type ErrVMRunningCannotDestroyed struct {
|
|
Name string
|
|
}
|
|
|
|
func (err *ErrVMRunningCannotDestroyed) Error() string {
|
|
return fmt.Sprintf("running vm %q cannot be destroyed", err.Name)
|
|
}
|
|
|
|
type ErrVMDoesNotExist struct {
|
|
Name string
|
|
}
|
|
|
|
func (err *ErrVMDoesNotExist) Error() string {
|
|
// the current error in qemu is not quoted
|
|
return fmt.Sprintf("%s: VM does not exist", err.Name)
|
|
}
|
|
|
|
type ErrNewDiskSizeTooSmall struct {
|
|
OldSize, NewSize strongunits.GiB
|
|
}
|
|
|
|
func (err *ErrNewDiskSizeTooSmall) Error() string {
|
|
return fmt.Sprintf("invalid disk size %d: new disk must be larger than %dGB", err.OldSize, err.NewSize)
|
|
}
|
|
|
|
type ErrIncompatibleMachineConfig struct {
|
|
Name string
|
|
Path string
|
|
}
|
|
|
|
func (err *ErrIncompatibleMachineConfig) Error() string {
|
|
return fmt.Sprintf("incompatible machine config %q (%s) for this version of Podman", err.Path, err.Name)
|
|
}
|