datastore: chown base dir on creation
When creating a new datastore the basedir is only owned by the backup user if it did not exist beforehand (create_path chowns only if it creates the directory), and returns false if it did not create the directory). This improves the experience when adding a new datastore on a fresh disk or existing directory (not owned by backup) - backups/pulls can be run instead of terminating with EPERM. Tested on my local testinstall with a new disk, and a existing directory: Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
This commit is contained in:
parent
be30e7d269
commit
c687da9e8e
@ -80,8 +80,9 @@ impl ChunkStore {
|
||||
|
||||
let default_options = CreateOptions::new();
|
||||
|
||||
if let Err(err) = create_path(&base, Some(default_options.clone()), Some(options.clone())) {
|
||||
bail!("unable to create chunk store '{}' at {:?} - {}", name, base, err);
|
||||
match create_path(&base, Some(default_options.clone()), Some(options.clone())) {
|
||||
Err(err) => bail!("unable to create chunk store '{}' at {:?} - {}", name, base, err),
|
||||
Ok(res) => if ! res { nix::unistd::chown(&base, Some(uid), Some(gid))? },
|
||||
}
|
||||
|
||||
if let Err(err) = create_dir(&chunk_dir, options.clone()) {
|
||||
|
Loading…
Reference in New Issue
Block a user