Modify the boot configuration of the migrated disk to make it compatible with Red Hat
OpenShift Virtualization.
Before you begin
Ensure that you have:
- The disk image that is uploaded to a PVC in OpenShift Virtualization
- A management VM running in OpenShift Virtualization
- Root access to the management VM
About this task
The boot configuration from z/VM includes z/VM-specific parameters that must be removed and replaced with KVM-compatible settings. This phase attaches the disk to a management VM, modifies the boot configuration, and prepares it for use as a bootable volume.
Procedure
-
Attach the disk to the management VM by running the following command:
virtctl addvolume management_vm_name \
--volume-name=pvc_name \
--bus=virtio \
--persist \
--namespace=namespace
-
Connect to the management VM.
Use SSH or the OpenShift Virtualization console to access the management VM.
-
Switch to the root user by running the following command:
-
Identify the attached disk device by running the following command:
Example output:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
vdc 252:32 0 58.9G 0 disk
├─vdc1 252:33 0 4.7G 0 part
└─vdc2 252:34 0 41.9G 0 part
In this example, the attached disk is /dev/vdc with two partitions: /dev/vdc1 (boot) and /dev/vdc2 (root).
-
Create a mount point for the migration by running the following command:
-
Mount the root file system by running the following command:
mount root_partition /mnt/zvm_migration
Example:
mount /dev/vdc2 /mnt/zvm_migration
-
Bind the mount system directories by running the following commands:
mount --bind /dev /mnt/zvm_migration/dev
mount --bind /proc /mnt/zvm_migration/proc
mount --bind /sys /mnt/zvm_migration/sys
-
Mount the boot file system by running the following command:
mount boot_partition /mnt/zvm_migration/boot
Example:
mount /dev/vdc1 /mnt/zvm_migration/boot
-
Enter the chroot environment by running the following command:
chroot /mnt/zvm_migration
-
Remove z/VM-specific boot parameters by running the following command:
sed -i 's/ rd\.zfcp=[^ ]*//g; s/ cio_ignore=[^ ]*//g; s/ rd\.znet=[^ ]*//g' /boot/loader/entries/*.conf
This command removes the following z/VM-specific parameters:
- rd.zfcp: FCP device configuration
- cio_ignore: Channel I/O ignore list
- rd.znet: Network device configuration
-
Get the kernel version by running the following command:
KERNEL_VERSION=$(uname -r)
-
Regenerate the initramfs by running the following command:
dracut -f --no-hostonly --kver "${KERNEL_VERSION}"
The --no-hostonly option ensures that the initramfs
includes all necessary drivers for the new environment.
-
Write the bootloader configuration by running the following command:
Expected output example:
Looking for components in '/lib/s390-tools'
Using config file '/etc/zipl.conf'
Using BLS config file '/boot/loader/entries/57ed29736ff244a59b5b1b8041d98aa0-5.14.0-611.5.1.el9_7.s390x.conf'
Using BLS config file '/boot/loader/entries/57ed29736ff244a59b5b1b8041d98aa0-0-rescue.conf'
Secure boot support: no
Target device information
Device..........................: fc:20
Partition.......................: fc:21
Device name.....................: vdc
Device driver name..............: virtblk
Type............................: disk partition
Disk layout.....................: SCSI disk layout
Building bootmap in '/boot'
Building menu 'zipl-automatic-menu'
Adding #1: IPL section '(5.14.0-611.5.1.el9_7.s390x)' (default)
kernel parmline...: 'root=UUID=2f168e2c-8b5c-4f7a-878e-959993079bae crashkernel=1G-2G:192M,2G-64G:256M,64G-:512M'
Syncing disks...
Done.
Verify that the output shows the device driver as virtblk and the disk layout as SCSI disk layout, confirming KVM compatibility.
-
Exit the chroot environment by running the following command:
-
Unmount all file systems by running the following commands:
ROOT_MOUNT=/mnt/zvm_migration
umount "${ROOT_MOUNT}/boot"
umount "${ROOT_MOUNT}/sys"
umount "${ROOT_MOUNT}/proc"
umount "${ROOT_MOUNT}/dev"
umount "${ROOT_MOUNT}"
-
Detach the volume from the management VM by running the following command:
virtctl removevolume management_vm_name --volume-name=pvc_name
-
Label the PVC as a bootable volume by running the following command:
oc label pvc pvc_name -n namespace \
template.kubevirt.io/architecture=s390x \
instancetype.kubevirt.io/default-instancetype=u1.small \
instancetype.kubevirt.io/default-instancetype-kind=VirtualMachineClusterInstancetype \
instancetype.kubevirt.io/default-preference=rhel.9.s390x \
instancetype.kubevirt.io/default-preference-kind=VirtualMachineClusterPreference \
--overwrite
Note: Add labels to identify the PVC as a bootable volume with appropriate architecture and
preferences.
-
Create a DataSource for the bootable volume.
- Create a YAML file for the DataSource resource:
apiVersion: cdi.kubevirt.io/v1beta1
kind: DataSource
metadata:
name: datasource_name
namespace: namespace
spec:
source:
pvc:
name: pvc_name
namespace: namespace
- Apply the YAML file by running the following command:
oc apply -f datasource-yaml-file
Results
The disk is now configured with KVM-compatible boot settings and is ready to be used as a bootable volume for a virtual machine in OpenShift Virtualization.