mirror of
https://github.com/containers/podman.git
synced 2025-07-28 10:52:35 +08:00

This PR is a mishmash of updates needed so that the hyperv provider can begin to passd the machine e2e tests. Summary as follows: * Added custom error handling for machine errors so that all providers can generate the same formatted error messages. The ones implemented thus far are needed for the basic and init tests. More will come as they are identified. * Vendored new libhvee for better memory inspection. The memory type changed from uint32 to uint64. * Some machine e2e tests used linux-specific utilities to check various error conditions and messages (like pgrep). Those were made into functions and implemented on an operating system level. [NO NEW TESTS NEEDED] Signed-off-by: Brent Baude <bbaude@redhat.com>
43 lines
1.1 KiB
Go
43 lines
1.1 KiB
Go
package machine
|
|
|
|
import (
|
|
"errors"
|
|
"fmt"
|
|
|
|
"github.com/containers/podman/v4/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)
|
|
}
|