summaryrefslogtreecommitdiff
path: root/cmd
Commit message (Collapse)AuthorAge
* Non-running containers now report statistics via the `podman stats`Jake Correnti2022-06-14
| | | | | | | | | | | | | | | | | | | | | | command Previously, if a container was not running, and the user ran the `podman stats` command, an error would be reported: `Error: container state improper`. Podman now reports stats as the fields' default values for their respective type if the container is not running: ``` $ podman stats --no-stream demo ID NAME CPU % MEM USAGE / LIMIT MEM % NET IO BLOCK IO PIDS CPU TIME AVG CPU % 4b4bf8ce84ed demo 0.00% 0B / 0B 0.00% 0B / 0B 0B / 0B 0 0s 0.00% ``` Closes: #14498 Signed-off-by: Jake Correnti <jcorrenti13@gmail.com>
* Introduce 'Starting' status for machinesShane Smith2022-06-14
| | | | | | | | | | | | | | | | | | - The State() function now returns machine.Starting status instead of an empty string if the VM is in the process of starting. - The `CheckExclusiveActiveVM()` function returns `true` to prevent starting a VM while another is in the process of starting. - `podman machine ls` displays "Currently starting" under "Last Up" for the starting VM - `podman machine ls` supports `{{.Starting}}` boolean field in the format - `podman machine inspect` displays "starting" in the "State" field for the starting VM Signed-off-by: Shane Smith <shane.smith@shopify.com>
* compat api: fix regressions from "Swagger refactor/cleanup"Paul Holzinger2022-06-14
| | | | | | | | | | | | | | | | | | | | For some reason commit 5b79cf15a022 moved the container create options parsing from cmd/podman/common to pkg/api/handlers. However it did not remove the old code. Unfortunately it moved the code from an outdated version and did not update it before this commit was merged. Therefore a couple of regressions were introduced. I manually compared both versions and found three missing bugfixes. I fixed the network test again that was changed in bce97a3b5dd1. We want bridge as default even as rootless. Sine the test is not run as rootless in CI the regression was not caught. Also the no hosts test never worked since it was missing the import check if the hosts file exists. I don't think we can check for the volume parsing change since this only works on windows/wsl. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
* Align docker load and podman load outputAlexander Scheel2022-06-14
| | | | | | | | | | | | | | | | | | | | The comma-separated podman load output isn't conducive for using the subsequent images. For tarballs with multiple images, the comma separator must be manually identified and a suitable range identified. Docker CLI on the other hand, has one image identifier per line: Loaded image: repo1/name1:latest Loaded image: repo1/name1:tag1 Loaded image: repo2/name2:tag1 (as of Docker version 20.10.16, build aa7e414). Switch `podman load` to this format for consistency and usability. [NO NEW TESTS NEEDED] Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
* changed megabyte to mebibyteKarthik Elango2022-06-14
| | | | | | | | In podman run --help, the message said megabyte, gigabyte, etc. In reality podman takes mebibytes, gibibytes, etc. [CI:DOCS] Signed-off-by: Karthik Elango <kelango@redhat.com>
* fix bad import path for cmd/podman/utilsPaul Holzinger2022-06-14
| | | | | | | | | Libpod or packages under /pkg should never import from /cmd/... This will quickly result in import cycles and weird code paths. Also there is no reason to use this special code we can just use syscall.SIGHUB as SIGNAL. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
* Remove TODO commentJhon Honce2022-06-14
| | | | | | | | | | | | | | Allowing custom flags to provider has the potential to break all the hand-crafted commands currently in use. This could become a support nightmare. ```release-note NONE ``` [NO NEW TESTS NEEDED] Signed-off-by: Jhon Honce <jhonce@redhat.com>
* Combine the CheckAllLatest CID and PodID functionsUrvashi Mohnani2022-06-14
| | | | | | | | | | | These two functions were doing the exact same thing just with cidfile and pod-id-file separately. Combine the functionality to one function to remove repetative code. Fix the TODO in cmd/podman/validate/args.go [NO NEW TESTS NEEDED] Signed-off-by: Urvashi Mohnani <umohnani@redhat.com>
* Fix TODO in parse/net.goUrvashi Mohnani2022-06-14
| | | | | | | | | | Fix up the parseEnv function to differentiate between a label and env when parsing. Don't do a system lookup when parsing labels. [NO NEW TESTS NEEDED] Signed-off-by: Urvashi Mohnani <umohnani@redhat.com>
* Remove TODO from pods/ps.goUrvashi Mohnani2022-06-14
| | | | | | | | The TODO has already been fixed. Filters is now a []string [NO NEW TESTS NEEDED] Signed-off-by: Urvashi Mohnani <umohnani@redhat.com>
* Support remote deadlock errors in rmJhon Honce2022-06-14
| | | | | | | | | | | | | | Refactor test for deadlock by comparing error text vs. actual ErrWillDeadlock constant. When running with --remote the error constant will always be not equal to the error returned by the API. ```release-note NONE ``` [NO NEW TESTS NEEDED] Signed-off-by: Jhon Honce <jhonce@redhat.com>
* Use containers/common/pkg/util.StringToSliceDaniel J Walsh2022-06-14
| | | | | | [NO NEW TESTS NEEDED] Just code cleanup for better reuse Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* Remove TODO re: storage-driverJhon Honce2022-06-14
| | | | | | | | | | | Currently this list is not exported from c/storage and the group decided this will not be changed. ```release-note NONE ``` Signed-off-by: Jhon Honce <jhonce@redhat.com>
* linter: enable unconvert linterValentin Rothberg2022-06-14
| | | | | | | Detects unneccessary type conversions and helps in keeping the code base cleaner. Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
* Add more machine testsAshley Cui2022-06-14
| | | | | | Add more machine tests for flags in init, inspect, and list. Signed-off-by: Ashley Cui <acui@redhat.com>
* Fix strange buildtag editJason T. Greene2022-05-15
| | | | Signed-off-by: Jason T. Greene <jason.greene@redhat.com>
* Add support for machine events on WindowsJason T. Greene2022-05-15
| | | | Signed-off-by: Jason T. Greene <jason.greene@redhat.com>
* play kube default log driverNiall Crowe2022-05-05
| | | | | | | | | The default log driver is not used when using play kube without --log-driver. The LogDriver function needs to be called in order to use the default log driver. fixes #13781 Signed-off-by: Niall Crowe <nicrowe@redhat.com>
* build: disable --output for podman-remote clientsAditya R2022-05-05
| | | | | | | | | | Disable `build --output` for remote clients and update docs. [NO NEW TESTS NEEDED] [NO TESTS NEEDED] Signed-off-by: Aditya R <arajan@redhat.com> Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* Vendor in containers/buildah@v1.26.1Daniel J Walsh2022-05-05
| | | | Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* Merge pull request #14119 from ↵OpenShift Merge Robot2022-05-05
|\ | | | | | | | | openshift-cherrypick-robot/cherry-pick-14037-to-v4.1 [v4.1] Report correct RemoteURI
| * Report correct RemoteURIDaniel J Walsh2022-05-04
| | | | | | | | | | | | | | | | | | | | | | | | Rather than assuming a filesystem path, the API service URI is recorded in the libpod runtime configuration and then reported as requested. Note: All schemes other than "unix" are hard-coded to report URI exists. Fixes #12023 Signed-off-by: Jhon Honce <jhonce@redhat.com> Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* | podman system reset removed machines incorrectlyAshley Cui2022-05-04
|/ | | | | | | podman system reset did not clean up machines fully, leaving some config files, and breaking machines. Now it removes all machines files fully. Signed-off-by: Ashley Cui <acui@redhat.com>
* machine events: only open sockets when neededPaul Holzinger2022-05-04
| | | | | | | | We should only open the socket when needed and not always at init time. [NO NEW TESTS NEEDED] Signed-off-by: Paul Holzinger <pholzing@redhat.com>
* Merge pull request #14112 from ↵OpenShift Merge Robot2022-05-04
|\ | | | | | | | | openshift-cherrypick-robot/cherry-pick-14085-to-v4.1 [v4.1] Add podman machine events
| * Add podman machine eventsJhon Honce2022-05-04
| | | | | | | | Signed-off-by: Jhon Honce <jhonce@redhat.com>
* | Implement --format for machine inspectJhon Honce2022-05-04
|/ | | | | | * Fix issue of nil pointer derefence Signed-off-by: Jhon Honce <jhonce@redhat.com>
* Use simulated dual-stack binds when using WSLJason T. Greene2022-05-03
| | | | | | Resolves a WSL problem where traffic from only one stack is relayed Signed-off-by: Jason T. Greene <jason.greene@redhat.com>
* enable errcheck linterPaul Holzinger2022-05-03
| | | | | | | | The errcheck linter makes sure that errors are always check and not ignored by accident. It spotted a lot of unchecked errors, mostly in the tests but also some real problem in the code. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
* Refactor machine inspectBrent Baude2022-05-03
| | | | | | | | | | I was asked to refactor machine inspect output to represent more common and basic information. machine inspect now has information that would be appropriate for different machines. [NO NEW TESTS NEEDED] Signed-off-by: Brent Baude <bbaude@redhat.com>
* image search --format: add completion for go templatePaul Holzinger2022-05-03
| | | | | | | podman image search accepts a go template, we can use the same shell completion logic which is used everywhere else in the code. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
* shell completion --format: use structs by referencePaul Holzinger2022-05-03
| | | | | | | | | | | | For the AutocompleteFormat function we expect the correct template struct which is used in the golang template. The function can handle both struct and pointer to a struct. Using the reference is more efficient since it doe snot have to copy the whole struct. Also change some structs to use he actual type from the template instead of some nested one to make sure it has to correct fields. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
* image --format: fix add completion for go templatePaul Holzinger2022-05-03
| | | | | | | | It used the wrong struct so not all fields were listed in the completion. Fixes podman images --format and podman image history --format Signed-off-by: Paul Holzinger <pholzing@redhat.com>
* shell completion --format: use anonymous struct field oncePaul Holzinger2022-05-03
| | | | | | | | | | We should not include the anonymous twice in the suggestions. one example is `podman network ls --format {{.` it will also show `{{.Network` but since Network is the actual struct all fields are already shown so there is no need for it to be suggested. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
* network inspect --format: add completion for go templatePaul Holzinger2022-05-03
| | | | | | Make sure to autocomplete the go template for network inspect. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
* shell completion --format: work with nil structsPaul Holzinger2022-05-03
| | | | | | | | | | | | | AutocompleteFormat() takes the format struct as argument. Often the structs are deeply nested and contain other structs. Up until now if there was a pointer to a struct the logic was not able to get the field names from that, simply because the pointer was nil. However it is possible to create a new initialized type with reflect.New(). This allows us to complete all struct fields/functions even when there nil pointers. Therefore we can drop the extra initialization which was done by some callers. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
* podman search: truncate by defaultValentin Rothberg2022-05-03
| | | | | | | | | | Truncate by default to avoid long descriptions from rendering the output unreadable. [NO NEW TESTS NEEDED] Fixes: #14044 Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
* Add CreatedSince & CreatedAt format fields to podman image historyDaniel J Walsh2022-05-03
| | | | | | Fixes: https://github.com/containers/podman/issues/14012 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* Allow changing of CPUs, Memory, and Disk SizeAshley Cui2022-05-03
| | | | | | | | | Allow podman machine set to change CPUs, Memory and Disk size of a QEMU machine after its been created. Disk size can only be increased. If one setting fails to be changed, the other settings will still be applied. Signed-off-by: Ashley Cui <acui@redhat.com>
* Merge pull request #14023 from rhatdan/kubeOpenShift Merge Robot2022-04-27
|\ | | | | Truncate annotations when generating kubernetes yaml files
| * Truncate annotations when generating kubernetes yaml filesDaniel J Walsh2022-04-27
| | | | | | | | | | | | | | | | | | | | | | | | Kubernetes only allows 63 characters in an annotation. Make sure that we only add 63 or less charaters when generating kube. Warn if containers or pods have longer length and truncate. Discussion: https://github.com/containers/podman/discussions/13901 Fixes: https://github.com/containers/podman/issues/13962 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* | enable gocritic linterPaul Holzinger2022-04-26
|/ | | | | | | | | | | | | | | | | | | | | | The linter ensures a common code style. - use switch/case instead of else if - use if instead of switch/case for single case statement - add space between comment and text - detect the use of defer with os.Exit() - use short form var += "..." instead of var = var + "..." - detect problems with append() ``` newSlice := append(orgSlice, val) ``` This could lead to nasty bugs because the orgSlice will be changed in place if it has enough capacity too hold the new elements. Thus we newSlice might not be a copy. Of course most of the changes are just cosmetic and do not cause any logic errors but I think it is a good idea to enforce a common style. This should help maintainability. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
* [CI:DOCS]Remove unnecesarry filesBrent Baude2022-04-26
| | | | | | | | | Removing two files that are not needed. One is likely an accidental check-in and the other is a empty file. [NO NEW TESTS NEEDED] Signed-off-by: Brent Baude <bbaude@redhat.com>
* Merge pull request #13996 from cdoern/machineOpenShift Merge Robot2022-04-26
|\ | | | | machine starting status
| * machine starting statuscdoern2022-04-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | podman machine was using the file modification time to get the running status add three new config entries Starting (bool) Created (time) LastUp (time) to actually keep track of when these events happened. This means we can use the config file to actually store this data and not mess up the created/last-up time. This fixes the issues where the machine would report running 15 seconds before it was up. Also fixes the issue of modifying the file manually and saying the machine is "up" [NO NEW TESTS NEEDED] resolves #13711 Signed-off-by: cdoern <cbdoer23@g.holycross.edu>
* | Merge pull request #13908 from n1hility/win-mountsOpenShift Merge Robot2022-04-26
|\ \ | | | | | | Implement Windows volume/mount support
| * | Implements Windows volume/mount supportJason T. Greene2022-04-25
| | | | | | | | | | | | | | | | | | | | | Based on WSL2 9p support: remaps windows paths to /mnt/<drive> locations for both podman and Docker API clients. Signed-off-by: Jason T. Greene <jason.greene@redhat.com>
* | | Add podman machine test suiteBrent Baude2022-04-25
|/ / | | | | | | | | | | | | | | | | | | | | | | | | This PR introduces a test suite for podman machine. It can currently be run on developers' local machines and is not part of the official CI testing; however, the expectation is that any work on machine should come with an accompanying test. At present, the test must be run on Linux. It is untested on Darwin. There is no Makefile target for the test. It can be run like `ginkgo -v pkg/machine/test/.`. It should be run as a unprivileged user. Signed-off-by: Brent Baude <bbaude@redhat.com>
* | Merge pull request #13999 from Luap99/go1.18-deprecatedOpenShift Merge Robot2022-04-25
|\ \ | | | | | | [CI:DOCS] fix staticcheck linter warning for deprecated function
| * | fix staticcheck linter warning for deprecated functionPaul Holzinger2022-04-25
| | | | | | | | | | | | | | | | | | | | | | | | go1.18 deprecates `strings.Title()`. However for our use case this is still fine. The recommended replacement is adding about 400kb binary size so lets keep using this for now. Signed-off-by: Paul Holzinger <pholzing@redhat.com>