[master 5/5] Replace _mountpoint with systemMountpoint in other modules
vojtechtrefny
installerbot-noreply at redhat.com
Mon Mar 16 12:29:02 UTC 2015
From: Vojtech Trefny <vtrefny at redhat.com>
Signed-off-by: Vojtech Trefny <vtrefny at redhat.com>
---
blivet/devices/btrfs.py | 22 +++++++++++-----------
blivet/devices/file.py | 2 +-
blivet/formats/fs.py | 32 ++++++++++++++------------------
3 files changed, 26 insertions(+), 30 deletions(-)
diff --git a/blivet/devices/btrfs.py b/blivet/devices/btrfs.py
index 4f4ade1..dddbfbc 100644
--- a/blivet/devices/btrfs.py
+++ b/blivet/devices/btrfs.py
@@ -108,14 +108,14 @@ def _do_temp_mount(self, orig=False):
fmt.mount(mountpoint=tmpdir)
def _undo_temp_mount(self):
- if getattr(self.format, "_mountpoint", None):
+ if getattr(self.format, "systemMountpoint", None):
fmt = self.format
- elif getattr(self.originalFormat, "_mountpoint", None):
+ elif getattr(self.originalFormat, "systemMountpoint", None):
fmt = self.originalFormat
else:
return
- mountpoint = fmt._mountpoint
+ mountpoint = fmt.systemMountpoint
if os.path.basename(mountpoint).startswith(self._temp_dir_prefix):
fmt.unmount()
@@ -327,7 +327,7 @@ def listSubVolumes(self, snapshotsOnly=False):
return subvols
try:
- subvols = btrfs.list_subvolumes(self.originalFormat._mountpoint,
+ subvols = btrfs.list_subvolumes(self.originalFormat.systemMountpoint,
snapshots_only=snapshotsOnly)
except errors.BTRFSError as e:
log.debug("failed to list subvolumes: %s", e)
@@ -354,7 +354,7 @@ def removeSubVolume(self, name):
def _getDefaultSubVolumeID(self):
subvolid = None
try:
- subvolid = btrfs.get_default_subvolume(self.originalFormat._mountpoint)
+ subvolid = btrfs.get_default_subvolume(self.originalFormat.systemMountpoint)
except errors.BTRFSError as e:
log.debug("failed to get default subvolume id: %s", e)
@@ -366,7 +366,7 @@ def _setDefaultSubVolumeID(self, vol_id):
This writes the change to the filesystem, which must be mounted.
"""
try:
- btrfs.set_default_subvolume(self.originalFormat._mountpoint, vol_id)
+ btrfs.set_default_subvolume(self.originalFormat.systemMountpoint, vol_id)
except errors.BTRFSError as e:
log.error("failed to set new default subvolume id (%s): %s",
vol_id, e)
@@ -430,7 +430,7 @@ def _remove(self, member):
raise
try:
- btrfs.remove(self.originalFormat._mountpoint, member.path)
+ btrfs.remove(self.originalFormat.systemMountpoint, member.path)
finally:
self._undo_temp_mount()
@@ -442,7 +442,7 @@ def _add(self, member):
raise
try:
- btrfs.add(self.originalFormat._mountpoint, member.path)
+ btrfs.add(self.originalFormat.systemMountpoint, member.path)
finally:
self._undo_temp_mount()
@@ -527,7 +527,7 @@ def setupParents(self, orig=False):
def _create(self):
log_method_call(self, self.name, status=self.status)
self.volume._do_temp_mount()
- mountpoint = self.volume.format._mountpoint
+ mountpoint = self.volume.format.systemMountpoint
if not mountpoint:
raise RuntimeError("btrfs subvol create requires mounted volume")
@@ -547,7 +547,7 @@ def _destroy(self):
# btrfs does not allow removal of the default subvolume
self.volume._setDefaultSubVolumeID(self.volume.vol_id)
- mountpoint = self.volume.originalFormat._mountpoint
+ mountpoint = self.volume.originalFormat.systemMountpoint
if not mountpoint:
raise RuntimeError("btrfs subvol destroy requires mounted volume")
btrfs.delete_subvolume(mountpoint, self.name)
@@ -623,7 +623,7 @@ def __init__(self, *args, **kwargs):
def _create(self):
log_method_call(self, self.name, status=self.status)
self.volume._do_temp_mount()
- mountpoint = self.volume.format._mountpoint
+ mountpoint = self.volume.format.systemMountpoint
if not mountpoint:
raise RuntimeError("btrfs subvol create requires mounted volume")
diff --git a/blivet/devices/file.py b/blivet/devices/file.py
index 0997035..cd8eb79 100644
--- a/blivet/devices/file.py
+++ b/blivet/devices/file.py
@@ -65,7 +65,7 @@ def fstabSpec(self):
@property
def path(self):
try:
- root = self.parents[0].format._mountpoint
+ root = self.parents[0].format.systemMountpoint
mountpoint = self.parents[0].format.mountpoint
except (AttributeError, IndexError):
root = ""
diff --git a/blivet/formats/fs.py b/blivet/formats/fs.py
index 935b5ed..eb3f775 100644
--- a/blivet/formats/fs.py
+++ b/blivet/formats/fs.py
@@ -671,29 +671,25 @@ def mount(self, options="", chroot="/", mountpoint=None):
if not ret:
log.warning("Failed to set SELinux context for newly mounted filesystem lost+found directory at %s to %s", lost_and_found_path, lost_and_found_context)
- self._mountpoint = chrootedMountpoint
-
def unmount(self):
""" Unmount this filesystem. """
if not self.exists:
raise FSError("filesystem has not been created")
- if not self._mountpoint:
+ if not self.systemMountpoint:
# not mounted
return
- if not os.path.exists(self._mountpoint):
+ if not os.path.exists(self.systemMountpoint):
raise FSError("mountpoint does not exist")
udev.settle()
- rc = util.umount(self._mountpoint)
+ rc = util.umount(self.systemMountpoint)
if rc:
# try and catch whatever is causing the umount problem
- util.run_program(["lsof", self._mountpoint])
+ util.run_program(["lsof", self.systemMountpoint])
raise FSError("umount failed")
- self._mountpoint = None
-
def readLabel(self):
"""Read this filesystem's label.
@@ -906,7 +902,7 @@ def status(self):
# FIXME check /proc/mounts or similar
if not self.exists:
return False
- return self._mountpoint is not None
+ return self.systemMountpoint is not None
def sync(self, root="/"):
pass
@@ -1285,16 +1281,16 @@ def sync(self, root='/'):
This is a little odd because xfs_freeze will only be
available under the install root.
"""
- if not self.status or not self._mountpoint.startswith(root):
+ if not self.status or not self.systemMountpoint.startswith(root):
return
try:
- util.run_program(["xfs_freeze", "-f", self.mountpoint], root=root)
+ util.run_program(["xfs_freeze", "-f", self.systemMountpoint], root=root)
except OSError as e:
log.error("failed to run xfs_freeze: %s", e)
try:
- util.run_program(["xfs_freeze", "-u", self.mountpoint], root=root)
+ util.run_program(["xfs_freeze", "-u", self.systemMountpoint], root=root)
except OSError as e:
log.error("failed to run xfs_freeze: %s", e)
@@ -1618,14 +1614,14 @@ def _setOptions(self, options):
@property
def free(self):
- if self._mountpoint:
- # If self._mountpoint is defined, it means this tmpfs mount
+ if self.systeMountpoint:
+ # If self.systeMountpoint is defined, it means this tmpfs mount
# has been mounted and there is a path we can use as a handle to
# look-up the free space on the filesystem.
# When running with changeroot, such as during installation,
- # self._mountpoint is set to the full changeroot path once mounted,
- # so even with changeroot, statvfs should still work fine.
- st = os.statvfs(self._mountpoint)
+ # self.systeMountpoint is set to the full changeroot path once
+ # mounted so even with changeroot, statvfs should still work fine.
+ st = os.statvfs(self.systeMountpoint)
free_space = Size(st.f_bavail*st.f_frsize)
else:
# Free might be called even if the tmpfs mount has not been
@@ -1659,7 +1655,7 @@ def resizeArgs(self):
# if any mount options are defined, append them
if self._options:
remount_options = "%s,%s" % (remount_options, self._options)
- return ['-o', remount_options, self._type, self._mountpoint]
+ return ['-o', remount_options, self._type, self.systeMountpoint]
def doResize(self):
# we need to override doResize, because the
--
To view this commit on github, visit https://github.com/rhinstaller/blivet/commit/79b5011058e15526561e9bb74cda65b83ddb7178
More information about the anaconda-patches
mailing list