|
|
0b05ab |
From ac5646f8e9e59389bdc651c63b5e7dcd2d693bf4 Mon Sep 17 00:00:00 2001
|
|
|
0b05ab |
From: Radek Vykydal <rvykydal@redhat.com>
|
|
|
0b05ab |
Date: Wed, 22 May 2019 13:35:01 +0200
|
|
|
0b05ab |
Subject: [PATCH] Add flag for protecting cdrom devices during populate
|
|
|
0b05ab |
|
|
|
0b05ab |
Resolves: rhbz#1719648
|
|
|
0b05ab |
---
|
|
|
0b05ab |
blivet/devices/optical.py | 14 ++++++++++++++
|
|
|
0b05ab |
blivet/flags.py | 3 +++
|
|
|
0b05ab |
2 files changed, 17 insertions(+)
|
|
|
0b05ab |
|
|
|
0b05ab |
diff --git a/blivet/devices/optical.py b/blivet/devices/optical.py
|
|
|
0b05ab |
index b9dba1f2..122825f2 100644
|
|
|
0b05ab |
--- a/blivet/devices/optical.py
|
|
|
0b05ab |
+++ b/blivet/devices/optical.py
|
|
|
0b05ab |
@@ -24,6 +24,7 @@
|
|
|
0b05ab |
from .. import errors
|
|
|
0b05ab |
from .. import util
|
|
|
0b05ab |
from ..storage_log import log_method_call
|
|
|
0b05ab |
+from ..flags import flags
|
|
|
0b05ab |
|
|
|
0b05ab |
import logging
|
|
|
0b05ab |
log = logging.getLogger("blivet")
|
|
|
0b05ab |
@@ -81,3 +82,16 @@ def eject(self):
|
|
|
0b05ab |
util.run_program(["eject", self.name])
|
|
|
0b05ab |
except OSError as e:
|
|
|
0b05ab |
log.warning("error ejecting cdrom %s: %s", self.name, e)
|
|
|
0b05ab |
+
|
|
|
0b05ab |
+ @property
|
|
|
0b05ab |
+ def protected(self):
|
|
|
0b05ab |
+ protected = super(OpticalDevice, self).protected
|
|
|
0b05ab |
+
|
|
|
0b05ab |
+ if flags.protect_cdroms:
|
|
|
0b05ab |
+ return True
|
|
|
0b05ab |
+ else:
|
|
|
0b05ab |
+ return protected
|
|
|
0b05ab |
+
|
|
|
0b05ab |
+ @protected.setter
|
|
|
0b05ab |
+ def protected(self, value):
|
|
|
0b05ab |
+ self._protected = value
|
|
|
0b05ab |
diff --git a/blivet/flags.py b/blivet/flags.py
|
|
|
0b05ab |
index 6500be30..a6a78edc 100644
|
|
|
0b05ab |
--- a/blivet/flags.py
|
|
|
0b05ab |
+++ b/blivet/flags.py
|
|
|
0b05ab |
@@ -77,6 +77,9 @@ def __init__(self):
|
|
|
0b05ab |
# (so far only for LUKS)
|
|
|
0b05ab |
self.discard_new = False
|
|
|
0b05ab |
|
|
|
0b05ab |
+ # whether cdroms should be protected
|
|
|
0b05ab |
+ self.protect_cdroms = False
|
|
|
0b05ab |
+
|
|
|
0b05ab |
self.boot_cmdline = {}
|
|
|
0b05ab |
|
|
|
0b05ab |
self.update_from_boot_cmdline()
|