[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
[PATCH] Fix handling of bind mounts. (#496406)
- From: David Lehman <dlehman redhat com>
- To: anaconda-devel-list redhat com
- Cc:
- Subject: [PATCH] Fix handling of bind mounts. (#496406)
- Date: Thu, 23 Apr 2009 17:35:47 -0500
When we're parsing /etc/fstab the directories that serve as the devices
in bind mounts are not going to be present, so we will have a hell of a
time figuring out what devices contain them. However, in
FSSet.mountFilesystems we should have those dirs set up already, making
it possible to sort out.
---
storage/__init__.py | 35 ++++++++++++++++++++++++++++++++---
1 files changed, 32 insertions(+), 3 deletions(-)
diff --git a/storage/__init__.py b/storage/__init__.py
index 13f34f9..4303eff 100644
--- a/storage/__init__.py
+++ b/storage/__init__.py
@@ -43,6 +43,7 @@ from formats import getFormat
from formats import get_device_format_class
from formats import get_default_filesystem_type
from devicelibs.lvm import safeLvmName
+from devicelibs.dm import name_from_dm_node
from udev import *
import iscsi
import zfcp
@@ -1165,6 +1166,10 @@ def get_containing_device(path, devicetree):
except Exception:
return None
+ if device_name.startswith("dm-"):
+ # have I told you lately that I love you, device-mapper?
+ device_name = name_from_dm_node(device_name)
+
return devicetree.getDeviceByName(device_name)
@@ -1267,9 +1272,13 @@ class FSSet(object):
# bind mount... set fstype so later comparison won't
# turn up false positives
fstype = "bind"
- device = FileDevice(devspec,
- parents=get_containing_device(devspec, self.devicetree),
- exists=True)
+
+ # This is probably not going to do anything useful, so we'll
+ # make sure to try again from FSSet.mountFilesystems. The bind
+ # mount targets should be accessible by the time we try to do
+ # the bind mount from there.
+ parents = get_containing_device(devspec, self.devicetree)
+ device = DirectoryDevice(devspec, parents=parents, exists=True)
device.format = getFormat("bind",
device=device.path,
exists=True)
@@ -1477,6 +1486,11 @@ class FSSet(object):
devices = self.mountpoints.values() + self.swapDevices
devices.extend([self.dev, self.devshm, self.devpts, self.sysfs, self.proc])
devices.sort(key=lambda d: getattr(d.format, "mountpoint", None))
+ for device in devices[:]:
+ # make sure all the bind mounts are at the end of the list
+ if device.format.type == "bind":
+ devices.remove(device)
+ devices.append(device)
for device in devices:
if not device.format.mountable or not device.format.mountpoint:
@@ -1489,6 +1503,21 @@ class FSSet(object):
if "noauto" in options.split(","):
continue
+ if device.format.type == "bind":
+ # set up the DirectoryDevice's parents now that they are
+ # accessible
+ #
+ # -- bind formats' device and mountpoint are always both
+ # under the chroot. no exceptions. none, damn it.
+ targetDir = "%s/%s" % (anaconda.rootPath, device.path)
+ parent = get_containing_device(targetDir, self.devicetree)
+ if not parent:
+ log.error("cannot determine which device contains "
+ "directory %s" % device.path)
+ device.parents = []
+ else:
+ device.parents = [parent]
+
try:
device.setup()
except Exception as msg:
--
1.6.0.6
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]