github.com/hanks177/podman/v4@v4.1.3-0.20220613032544-16d90015bc83/libpod/define/errors.go (about) 1 package define 2 3 import ( 4 "errors" 5 "fmt" 6 7 "github.com/containers/common/libnetwork/types" 8 ) 9 10 var ( 11 // ErrNoSuchCtr indicates the requested container does not exist 12 ErrNoSuchCtr = errors.New("no such container") 13 14 // ErrNoSuchPod indicates the requested pod does not exist 15 ErrNoSuchPod = errors.New("no such pod") 16 17 // ErrNoSuchVolume indicates the requested volume does not exist 18 ErrNoSuchVolume = errors.New("no such volume") 19 20 // ErrNoSuchNetwork indicates the requested network does not exist 21 ErrNoSuchNetwork = types.ErrNoSuchNetwork 22 23 // ErrNoSuchExecSession indicates that the requested exec session does 24 // not exist. 25 ErrNoSuchExecSession = errors.New("no such exec session") 26 27 // ErrDepExists indicates that the current object has dependencies and 28 // cannot be removed before them. 29 ErrDepExists = errors.New("dependency exists") 30 31 // ErrNoAliases indicates that the container does not have any network 32 // aliases. 33 ErrNoAliases = errors.New("no aliases for container") 34 35 // ErrMissingPlugin indicates that the requested operation requires a 36 // plugin that is not present on the system or in the configuration. 37 ErrMissingPlugin = errors.New("required plugin missing") 38 39 // ErrCtrExists indicates a container with the same name or ID already 40 // exists 41 ErrCtrExists = errors.New("container already exists") 42 // ErrPodExists indicates a pod with the same name or ID already exists 43 ErrPodExists = errors.New("pod already exists") 44 // ErrImageExists indicates an image with the same ID already exists 45 ErrImageExists = errors.New("image already exists") 46 // ErrVolumeExists indicates a volume with the same name already exists 47 ErrVolumeExists = errors.New("volume already exists") 48 // ErrExecSessionExists indicates an exec session with the same ID 49 // already exists. 50 ErrExecSessionExists = errors.New("exec session already exists") 51 // ErrNetworkExists indicates that a network with the given name already 52 // exists. 53 ErrNetworkExists = types.ErrNetworkExists 54 55 // ErrCtrStateInvalid indicates a container is in an improper state for 56 // the requested operation 57 ErrCtrStateInvalid = errors.New("container state improper") 58 // ErrExecSessionStateInvalid indicates that an exec session is in an 59 // improper state for the requested operation 60 ErrExecSessionStateInvalid = errors.New("exec session state improper") 61 // ErrVolumeBeingUsed indicates that a volume is being used by at least one container 62 ErrVolumeBeingUsed = errors.New("volume is being used") 63 64 // ErrRuntimeFinalized indicates that the runtime has already been 65 // created and cannot be modified 66 ErrRuntimeFinalized = errors.New("runtime has been finalized") 67 // ErrCtrFinalized indicates that the container has already been created 68 // and cannot be modified 69 ErrCtrFinalized = errors.New("container has been finalized") 70 // ErrPodFinalized indicates that the pod has already been created and 71 // cannot be modified 72 ErrPodFinalized = errors.New("pod has been finalized") 73 // ErrVolumeFinalized indicates that the volume has already been created and 74 // cannot be modified 75 ErrVolumeFinalized = errors.New("volume has been finalized") 76 77 // ErrInvalidArg indicates that an invalid argument was passed 78 ErrInvalidArg = types.ErrInvalidArg 79 // ErrEmptyID indicates that an empty ID was passed 80 ErrEmptyID = errors.New("name or ID cannot be empty") 81 82 // ErrInternal indicates an internal library error 83 ErrInternal = errors.New("internal libpod error") 84 85 // ErrPodPartialFail indicates that a pod operation was only partially 86 // successful, and some containers within the pod failed. 87 ErrPodPartialFail = errors.New("some containers failed") 88 89 // ErrDetach indicates that an attach session was manually detached by 90 // the user. 91 ErrDetach = errors.New("detached from container") 92 93 // ErrWillDeadlock indicates that the requested operation will cause a 94 // deadlock. This is usually caused by upgrade issues, and is resolved 95 // by renumbering the locks. 96 ErrWillDeadlock = errors.New("deadlock due to lock mismatch") 97 98 // ErrNoCgroups indicates that the container does not have its own 99 // Cgroup. 100 ErrNoCgroups = errors.New("this container does not have a cgroup") 101 // ErrNoLogs indicates that this container is not creating a log so log 102 // operations cannot be performed on it 103 ErrNoLogs = errors.New("this container is not logging output") 104 105 // ErrRootless indicates that the given command cannot but run without 106 // root. 107 ErrRootless = errors.New("operation requires root privileges") 108 109 // ErrRuntimeStopped indicates that the runtime has already been shut 110 // down and no further operations can be performed on it 111 ErrRuntimeStopped = errors.New("runtime has already been stopped") 112 // ErrCtrStopped indicates that the requested container is not running 113 // and the requested operation cannot be performed until it is started 114 ErrCtrStopped = errors.New("container is stopped") 115 116 // ErrCtrRemoved indicates that the container has already been removed 117 // and no further operations can be performed on it 118 ErrCtrRemoved = errors.New("container has already been removed") 119 // ErrPodRemoved indicates that the pod has already been removed and no 120 // further operations can be performed on it 121 ErrPodRemoved = errors.New("pod has already been removed") 122 // ErrVolumeRemoved indicates that the volume has already been removed and 123 // no further operations can be performed on it 124 ErrVolumeRemoved = errors.New("volume has already been removed") 125 // ErrExecSessionRemoved indicates that the exec session has already 126 // been removed and no further operations can be performed on it. 127 ErrExecSessionRemoved = errors.New("exec session has already been removed") 128 129 // ErrDBClosed indicates that the connection to the state database has 130 // already been closed 131 ErrDBClosed = errors.New("database connection already closed") 132 // ErrDBBadConfig indicates that the database has a different schema or 133 // was created by a libpod with a different config 134 ErrDBBadConfig = errors.New("database configuration mismatch") 135 136 // ErrNSMismatch indicates that the requested pod or container is in a 137 // different namespace and cannot be accessed or modified. 138 ErrNSMismatch = errors.New("target is in a different namespace") 139 140 // ErrNotImplemented indicates that the requested functionality is not 141 // yet present 142 ErrNotImplemented = errors.New("not yet implemented") 143 144 // ErrOSNotSupported indicates the function is not available on the particular 145 // OS. 146 ErrOSNotSupported = errors.New("no support for this OS yet") 147 148 // ErrOCIRuntime indicates a generic error from the OCI runtime 149 ErrOCIRuntime = errors.New("OCI runtime error") 150 151 // ErrOCIRuntimePermissionDenied indicates the OCI runtime attempted to invoke a command that returned 152 // a permission denied error 153 ErrOCIRuntimePermissionDenied = errors.New("OCI permission denied") 154 155 // ErrOCIRuntimeNotFound indicates the OCI runtime attempted to invoke a command 156 // that was not found 157 ErrOCIRuntimeNotFound = errors.New("OCI runtime attempted to invoke a command that was not found") 158 159 // ErrOCIRuntimeUnavailable indicates that the OCI runtime associated to a container 160 // could not be found in the configuration 161 ErrOCIRuntimeUnavailable = errors.New("OCI unavailable") 162 163 // ErrConmonOutdated indicates the version of conmon found (whether via the configuration or $PATH) 164 // is out of date for the current podman version 165 ErrConmonOutdated = errors.New("outdated conmon version") 166 // ErrConmonDead indicates that the container's conmon process has been 167 // killed, preventing normal operation. 168 ErrConmonDead = errors.New("conmon process killed") 169 170 // ErrNetworkOnPodContainer indicates the user wishes to alter network attributes on a container 171 // in a pod. This cannot be done as the infra container has all the network information 172 ErrNetworkOnPodContainer = errors.New("network cannot be configured when it is shared with a pod") 173 174 // ErrNetworkInUse indicates the requested operation failed because the network was in use 175 ErrNetworkInUse = errors.New("network is being used") 176 177 // ErrStoreNotInitialized indicates that the container storage was never 178 // initialized. 179 ErrStoreNotInitialized = errors.New("the container storage was never initialized") 180 181 // ErrNoNetwork indicates that a container has no net namespace, like network=none 182 ErrNoNetwork = errors.New("container has no network namespace") 183 184 // ErrNetworkModeInvalid indicates that a container has the wrong network mode for an operation 185 ErrNetworkModeInvalid = errors.New("invalid network mode") 186 187 // ErrSetSecurityAttribute indicates that a request to set a container's security attribute 188 // was not possible. 189 ErrSetSecurityAttribute = fmt.Errorf("%w: unable to assign security attribute", ErrOCIRuntime) 190 191 // ErrGetSecurityAttribute indicates that a request to get a container's security attribute 192 // was not possible. 193 ErrGetSecurityAttribute = fmt.Errorf("%w: unable to get security attribute", ErrOCIRuntime) 194 195 // ErrSecurityAttribute indicates that an error processing security attributes 196 // for the container 197 ErrSecurityAttribute = fmt.Errorf("%w: unable to process security attribute", ErrOCIRuntime) 198 199 // ErrCanceled indicates that an operation has been cancelled by a user. 200 // Useful for potentially long running tasks. 201 ErrCanceled = errors.New("cancelled by user") 202 203 // ErrConmonVersionFormat is used when the expected versio-format of conmon 204 // has changed. 205 ErrConmonVersionFormat = "conmon version changed format" 206 )