restore daemon: create /run/proxmox-backup on startup

fixes file restore again.

The new Memcom tracking file lives in `/run/proxmox-backup` and is
always created on REST interaction, as CachedUserInfo uses it to
efficiently track config changes, and such a cache is used in each
REST handle_request.

Further, the Memcom infra expects the base run PBS dir to exists
already, which is an OK assumption to have, but in the file-restore
daemon we have a significantly more minimal environment, and the run
dir was simply not required there, even /run isn't a tmpfs yet.

Fixes fda19dcc6f ("fix CachedUserInfo by using a shared memory version counter")
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
(cherry picked from commit 33d7292f29)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2021-07-03 21:03:13 +02:00
parent e9c2a34def
commit e2d82c7d4d
1 changed files with 4 additions and 0 deletions

View File

@ -49,6 +49,10 @@ fn main() -> Result<(), Error> {
.write_style(env_logger::WriteStyle::Never) .write_style(env_logger::WriteStyle::Never)
.init(); .init();
// the API may save some stuff there, e.g., the memcon tracking file
// we do not care much, but it's way less headache to just create it
std::fs::create_dir_all("/run/proxmox-backup")?;
// scan all attached disks now, before starting the API // scan all attached disks now, before starting the API
// this will panic and stop the VM if anything goes wrong // this will panic and stop the VM if anything goes wrong
{ {