Skip to content
This repository has been archived by the owner on Aug 29, 2018. It is now read-only.

REST API should support listing all units, including those that are stopped or failed #228

Closed
wallrj opened this issue Jul 7, 2014 · 7 comments

Comments

@wallrj
Copy link
Contributor

wallrj commented Jul 7, 2014

In #152 (comment) gear list-units gained an --all option.

But there isn't currently anything similar for the REST API.

On 6 July 2014 17:23, Clayton Coleman ccoleman@redhat.com wrote:
...

List containers is systemd focused (returns running containers by default). One tricky consequence of that is that containers that stopped cleanly are not shown - the "-a" flag scans the filesystem for missing entries. We'd need to do something similar to unify the systemd status info with the on disk info.

@itamarst
Copy link

itamarst commented Jul 7, 2014

I'm pretty sure this is possible with /containers?all=1 request.

@smarterclayton
Copy link
Contributor

@wallrj itamarst is correct, all=1 is the equivalent.

@wallrj
Copy link
Contributor Author

wallrj commented Jul 10, 2014

Thanks @smarterclayton and sorry for the noise. Here's where I've started using the ?all=1 query string in our product.

I'd really appreciate if you had time to comment there about the different unit states that we can expect to be included by all=1. Also if you could comment on the circumstances in which a unit reaches the dead state. Or just some pointers to the relevant source code.

Thanks again for gear 😄

@smarterclayton
Copy link
Contributor

By definition anything systemd is tracking in memory is in one of these states - with the special caveat that systemd reserves the right to remove anything from memory that it doesn't need to track. So http://cgit.freedesktop.org/systemd/systemd/tree/src/core/unit.h#n47 are the states systemd tracks. If something is unloaded it just means systemd doesn't need it. So anything that is linked into systemd, but not loaded in memory, has the equivalent ActiveState "inactive", LoadState "loaded", and SubState "dead", even though systemd doesn't return them.

@itamarst
Copy link

So geard provides the extra benefit of adding in stuff that is not in systemd memory by scanning the filesystem, as mentioned in the mailing list post above?

@smarterclayton
Copy link
Contributor

Right - you can call systemd list-unit-files which scans all the watched folders - but that's a superset of what geard scans. Since geard only exposes certain named units and there is a convention for those, we settled for the slightly more efficient scan.

@itamarst
Copy link

Excellent, thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants