[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[PATCH 2/2 rhel6-branch master] Add noeject support anaconda (#665094)



When noeject is passed on the kernel command line do not eject the
cdrom, not even if eject is passed in a kickstart file.

Resolves: rhbz#665094
---
 anaconda           |    4 ++++
 flags.py           |    1 +
 storage/devices.py |    5 +++++
 3 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/anaconda b/anaconda
index 2c16e36..aabb809 100755
--- a/anaconda
+++ b/anaconda
@@ -251,6 +251,7 @@ def parseOptions():
     op.add_option("--ibft", action="store_true")
     op.add_option("--noiscsi", dest="iscsi", action="store_false", default=False)
     op.add_option("--iscsi", action="store_true")
+    op.add_option("--noeject", action="store_true")
 
     # Miscellaneous
     op.add_option("--module", action="append", default=[])
@@ -783,6 +784,9 @@ if __name__ == "__main__":
     if opts.iscsi:
         flags.iscsi = 1
 
+    if opts.noeject:
+        flags.noeject = True
+
     if opts.targetArch:
         flags.targetarch = opts.targetArch
 
diff --git a/flags.py b/flags.py
index 702a30d..e01ec63 100644
--- a/flags.py
+++ b/flags.py
@@ -94,6 +94,7 @@ class Flags:
         self.__dict__['flags']['sshd'] = 0
         self.__dict__['flags']['noverifyssl'] = False
         self.__dict__['flags']['preexisting_x11'] = False
+        self.__dict__['flags']['noeject'] = False
         # for non-physical consoles like some ppc and sgi altix,
         # we need to preserve the console device and not try to
         # do things like bogl on them.  this preserves what that
diff --git a/storage/devices.py b/storage/devices.py
index 2a243d2..61082be 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -109,6 +109,7 @@ import block
 
 from errors import *
 from iutil import notify_kernel, numeric_type
+from flags import flags
 from .storage_log import log_method_call
 from udev import *
 from formats import get_device_format_class, getFormat, DeviceFormat
@@ -3605,6 +3606,10 @@ class OpticalDevice(StorageDevice):
         #try to umount and close device before ejecting
         self.teardown()
 
+        if flags.noeject:
+            log.info("noeject in effect, not ejecting cdrom")
+            return
+
         # Make a best effort attempt to do the eject.  If it fails, it's not
         # critical.
         fd = os.open(self.path, os.O_RDONLY | os.O_NONBLOCK)
-- 
1.7.3.4


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]