mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-09-09 01:04:59 +00:00
storage: attempt to disable COW by default
This calls virFileSetCOW when building a pool with a request to attempt, but not require, COW to be disabled. The effect is that nothing changes on non-btrfs filesystems, but btrfs will get COW disabled on the directory. This setting is then inherited by all newly created files in the pool, avoiding the need for mgmt app to set "nocow" on a per-volume basis. Reviewed-by: Neal Gompa <ngompa13@gmail.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
e944a71f09
commit
f12b283897
@ -2712,6 +2712,7 @@ virStorageBackendBuildLocal(virStoragePoolObjPtr pool)
|
|||||||
bool needs_create_as_uid;
|
bool needs_create_as_uid;
|
||||||
unsigned int dir_create_flags;
|
unsigned int dir_create_flags;
|
||||||
g_autofree char *parent = NULL;
|
g_autofree char *parent = NULL;
|
||||||
|
int ret;
|
||||||
|
|
||||||
parent = g_strdup(def->target.path);
|
parent = g_strdup(def->target.path);
|
||||||
if (!(p = strrchr(parent, '/'))) {
|
if (!(p = strrchr(parent, '/'))) {
|
||||||
@ -2745,11 +2746,19 @@ virStorageBackendBuildLocal(virStoragePoolObjPtr pool)
|
|||||||
/* Now create the final dir in the path with the uid/gid/mode
|
/* Now create the final dir in the path with the uid/gid/mode
|
||||||
* requested in the config. If the dir already exists, just set
|
* requested in the config. If the dir already exists, just set
|
||||||
* the perms. */
|
* the perms. */
|
||||||
return virDirCreate(def->target.path,
|
ret = virDirCreate(def->target.path,
|
||||||
mode,
|
mode,
|
||||||
def->target.perms.uid,
|
def->target.perms.uid,
|
||||||
def->target.perms.gid,
|
def->target.perms.gid,
|
||||||
dir_create_flags);
|
dir_create_flags);
|
||||||
|
if (ret < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (virFileSetCOW(def->target.path,
|
||||||
|
VIR_TRISTATE_BOOL_ABSENT) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user