Commit graph

3452 commits

Author SHA1 Message Date
He Yi
866d2aabe7 Update team_ssh_keys.txt 2022-02-22 21:55:56 +01:00
Gianluca Zuccarelli
8e8d99336f templates/worker: fix depsolve error rate
The depsolve error rate had the incorrect query
and was returning the error rate for the build
jobs. This has now been fixed.
2022-02-22 19:55:14 +00:00
Ondřej Budai
2263b821a7 worker/osbuild-koji: fix double-reporting of osbuild-koji job status
This was causing:

Feb 21 06:08:06 ip-10-30-18-43.us-east-1.aws.redhat.com osbuild-worker[20798]: time="2022-02-21T06:08:06Z" level=warning msg="Error reporting job result: error setting job status: 404 — Token not found (IMAGE-BUILDER-WORKER-5)"

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-02-22 19:27:17 +00:00
Ondřej Budai
0fa7c96549 Revert "mockbuild: temporarily pin RHEL 9 compose to an older one"
This reverts commit 10c0891fe0.
2022-02-22 19:26:42 +00:00
Xiaofeng Wang
8051ddced5 test: Remove "ansible-galaxy collection install"
Since "ANSIBLE_STDOUT_CALLBACK=yaml" has been removed from all
ostree test script, "ansible-galaxy collection install" should be
removed as well
2022-02-22 19:25:48 +00:00
Sanne Raymaekers
7133dc7943 Schutzfile: Pin centos-9's osbuild commit 2022-02-22 19:24:12 +00:00
Christian Kellner
34924c7af4 distro: use new GenImageKernelOptions in ostreeDeployPipeline
The new `GenImageKernelOptions` will retrun all needed kernel options
that are derived from the partition table. The only case - for now -
is if the partition table contains a LUKS decice, where the uuid of it
needs to be passed to the on the kernel command line so that it will
get unlocked.

Co-Authored-By: Achilleas Koutsou <achilleas@koutsou.net>
2022-02-22 19:23:41 +00:00
Christian Kellner
2c6e726c94 disk: add new GenImageKernelOptions helper
This creates the needed kernel options for an image, if any,
based on the partition table.

Co-Authored-By: Achilleas Koutsou <achilleas@koutsou.net>
2022-02-22 19:23:41 +00:00
Christian Kellner
54a4616a7d distro: remove unused sfdiskStageOptions
This was replaced by the previous switch to `GenImage*Stages`.

Co-Authored-By: Achilleas Koutsou <achilleas@koutsou.net>
2022-02-22 19:23:41 +00:00
Christian Kellner
4a8cf5e4c4 distro: switch liveImagePipelines to use GenImage*Stages
Use the new `GenImage{Prepare,Finish}Stages` in all liveImagePipelines
methods. This should allow us to handle partition tables with LUKS2 and
LVM2 transparently. Since none of the existing layouts contain any of
those, nothing should currently change.

Co-Authored-By: Achilleas Koutsou <achilleas@koutsou.net>
2022-02-22 19:23:41 +00:00
Christian Kellner
85e2a53606 osbuild2: add new GenImage{Prepare,Finish}Stages
Add new helper functions that will return the necessary stages to
prepare a disk image, i.e. take care of creating the raw image
file, partitioning it, creating the devices on it (LUKS2, LVM2),
and formatting all the file systems: `GenImageStagesPrepare`.
Additionally, some partition layouts require some post-processing,
e.g. LVM2 where the volume group needs to be renamed "offline".
For this the `GenImageFinishStages` was added.

Co-Authored-By: Achilleas Koutsou <achilleas@koutsou.net>
2022-02-22 19:23:41 +00:00
Christian Kellner
670b936e6b osbuild2: new GenDeviceFinishStages method
This should be called at the end of the pipeline that creates an
image, to add stages that are needed to finish up the image.
Currently the only stage that will be added is the `lvm2.metadata`
stage in the case the partition layout contains LVM2.

Co-Authored-By: Achilleas Koutsou <achilleas@koutsou.net>
2022-02-22 19:23:41 +00:00
Christian Kellner
3c6e34aeb3 osbuild2: LVM2Metadata: only validate CreationTime if not empty
It is ok to not pass the creation time to osbuild, i.e. it can be
empty. If so, don't validate it.

Co-Authored-By: Achilleas Koutsou <achilleas@koutsou.net>
2022-02-22 19:23:41 +00:00
Christian Kellner
2314ca37d7 osbuild2: NewLVM2MetadataStage takes map of devices
Instead of just passing in a single device, pass in a `Devices`
type, i.e. a map of devices, since the LVM can be located on a
LUKS2 container which is located inside a partition so multiple
devices are needed to access it.

Co-Authored-By: Achilleas Koutsou <achilleas@koutsou.net>
2022-02-22 19:23:41 +00:00
Christian Kellner
d48d6f22e1 osbuild2: GenCopyFSTreeOptions takes filename not device
The only thing we needed from the passed in device was the filename,
so just pass in that directly.

Co-Authored-By: Achilleas Koutsou <achilleas@koutsou.net>
2022-02-22 19:23:41 +00:00
Christian Kellner
a2e1fcc451 osbuild2: basic checks for GenDeviceCreationStages
Verify that we get the necessary "luks2.format" and "lvm2.create"
stages for a partition table that has LVM2 on top of LUKS2.

Co-Authored-By: Achilleas Koutsou <achilleas@koutsou.net>
2022-02-22 19:23:41 +00:00
Achilleas Koutsou
c347373c90 disk: basic partition table creation tests
Add a few test partition tables with well known configurations, like
LVM, LVM on top of LVM and Btrfs in addition to the plain layout that
is currently used in most partition tables. Add very basic checks,
such as that `NewPartitionTable` works and we have approximately the
correct size.

Co-Authored-By: Christian Kellner <christian@kellner.me>
2022-02-22 19:23:41 +00:00
Christian Kellner
d1b1e32b6e disk: Partition.Payload is now an Entity
Partition.Payload now supports every type of disk.Entity which enables
creating PartitionTables with LUKS, LVM, and Btrfs. \o/

Co-Authored-By: Achilleas Koutsou <achilleas@koutsou.net>
2022-02-22 19:23:41 +00:00
Christian Kellner
206e030f2c disk: guard against nil pointer dereferencing
Add guards protecting against dereferencing the pointer receiver of
method calls.

Co-Authored-By: Achilleas Koutsou <achilleas@koutsou.net>
2022-02-22 19:23:41 +00:00
Christian Kellner
beaf411628 disk: remove unused functions
Remove functions that got obsoleted by the more generic, entity based,
ones:
  - `FindPartitionForMountpoint`
  - `BootPartitionIndex`
  - `FindFilesystemForMountpoint`
  - `RootFilesystem`
  - `BootFilesystem`

Co-Authored-By: Achilleas Koutsou <achilleas@koutsou.net>
2022-02-22 19:23:41 +00:00
Christian Kellner
908b62ae08 disk: use entityPath in ContainsMountpoint
Implement `PartitionTable.ContainsMountpoint` via `entityPath` instead
of `FindFileSystemForMountpoint`; `entityPath` is the more generic
variant of `FindFileSystemForMountpoint` and will work with anything
that implements `Mountable`.

Co-Authored-By: Achilleas Koutsou <achilleas@koutsou.net>
2022-02-22 19:23:41 +00:00
Achilleas Koutsou
bd5b673a99 distro: use FindMountable() to get root filesystem
The `PartitionTable.FindMountable` method is the more generic version of
`PartitionTable.RootFilesystem` which returns a `Mountable` interface,
instead of a specific `Filesystem` object. This commit thus prepares for
the more generic case, like when root is a Btrfs sub-volume.

Co-Authored-By: Christian Kellner <christian@kellner.me>
2022-02-22 19:23:41 +00:00
Christian Kellner
b0899c5c59 disk: new interface UniqueEntity for Entities with UUID
This is for all entities that have a uniquely identifiable via a UUID.
Currently the interface only contains a single function, GenUUID(),
that should generate a new UUID via a random source (`rand.Rand`).
NB: Partitions are uniquely identifiable if and only if the layout is
GPT.

Co-Authored-By: Achilleas Koutsou <achilleas@koutsou.net>
2022-02-22 19:23:41 +00:00
Achilleas Koutsou
126c23cb13 disk: move constants to main disk.go file
Code cleanup and reorganisation:
Removed customizations.go file, moved all constants to disk.go, and
updated DefaultGrainBytes to it's actual value.
2022-02-22 19:23:41 +00:00
Achilleas Koutsou
d3b4349c63 disk: remove old unused CreatePartitionTable() function
The new `disk.NewPartitionTable` function is now used in all places
and thus `CreatePartitionTable` can be removed; do so.
2022-02-22 19:23:41 +00:00
Christian Kellner
a95d7de9d9 distro: replace CreatePartitionTable() with NewPartitionTable()
Replace the old CreateParittionTable() function with the new one called
NewPartitionTable() which works with the new interface types and
supports container-type setups (LUKS, LVM ,and Btrfs).

Changed usage in distro packages to take and carry around a pointer to
the new PartitionTable rather than a concrete type.  The
NewPartitionTable() function returns a deep clone of the base
PartitionTable so the new pointer type can be moved and (if necessary)
modified freely without affecting the distro base PT.

Co-Authored-By: Achilleas Koutsou <achilleas@koutsou.net>
2022-02-22 19:23:41 +00:00
Achilleas Koutsou
3312323db1 disk: implement VolumeContainer interface for PartitionTable
Co-Authored-By: Christian Kellner <christian@kellner.me>
2022-02-22 19:23:41 +00:00
Achilleas Koutsou
2b957a7de6 disk: new constructor for PartitionTable
Uses the new interfaces and supports all the different kinds of
filesystem configurations that we added.
Clones the base PartitionTable before modifying it.

Co-Authored-By: Christian Kellner <christian@kellner.me>
2022-02-22 19:23:41 +00:00
Achilleas Koutsou
6b3802739b osbuild2: deduplicate ziplInstStageOptions()
Use single NewZiplInstStageOptions() from osbuild2 instead of
implementing in each distro.
2022-02-22 19:23:41 +00:00
Achilleas Koutsou
890f380384 distro: replace BootPartition() with FindMountable("/boot")
RootParition() and BootPartition() methods have been removed.
2022-02-22 19:23:41 +00:00
Achilleas Koutsou
3f38602896 disk: new method for finding Mountable entities with a given mountpoint 2022-02-22 19:23:41 +00:00
Achilleas Koutsou
6fc993d03c disk: rename PartitionTable re-layouting method
Small localised change. Nice shorter name.
2022-02-22 19:23:41 +00:00
Christian Kellner
153f9b46fd osbuild2: deduplicate grub2StageOptions() and grub2InstStageOptions()
Use single NewGrub2StageOptions() and NewGrub2InstStageOptions()
functions from osbuild2 instead of implementing them in distros.

A small option flip is required outside the function for RHEL 8.5 and
RHEL 8.6 to maintain the old behaviour.

Co-Authored-By: Christian Kellner <christian@kellner.me>
2022-02-22 19:23:41 +00:00
Achilleas Koutsou
adfed6e0d7 disk: change updatePartitionStartPointOffsets() to use entityPath()
Eventually partition.Payload will be an Entity, so we need to use
more generic functions that work on the interfaces.

Co-Authored-By: Christian Kellner <christian@kellner.me>
2022-02-22 19:23:41 +00:00
Achilleas Koutsou
491020f9b8 disk: add entityPath() function
Starts from an Entity (typically the PartitionTable) and searches for a
target (Mountpoint), returning a slice of all the entities that lead to
the Mountable with the given Mountpoint (in reverse order).

Co-Authored-By: Christian Kellner <christian@kellner.me>
2022-02-22 19:23:41 +00:00
Christian Kellner
68cc50591f osbuild2: generator method to create device creation stages
Add a new method to create all necessary stages to create the
devices for a given `PartitionTable`.

Co-Authored-By: Achilleas Koutsou <achilleas@koutsou.net>
2022-02-22 19:23:41 +00:00
Christian Kellner
26c7be5311 disk: add basic check for ForEachEntity
Assure that we visit all the entities.

Co-Authored-By: Achilleas Koutsou <achilleas@koutsou.net>
2022-02-22 19:23:41 +00:00
Christian Kellner
cea96c43ac disk: new method on partition table to iterate over all entities
Add a new enumerator method to `PartitioTable` that allows the
caller to visit all entities inside a partition table.

Co-Authored-By: Achilleas Koutsou <achilleas@koutsou.net>
2022-02-22 19:23:41 +00:00
Christian Kellner
44b5142234 osbuild2: lvm2 create stage constructor takes device map
This is needed so we can have LVM be contained inside a LUKS
container, which is inside a partition; i.e. multiple devices
are needed to get to the target device.

Co-Authored-By: Achilleas Koutsou <achilleas@koutsou.net>
2022-02-22 19:23:41 +00:00
Achilleas Koutsou
602111dedd osbuild2: generalise copy stage option generation
Use entity based method `ForEachMountable` and `getDevices` to generate
all mounts and devices in a generic way, which then allows for mounts on
arbitrarily nested devices.

Update manifests and image info:
- New device names generated by `pathdot()` to avoid basename
  collisions.
- Some partitions are generated in a different order now which changes
  the order they appear in the manifest and their UUIDs.

Co-Authored-By: Christian Kellner <christian@kellner.me>
2022-02-22 19:23:41 +00:00
Achilleas Koutsou
16a975fe6f obsuild2: generalise mkfs stage device option generation
Refactor GenMkfsStages to work with entity based methods so that it is
now able to handle all generic cases of arbitrarily nested devices.

Co-Authored-By: Christian Kellner <christian@kellner.me>
2022-02-22 19:23:41 +00:00
Christian Kellner
8a73ab5980 osbuild2: fix LVM device constructor arguments
NewLVM2LVDevice should take `LVM2LVDeviceOptions`. Also add a parent
argument to be able to specify the parent device for the LVM2 device.

Co-Authored-By: Christian Kellner <christian@kellner.me>
2022-02-22 19:23:41 +00:00
Achilleas Koutsou
5de4276c9c osbuild2/device: add Parent field to Device
osbuild, starting with version 31, supports for nesting of devices,
i.e. any device can have a parent device. See osbuild commit 45d0594

Co-Authored-By: Christian Kellner <christian@kellner.me>
2022-02-22 19:23:41 +00:00
Achilleas Koutsou
b871a77f09 osbuild2: deduplicate copyFSTreeOptions() function
Use a single GenCopyFSTreeOptions() function from osbuild2 instead of
implementing it multiple times in distros.

Co-Authored-By: Christian Kellner <christian@kellner.me>
2022-02-22 19:23:41 +00:00
Achilleas Koutsou
86118960b9 osbuild2: deduplicate mkfsStages() function
Use a single GenMkfsStages() function from osbuild2 instead of
implementing it multiple times in distros.

Co-Authored-By: Christian Kellner <christian@kellner.me>
2022-02-22 19:23:41 +00:00
Achilleas Koutsou
3110ae4629 disk: move stage option generation functions to osbuild1,2
Co-Authored-By: Christian Kellner <christian@kellner.me>
2022-02-22 19:23:41 +00:00
Achilleas Koutsou
05a2f97549 disk: new PartitionTable method ForEachMountable()
Calls a given function on each Mountable in a PartitionTable.

Co-Authored-By: Christian Kellner <christian@kellner.me>
2022-02-22 19:23:41 +00:00
Achilleas Koutsou
46a0ad77f9 osbuild2: add LUKS2 format stage and device
Co-Authored-By: Christian Kellner <christian@kellner.me>
2022-02-22 19:23:41 +00:00
Achilleas Koutsou
54fd090a60 disk: rename Partition.Filesystem to Payload
A Partition can contain any type of Entity now.  Before we change the
type, rename the field to a more generic term.
2022-02-22 19:23:41 +00:00
Achilleas Koutsou
221cdedebc disk: Entity types must implement Clone()
All disk.Entitity types now implement Clone() which should return a
deep copy of the same object. Add the Clone() method to the entity
interface. The return type is Entity, but callers can assume it's
safe to convert back to the original type.

Co-Authored-By: Christian Kellner <christian@kellner.me>
2022-02-22 19:23:41 +00:00