We use zRAM devices as swaps so they should be protected and hidden from the user.
Vratislav Podzimek (1): Mark zRAM devices as protected and ignore them
pyanaconda/anaconda.py | 7 ++++++- pyanaconda/ui/gui/spokes/custom.py | 2 +- pyanaconda/ui/lib/disks.py | 3 +-- 3 files changed, 8 insertions(+), 4 deletions(-)
We use zRAM devices as swaps and they need to be protected. We should ignore such devices in the GUI even though they are not removable.
Also make one local import global.
Signed-off-by: Vratislav Podzimek vpodzime@redhat.com --- pyanaconda/anaconda.py | 7 ++++++- pyanaconda/ui/gui/spokes/custom.py | 2 +- pyanaconda/ui/lib/disks.py | 3 +-- 3 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/pyanaconda/anaconda.py b/pyanaconda/anaconda.py index de2ba04..4c705df 100644 --- a/pyanaconda/anaconda.py +++ b/pyanaconda/anaconda.py @@ -30,6 +30,8 @@
import os import sys +import stat +from glob import glob from tempfile import mkstemp
from pyanaconda.bootloader import get_bootloader @@ -140,7 +142,6 @@ class Anaconda(object):
@property def protected(self): - import stat specs = [] if os.path.exists("/run/initramfs/livedev") and \ stat.S_ISBLK(os.stat("/run/initramfs/livedev")[stat.ST_MODE]): @@ -152,6 +153,10 @@ class Anaconda(object): if self.stage2 and self.stage2.startswith("hd:"): specs.append(self.stage2[3:].split(":", 3)[0])
+ # zRAM swap devices need to be protected + for zram_dev in glob("/dev/zram*"): + specs.append(zram_dev) + return specs
@property diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py index 45ab6de..96366f7 100644 --- a/pyanaconda/ui/gui/spokes/custom.py +++ b/pyanaconda/ui/gui/spokes/custom.py @@ -346,7 +346,7 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker): self._hidden_disks = []
for disk in self._storage_playground.disks: - if (disk.removable and disk.protected) or not disk.mediaPresent: + if disk.protected or not disk.mediaPresent: # hide removable disks containing install media self._hidden_disks.append(disk) self._storage_playground.devicetree.hide(disk) diff --git a/pyanaconda/ui/lib/disks.py b/pyanaconda/ui/lib/disks.py index ce0d4f5..9d4607f 100644 --- a/pyanaconda/ui/lib/disks.py +++ b/pyanaconda/ui/lib/disks.py @@ -58,8 +58,7 @@ def getDisks(devicetree, fake=False):
disks = [] for d in devices: - if d.isDisk and not d.format.hidden and not (d.protected and d.removable) \ - and "zram" not in d.name: + if d.isDisk and not d.format.hidden and not d.protected: # unformatted DASDs are detected with a size of 0, but they should # still show up as valid disks if this function is called, since we # can still use them; anaconda will know how to handle them, so they
On Tue, 2014-07-29 at 15:40 +0200, Vratislav Podzimek wrote:
We use zRAM devices as swaps so they should be protected and hidden from the user.
Forgot to mention that I don't understand why only removable protected devices were hidden. If anybody has a clue, please share that wisdom.
On Tue, Jul 29, 2014 at 03:42:47PM +0200, Vratislav Podzimek wrote:
On Tue, 2014-07-29 at 15:40 +0200, Vratislav Podzimek wrote:
We use zRAM devices as swaps so they should be protected and hidden from the user.
Forgot to mention that I don't understand why only removable protected devices were hidden. If anybody has a clue, please share that wisdom.
This is to hide the install media.
On Thu, 2014-07-31 at 16:01 -0700, Brian C. Lane wrote:
On Tue, Jul 29, 2014 at 03:42:47PM +0200, Vratislav Podzimek wrote:
On Tue, 2014-07-29 at 15:40 +0200, Vratislav Podzimek wrote:
We use zRAM devices as swaps so they should be protected and hidden from the user.
Forgot to mention that I don't understand why only removable protected devices were hidden. If anybody has a clue, please share that wisdom.
This is to hide the install media.
Well, the install media is protected and removable. Which means that checking protected should be enough and I cannot come up with any example where it could be wrong.
On Fri, Aug 01, 2014 at 10:07:20AM +0200, Vratislav Podzimek wrote:
On Thu, 2014-07-31 at 16:01 -0700, Brian C. Lane wrote:
On Tue, Jul 29, 2014 at 03:42:47PM +0200, Vratislav Podzimek wrote:
On Tue, 2014-07-29 at 15:40 +0200, Vratislav Podzimek wrote:
We use zRAM devices as swaps so they should be protected and hidden from the user.
Forgot to mention that I don't understand why only removable protected devices were hidden. If anybody has a clue, please share that wisdom.
This is to hide the install media.
Well, the install media is protected and removable. Which means that checking protected should be enough and I cannot come up with any example where it could be wrong.
I can't remember any specific cases -- but we seem to re-fix hiding the media in every release so I'd err on the side of leaving it unless it is causing problems for something else.
On 07/29/2014 08:42 AM, Vratislav Podzimek wrote:
On Tue, 2014-07-29 at 15:40 +0200, Vratislav Podzimek wrote:
We use zRAM devices as swaps so they should be protected and hidden from the user.
Forgot to mention that I don't understand why only removable protected devices were hidden. If anybody has a clue, please share that wisdom.
An internal disk can be the install source and the user may still want to format and/or mount partitions from that disk. We only hide drives that are both removable and protected because they presumably have no business playing a permanent role in the post-install system.
David
On Fri, 2014-08-01 at 18:17 -0500, David Lehman wrote:
On 07/29/2014 08:42 AM, Vratislav Podzimek wrote:
On Tue, 2014-07-29 at 15:40 +0200, Vratislav Podzimek wrote:
We use zRAM devices as swaps so they should be protected and hidden from the user.
Forgot to mention that I don't understand why only removable protected devices were hidden. If anybody has a clue, please share that wisdom.
An internal disk can be the install source and the user may still want to format and/or mount partitions from that disk. We only hide drives that are both removable and protected because they presumably have no business playing a permanent role in the post-install system.
There have been some complaints (and maybe even a bug report) that we allow installation to the same disk as the one used as an installation source.
But even if we want to allow that, I think only the partition with that install source should be protected, not the whole disk. So that looks like a bug somewhere else to me.
anaconda-patches@lists.fedorahosted.org