[PATCH] Move the knowledge about network packages into ksdata.network.
by Chris Lumens
This is similar to what we're doing for authconfig and firewall.
---
pyanaconda/install.py | 6 ++----
pyanaconda/kickstart.py | 8 ++++++++
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/pyanaconda/install.py b/pyanaconda/install.py
index 087bfa8..b5b8b7a 100644
--- a/pyanaconda/install.py
+++ b/pyanaconda/install.py
@@ -213,6 +213,7 @@ def doInstall(storage, payload, ksdata, instClass):
# Check for additional packages
ksdata.authconfig.setup()
ksdata.firewall.setup()
+ ksdata.network.setup()
# make name resolution work for rpm scripts in chroot
if flags.can_touch_runtime_system("copy /etc/resolv.conf to sysroot"):
@@ -222,14 +223,11 @@ def doInstall(storage, payload, ksdata, instClass):
# system is bootable and configurable, and some other packages in order
# to finish setting up the system.
packages = storage.packages + ksdata.realm.packages
- packages += ksdata.authconfig.packages + ksdata.firewall.packages
+ packages += ksdata.authconfig.packages + ksdata.firewall.packages + ksdata.network.packages
if willInstallBootloader:
packages += storage.bootloader.packages
- if network.is_using_team_device():
- packages.append("teamd")
-
# don't try to install packages from the install class' ignored list and the
# explicitly excluded ones (user takes the responsibility)
packages = [p for p in packages
diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
index 804f729..e92aa48 100644
--- a/pyanaconda/kickstart.py
+++ b/pyanaconda/kickstart.py
@@ -1079,6 +1079,14 @@ class Logging(commands.logging.FC6_Logging):
logger.updateRemote(remote_server)
class Network(commands.network.F22_Network):
+ def __init__(self, *args, **kwargs):
+ commands.network.F22_Network.__init__(self, *args, **kwargs)
+ self.packages = []
+
+ def setup(self):
+ if network.is_using_team_device():
+ self.packages = ["teamd"]
+
def execute(self, storage, ksdata, instClass):
network.write_network_config(storage, ksdata, instClass, iutil.getSysroot())
--
2.4.3
9 years
[PATCH] Move the big block of late storage writing out of install.py.
by Chris Lumens
We're trying to reduce install.py to a simpler, more straightfoward format
where it's just a list of things that need to be done. We can get rid of
some of the conditional checking by moving this code into payloads and
having those payloads just provide blank overridden methods.
---
pyanaconda/install.py | 30 ++----------------------
pyanaconda/packaging/__init__.py | 40 ++++++++++++++++++++++++++++++++
pyanaconda/packaging/livepayload.py | 3 +++
pyanaconda/packaging/rpmostreepayload.py | 3 +++
4 files changed, 48 insertions(+), 28 deletions(-)
diff --git a/pyanaconda/install.py b/pyanaconda/install.py
index 2b6b8aa..4f83a15 100644
--- a/pyanaconda/install.py
+++ b/pyanaconda/install.py
@@ -37,7 +37,6 @@ from pyanaconda.ui.lib.entropy import wait_for_entropy
from pyanaconda.kickstart import runPostScripts, runPreInstallScripts
from pyanaconda.kexec import setup_kexec
import logging
-import blivet
log = logging.getLogger("anaconda")
def _writeKS(ksdata):
@@ -200,10 +199,7 @@ def doInstall(storage, payload, ksdata, instClass):
wait_for_entropy=entropy_wait_clbk)
turnOnFilesystems(storage, mountOnly=flags.flags.dirInstall, callbacks=callbacks_reg)
- write_storage_late = (flags.flags.livecdInstall or ksdata.ostreesetup.seen
- or ksdata.method.method == "liveimg")
- if not write_storage_late and not flags.flags.dirInstall:
- storage.write()
+ payload.writeStorageEarly()
# Run %pre-install scripts with the filesystem mounted and no packages
with progress_report(_("Running pre-installation scripts")):
@@ -244,29 +240,7 @@ def doInstall(storage, payload, ksdata, instClass):
payload.preInstall(packages=packages, groups=payload.languageGroups())
payload.install()
- if write_storage_late and not flags.flags.dirInstall:
- if iutil.getSysroot() != iutil.getTargetPhysicalRoot():
- blivet.setSysroot(iutil.getTargetPhysicalRoot(),
- iutil.getSysroot())
-
- # Now that we have the FS layout in the target, umount
- # things that were in the legacy sysroot, and put them in
- # the target root, except for the physical /. First,
- # unmount all target filesystems.
- storage.umountFilesystems()
-
- # Explicitly mount the root on the physical sysroot
- rootmnt = storage.mountpoints.get('/')
- rootmnt.setup()
- rootmnt.format.setup(options=rootmnt.format.options, chroot=iutil.getTargetPhysicalRoot())
-
- payload.prepareMountTargets(storage)
-
- # Everything else goes in the target root, including /boot
- # since the bootloader code will expect to find /boot
- # inside the chroot.
- storage.mountFilesystems(skipRoot=True)
- storage.write()
+ payload.writeStorageLate()
# Do bootloader.
if willInstallBootloader:
diff --git a/pyanaconda/packaging/__init__.py b/pyanaconda/packaging/__init__.py
index fd548cf..3371c76 100644
--- a/pyanaconda/packaging/__init__.py
+++ b/pyanaconda/packaging/__init__.py
@@ -69,6 +69,7 @@ from blivet.errors import StorageError
import blivet.util
import blivet.arch
from blivet.platform import platform
+from blivet import setSysroot
from pyanaconda.product import productName, productVersion
USER_AGENT = "%s (anaconda)/%s" %(productName, productVersion)
@@ -598,6 +599,45 @@ class Payload(object):
self._copyDriverDiskFiles()
+ def writeStorageEarly(self):
+ """Some packaging payloads require that the storage configuration be
+ written out before doing installation. Right now, this is basically
+ just the dnfpayload. Payloads should only implement one of these
+ methods by overriding the unneeded one with a pass.
+ """
+ if self.data.method.method != "liveimg" and not flags.dirInstall:
+ self.storage.write()
+
+ def writeStorageLate(self):
+ """Some packaging payloads require that the storage configuration be
+ written out after doing installation. Right now, this is basically
+ every payload except for dnf. Payloads should only implement one of
+ these methods by overriding the unneeded one with a pass.
+ """
+ if self.data.method.method == "liveimg" and not flags.dirInstall:
+ if iutil.getSysroot() != iutil.getTargetPhysicalRoot():
+ setSysroot(iutil.getTargetPhysicalRoot(), iutil.getSysroot())
+
+ # Now that we have the FS layout in the target, umount
+ # things that were in the legacy sysroot, and put them in
+ # the target root, except for the physical /. First,
+ # unmount all target filesystems.
+ self.storage.umountFilesystems()
+
+ # Explicitly mount the root on the physical sysroot
+ rootmnt = storage.mountpoints.get('/')
+ rootmnt.setup()
+ rootmnt.format.setup(options=rootmnt.format.options, chroot=iutil.getTargetPhysicalRoot())
+
+ self.prepareMountTargets(self.storage)
+
+ # Everything else goes in the target root, including /boot
+ # since the bootloader code will expect to find /boot
+ # inside the chroot.
+ self.storage.mountFilesystems(skipRoot=True)
+
+ self.storage.write()
+
# Inherit abstract methods from Payload
# pylint: disable=abstract-method
class ImagePayload(Payload):
diff --git a/pyanaconda/packaging/livepayload.py b/pyanaconda/packaging/livepayload.py
index fcccb7c..c0508a5 100644
--- a/pyanaconda/packaging/livepayload.py
+++ b/pyanaconda/packaging/livepayload.py
@@ -539,3 +539,6 @@ class LiveImageKSPayload(LiveImagePayload):
# Strip out vmlinuz- from the names
return sorted((n.split("/")[-1][8:] for n in names if "boot/vmlinuz-" in n),
key=functools.cmp_to_key(versionCmp))
+
+ def writeStorageEarly(self):
+ pass
diff --git a/pyanaconda/packaging/rpmostreepayload.py b/pyanaconda/packaging/rpmostreepayload.py
index d68eec0..80a54a2 100644
--- a/pyanaconda/packaging/rpmostreepayload.py
+++ b/pyanaconda/packaging/rpmostreepayload.py
@@ -299,3 +299,6 @@ class RPMOSTreePayload(ArchivePayload):
set_kargs_args.extend(self.storage.bootloader.boot_args)
set_kargs_args.append("root=" + self.storage.rootDevice.fstabSpec)
self._safeExecWithRedirect("ostree", set_kargs_args, root=iutil.getSysroot())
+
+ def writeStorageEarly(self):
+ pass
--
2.4.3
9 years
New: [rhinstaller/blivet/pulls/165 master] Master format copy
by dashea
A shallow copy of an FS object leaves all the new object's task objects referring to the copied object.
This patch set should fix that.
The first two patches enforce that an FSTask has only one instance attribute, its FS object, which is important for the fix, and also gets rid of some boilerplate initializers that existed in the expectation that there might someday be more instance attributes in a filesystem task.
--
To view this pull request on github, visit https://github.com/rhinstaller/blivet/pull/165
9 years
Updated: [rhinstaller/blivet/pulls/156 master] LVM cache detection, manipulation and reporting
by dashea
These commits add generic classes for Cache monitoring, manipulation and reporting, the implementation for the LVM Cache and pieces of code needed for the ``LVMLogicalVolumeDevice`` class to support cached LVs.
The reason why cached LV is not a new, separate class is that when the cache is detached, such (formerly) cached LV becomes a normal LV like any other and its not possible to change the type/class of an existing object. Thus the ``LVMCache`` class is added instead the instances of which are referenced by cached LVs and provide the cache-related functionality to them. The same approach will be later used for ``BcacheDevice`` and ``BcacheCache`` classes (a device can be formatted as a ``BcacheDevice`` with no cache attached to it).
--
To view this pull request on github, visit https://github.com/rhinstaller/blivet/pull/156
9 years
Re: [rhinstaller/blivet/pulls/156 master] LVM cache detection, manipulation and reporting
by dashea
> @@ -847,6 +859,28 @@ def removeInternalLV(self, int_lv):
> self.name)
> raise ValueError(msg)
>
> + @property
> + def cached(self):
> + return bool(self.cache)
> +
> + @property
> + def cache(self):
> + if self.exists and not self._cache:
> + # check if we have a cache pool internal LV
> + pool = None
> + for lv in self._internal_lvs:
> + if isinstance(lv, LVMCachePoolLogicalVolumeDevice):
> + pool = lv
> +
> + self._cache = LVMCache(self, size=pool.size, exists=True)
> +
> + return self._cache
Wow, good catch, thanks!
--
To view this pull request on github, visit https://github.com/rhinstaller/blivet/pull/156#discussion_r33232116
9 years
[PATCH] The attribute is named ostreesetup.nogpg.
by Chris Lumens
noGpg was removed over a year ago. It's probably safe to assume no one has
that version of pykickstart in fresh installs anymore.
---
pyanaconda/packaging/rpmostreepayload.py | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/pyanaconda/packaging/rpmostreepayload.py b/pyanaconda/packaging/rpmostreepayload.py
index 0df7dc5..d68eec0 100644
--- a/pyanaconda/packaging/rpmostreepayload.py
+++ b/pyanaconda/packaging/rpmostreepayload.py
@@ -147,9 +147,7 @@ class RPMOSTreePayload(ArchivePayload):
self._remoteOptions = {}
- # Handle variations in pykickstart
- if ((hasattr(ostreesetup, 'noGpg') and ostreesetup.noGpg) or
- (hasattr(ostreesetup, 'nogpg') and ostreesetup.nogpg)):
+ if hasattr(ostreesetup, 'nogpg') and ostreesetup.nogpg:
self._remoteOptions['gpg-verify'] = GLib.Variant('b', False)
if flags.noverifyssl:
--
2.4.3
9 years