|
|
|
@ -20,7 +20,6 @@ import re
|
|
|
|
|
from calculate.lib.utils.tools import SingletonParam
|
|
|
|
|
import files
|
|
|
|
|
import device
|
|
|
|
|
import xattr
|
|
|
|
|
import errno
|
|
|
|
|
from contextlib import contextmanager
|
|
|
|
|
from files import process, makeDirectory
|
|
|
|
@ -312,11 +311,11 @@ class Btrfs(object):
|
|
|
|
|
try:
|
|
|
|
|
full_dn = os.path.join(dn, rel_dn)
|
|
|
|
|
if os.path.exists(full_dn):
|
|
|
|
|
return xattr.get(full_dn, "btrfs.compression")
|
|
|
|
|
return files.xattr.get(full_dn, "btrfs.compression")
|
|
|
|
|
else:
|
|
|
|
|
return ""
|
|
|
|
|
except IOError as e:
|
|
|
|
|
if e.errno == errno.ENODATA:
|
|
|
|
|
except files.XAttrError as e:
|
|
|
|
|
if "No such attr" in str(e):
|
|
|
|
|
return ""
|
|
|
|
|
raise BtrfsError(_("Failed to get btrfs compression"))
|
|
|
|
|
|
|
|
|
@ -331,10 +330,8 @@ class Btrfs(object):
|
|
|
|
|
full_dn = os.path.join(dn, rel_dn)
|
|
|
|
|
if not os.path.exists(full_dn):
|
|
|
|
|
makeDirectory(full_dn)
|
|
|
|
|
return xattr.set(full_dn, "btrfs.compression", value)
|
|
|
|
|
except IOError as e:
|
|
|
|
|
if e.errno == errno.ENODATA:
|
|
|
|
|
return ""
|
|
|
|
|
return files.xattr.set(full_dn, "btrfs.compression", value)
|
|
|
|
|
except (IOError, files.XAttrError) as e:
|
|
|
|
|
raise BtrfsError(_("Failed to set btrfs compression"))
|
|
|
|
|
|
|
|
|
|
@compression.setter
|
|
|
|
|