bsdci / libioc

A Python library to manage jails with ioc{age,ell}
https://bsd.ci/libioc
Other
38 stars 11 forks source link

Track last_started date of jails #632

Open gronke opened 5 years ago

gronke commented 5 years ago

It is reasonable to track when a jail was last started successfully. Unlike iocage this should not be stored in a Jail configuration.

igalic commented 5 years ago

this is something an external orchestration tool would have a much easier time tracking. and a much more understandable need for doing it to begin with

himrock922 commented 5 years ago

If the orchestration tool makes track, Should libioc returns only response with last_started?

https://github.com/bsdci/libioc/blob/master/libioc/Jail.py#L2289

If above line changes that like return response datetime for last_started, jail config not store and return last_started...?

gronke commented 5 years ago

We currently fork a process to query jail state. In Python this is an expensive operation, so that we first need to create interfaces for libc jail_get and jail_set.

@fabianfreyer has pioneered on a Rust library with Python interface that is about to be utilized in #594. I'm not so much in favor to depend on Rust, but after a review, it is a well designed library.

With this we will be able to always query jail state on the fly at low cost, so that changed state can easily be signaled from changing operations (I'm thinking about the JailEvent informing about state change).