Commit Graph

19 Commits

Author SHA1 Message Date
Marcus Schäfer
05f2d40836
Refactor VolumeManager
This commit refactors VolumeManager to turn it into a proper
factory class and to also include type hints to facilitate it's
use from an API POV. Related to #1498
2020-11-02 18:05:21 +01:00
Marcus Schäfer
7b479cbd9c
Refactor DiskFormat
This commit refactors DiskFormat to turn it into a proper
factory class and to also include type hints to facilitate it's
use from an API POV. Related to #1498
2020-11-02 14:53:36 +01:00
Marcus Schäfer
836633c7b2
Fix/Refactor s390 support
This changes the s390 support on several stages:

1) On s390 the boot process is based on zipl which boots into an
   initrd from which a userspace grub process is started to support
   the grub capabilities. The implementation of this concept is
   provided via the grub2-s390x-emu package. Once installed the
   setup of the bootloader is done via the grub2-mkconfig and
   grub2-install commands and therefore from a caller perspective
   the same as with any other grub2 setup process. For kiwi this
   means no extra zipl bootloader target code is needed. Therefore
   this commit deletes the zipl setup from kiwi and puts on
   the standard grub2 process. This Fixes bsc#1170863

2) To support different targettypes the grub2-s390x-emu provided
   zipl template must be adapted. Parts of the former zipl bootloader
   setup therefore now applies to an update of the zipl2grub
   template file

3) Support for CDL/LDL DASD targets has been disabled in the schema
   When testing 4k devices and a respective zipl2grub template
   setup for CDL/LDL targettype it has turned out that grub2-install
   is not able to run on such a device. My assumption is that
   the device code in grub2-install does not work for 4k devices
   with an fdasd created partition table. As this needs further
   investigations and most probably adaptions on the grub toolchain
   for s390, we disabled the setup of these modes for now.
   emulated DASD (FBA) and SCSI targets stays supported.
2020-09-30 17:14:30 +02:00
Marcus Schäfer
3c940e5439
Merge pull request #1569 from OSInside/refactor_bootloaderconfig
Refactor BootLoaderConfig
2020-09-29 09:51:51 +02:00
David Cassany
2abcce803b
Refactor BootLoaderInstall
This commit refactors BootLoaderInstall class to make it a proper
factory class. In addition type hints are added for the constructor
method.

Related to #1498
2020-09-28 09:37:05 +02:00
David Cassany
c06a424258
Refactor BootLoaderConfig
This commit refactors BootLoaderConfig to turn it into a proper factory
class and to also include type hints to facilitate it's use from an API
POV.

Related to #1498
2020-09-28 09:35:17 +02:00
Marcus Schäfer
0b8abf1c7c
Refactor BootImage Factory
This commit refactors the BootImage factory to be a real
factory and to add type hints such that its use from an api
perspective is clear and enforced. Related to Issue #1498
2020-09-23 15:48:21 +02:00
Marcus Schäfer
8d2d9c214c
Make oem be a superset of vmx
A vmx image is the same disk as an oem just without the dracut
repart/resize feature. This difference is better handled with
an oemconfig parameter <oem-resize> which allows to switch resize
on or off. The extra image type vmx will be dropped and an XSLT
stylesheet automatically transforms a vmx description to be a
oem image with the resize feature switched off.
This Fixes #1425
2020-09-16 12:56:14 +02:00
Marcus Schäfer
0fee3bbb60
Refactor FileSystem Factory
With regards to Issue #1486 a discussion came up that the
way factories are implemented are questionable when thinking
about strong typing for the public kiwi interface. This
commit refactors the FileSystem factory to be a real factory
and to add type hints such that its use from an api perspective
is clear and enforced.
2020-06-29 22:38:31 +02:00
Marcus Schäfer
fe123fb267
Added new post disk sync script hook
Allow to put a disk.sh script as part of the image description
which is called for the disk image types `vmx` and `oem`
only and runs after the synchronisation of the root tree into the
disk image loop file. At call time of the script the device name
of the currently mapped root device is passed as a parameter.
The chroot environment for the call is the mounted disk itself
which makes this different from the config.sh/images.sh caller
environment. This Fixes #1464
2020-06-06 16:29:24 +02:00
Marcus Schäfer
94c7a7cdf6
Added new oem-resize-once element
The new element controls the behavior of the repart/resize code
in the oem-repart dracut module. By default the repart/resize
happens on every reboot and therefore also allows for disk
geometry changes during the livetime of the machine. If the
element is set to false the repart/resize operation happens
only once and then never again. To check for this condition
a new profile environment variable kiwi_rootpartuuid which
holds the PARTUUID of the root partition has been added to
the disk builder.
2020-03-27 10:37:42 +01:00
Marcus Schäfer
3b7f5be918
Complete refactoring of fstab handling
With the new Fstab class from prior pull request there is an
opportunity to handle all fstab related actions to be done
by that class. This commit extends the Fstab class with an
add_entry method such that we can avoid the extra lists
holding raw fstab lines in e.g the disk builder. In the end
all fstab related data is stored in an instance of the Fstab
class. This also extends the KIWI api by an fstab management
class. Related to #1329 and #1349
2020-03-18 16:01:13 +01:00
David Cassany
563f258586
Fix order in fstab
Any mount point directly under / should be just right after the root
mountpoint and before the custom mountpoints based on user's subvolume
configuration.

Fixes #1349 and bsc#1164310
2020-03-17 07:07:38 +01:00
David Cassany
e670b4a760
Make squashfs compression configurable
This commit adds the `squashfscompression` attribute in type element. It
can take `gzip`, `zstd`, `xz`, `lzo`, `lz4` or `none`. The default is `xz`.

Fixes #1315
2020-02-24 10:40:57 +01:00
Marcus Schäfer
1a3d0dadb3
Fixed order of fstab entries
If a volume manager is used the volumes are added before the
root filesystem(/) entry in fstab. This does not hurt because
at boot time systemd manages the mounting of the rootfs prior
to any other information in the fstab file but it's conceptually
broken. Users justifiably can expect the fstab entries in the
correct order such that mounting from top to bottom leads
to a consistent root filesystem state.
2020-01-17 15:10:54 +01:00
Marcus Schäfer
04b345e7aa
Added support for spare partition fs attributes
Added new type attribute:

```xml
<type ... spare_part_fs_attributes="..."/>
```

which can be a comma separated list of the following currently
supported filesystem attributes:

* no-copy-on-write
* synchronous-updates

See chattr and filesystem manual pages for details on those
attributes. More attributes for the spare part context can be
added on request. This Fixes #1233
2020-01-15 16:15:48 +01:00
Marcus Schäfer
ca75086128
Prevent swap partition to be the last one
In an OEM deployment that requested the creation of a swap
partition via <oem-swap> that swap partition was created
at first boot and was always the last partition on the disk.
This was required because it could not be placed before
any other partition without destroying those partition
contents. This process leaves the system in an inflexible
condition if the storage device can change its geometry
dynamicly as it's the case for SAN systems. The typical
deployment target for OEM images are SAN storage clusters
and it's cumbersome to resize the root partition if swap
is last.

This commit Fixes #1231 and changes the handling of swap if
requested via <oem-swap> as follows:

1. The swap space is created as part of the image build process
   and no longer on first boot of the image via dracut code.
   This increases the size of the non compressed .raw disk image
   by the configured swap space size or the default. The
   compressed versions are not affected since zero initialized
   swap space compresses to almost no space. Deployment of
   the image however also deploys the swap partition which
   increases deployment time. For big swap configurations
   it's advisable to switch off image verification via
   oem-skip-verify. For very big swap configurations it's
   also recommended to prevent kiwi from adding them as part
   of the image and let them be created on first boot via
   a systemd service that e.g places a swap file, or creates
   a swap volume when possible such that the fexibility to
   resize the rootfs is still available.

2. The setup of the swap space is now explicit. It's no longer
   calculated by twice times RAM size because on newer machines
   this could lead to huge numbers. Either the kiwi encoded
   default swap size applies or the user configured value.

3. LVM based oem disks creates the swap space as logical volume.
   The volume is created as part of the image build process
   and no longer on first boot. The swap volume at build time
   of the image is of a minimal size and gets resized on first
   boot.

4. The move of the swap creation into the builder code also
   handles swap per configured device persistency schema like
   any other devices. This means by default swap is mounted
   via by-uuid name and thus also Fixes #1259
2019-11-25 12:05:57 +01:00
Marcus Schäfer
726eeacee5
Fixed zipl bootloader setup for s390 images
The preparation to call zipl and the call itself were wrong.
For whatever reason the kernel image the initrd are moved
to another location prior to calling zipl. That move broke
the system because no kernel/initrd existed at the expected
place anymore. In addition the zipl call itself was issued
from a the wrong directory. Also no config file was written
as an after effect of the refactoring in Issue #1194. This
Fixes #1173 and bsc#1156694
2019-11-14 12:01:06 +01:00
David Cassany
4b3a105026
Re-structure unit tests folders
This commit relocates unit tests to a folder structure that matches
the source code structure.

Fixes #1128
2019-10-21 14:00:05 +02:00