[PATCH v5 1/2] lxc: Add Real Time Clock device into allowed devices

Michal Prívozník mprivozn at redhat.com
Mon Mar 16 18:16:13 UTC 2020


On 2. 3. 2020 1:54, Julio Faracco wrote:
> This commit share host Real Time Clock device (rtc) into LXC containers
> to support hardware clock. This should be available setting up a `rtc`
> timer under clock section. Since this option is not emulated, it should
> be available only for `localtime` clock. This option should be readonly
> due to security reasons.
> 
> Before:
>     root# hwclock --verbose
>     hwclock from util-linux 2.32.1
>     System Time: 1581877557.598365
>     Trying to open: /dev/rtc0
>     Trying to open: /dev/rtc
>     Trying to open: /dev/misc/rtc
>     No usable clock interface found.
>     hwclock: Cannot access the Hardware Clock via any known method.
> 
> Now:
>     root# hwclock
>     2020-02-16 18:23:55.374134+00:00
>     root# hwclock -w
>     hwclock: ioctl(RTC_SET_TIME) to /dev/rtc to set the time failed:
>     Permission denied
> 
> Signed-off-by: Julio Faracco <jcfaracco at gmail.com>
> ---
>  docs/formatdomain.html.in |  2 +-
>  src/lxc/lxc_cgroup.c      | 33 ++++++++++++++++++++
>  src/lxc/lxc_controller.c  | 66 +++++++++++++++++++++++++++++++++++++++
>  3 files changed, 100 insertions(+), 1 deletion(-)

On my system, the /dev/rtc is just a symlink to /dev/rtc0. Should we
create the symlink too or is it okay to just create /dev/rtc?

Otherwise looking good.

Michal




More information about the libvir-list mailing list