-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: ABI SNO & Compact Support For z/VM (#335)
Support has been added for ABI SNO and Compact type of OCP cluster installation on z/VM. --------- Signed-off-by: Sumit Solanki <[email protected]> Co-authored-by: Sumit Solanki <[email protected]>
- Loading branch information
1 parent
41f3a59
commit 47f1dca
Showing
12 changed files
with
217 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# For a comprehensive description of each variable, please see documentation here: | ||
# https://ibm.github.io/Ansible-OpenShift-Provisioning/set-variables-group-vars/ | ||
# ZVM Section | ||
|
||
zvm: | ||
network_mode: # Supported modes: vswitch | ||
disk_type: # Supported modes: fcp , dasd | ||
subnetmask: | ||
gateway: | ||
nameserver: | ||
vcpus: | ||
memory: | ||
|
||
nodes: | ||
- name: | ||
host: | ||
user: | ||
password: | ||
interface: | ||
ifname: encbdf0 | ||
nettype: qeth | ||
subchannels: 0.0.bdf0,0.0.bdf1,0.0.bdf2 | ||
options: layer2=1 | ||
ip: | ||
|
||
# Required if disk_type is dasd | ||
dasd: | ||
disk_id: | ||
|
||
# Required if disk_type is fcp | ||
lun: | ||
- id: | ||
paths: | ||
- wwpn: | ||
fcp: | ||
- wwpn: | ||
fcp: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--- | ||
- name: Creating agents | ||
block: | ||
- name: Getting script for booting | ||
template: | ||
src: ../templates/boot_nodes.py | ||
dest: /root/ansible_workdir/boot_nodes.py | ||
|
||
- name: Debug | ||
debug: | ||
msg: "Booting {{ env.cluster.networking.metadata_name }}-{{ item }}" | ||
|
||
- name: Booting zvm node | ||
shell: | | ||
python /root/ansible_workdir/boot_nodes.py \ | ||
--zvmname "{{ zvm.nodes[item].name }}" \ | ||
--zvmhost "{{ zvm.nodes[item].host }}" \ | ||
--zvmuser "{{ zvm.nodes[item].user }}" \ | ||
--zvmpass "{{ zvm.nodes[item].password }}" \ | ||
--cpu "{{ zvm.vcpus }}" \ | ||
--memory "{{ zvm.memory }}" \ | ||
--kernel 'file:///var/lib/libvirt/images/pxeboot/kernel.img' \ | ||
--initrd 'file:///var/lib/libvirt/images/pxeboot/initrd.img' \ | ||
--cmdline "$(cat /root/ansible_workdir/{{ env.cluster.networking.metadata_name }}-{{ item }}.param)" \ | ||
--network "{{ zvm.network_mode }}" | ||
- name: Attaching dasd disk | ||
shell: vmcp attach {{ zvm.nodes[item].dasd.disk_id }} to {{ zvm.nodes[item].name }} | ||
when: zvm.disk_type | lower == 'dasd' | ||
|
||
- name: Attaching fcp disks | ||
shell: vmcp attach {{ zvm.nodes[item].lun[0].paths[0].fcp.split('.')[-1] }} to {{ zvm.nodes[item].name }} | ||
when: zvm.disk_type | lower == 'fcp' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/usr/bin/env python3 | ||
from tessia.baselib.hypervisors.zvm.zvm import HypervisorZvm | ||
import argparse | ||
|
||
parser = argparse.ArgumentParser(description="Get the environment.") | ||
|
||
parser.add_argument("--zvmname", type=str, help="z/VM Hypervisor name", required=True) | ||
parser.add_argument("--zvmhost", type=str, help="z/VM Hostname or IP", required=True) | ||
parser.add_argument("--zvmuser", type=str, help="z/VM user", required=True) | ||
parser.add_argument("--zvmpass", type=str, help="z/VM user password", required=True) | ||
parser.add_argument("--cpu", type=int, help="number of Guest CPUs", required=True) | ||
parser.add_argument("--memory", type=int, help="Guest memory in MB", required=True) | ||
parser.add_argument("--kernel", type=str, help="kernel URI", required=True, default='') | ||
parser.add_argument("--cmdline", type=str, help="kernel cmdline", required=True, default='') | ||
parser.add_argument("--initrd", type=str, help="Initrd URI", required=True, default='') | ||
parser.add_argument("--network", type=str, help="Network mode for zvm nodes Supported modes: OSA, vswitch, RoCE , Hipersockets", required=True) | ||
|
||
args = parser.parse_args() | ||
|
||
parameters = { | ||
'transfer-buffer-size': 8000 | ||
} | ||
|
||
interfaces=[] | ||
if args.network.lower() == 'osa' or args.network.lower() == 'hipersockets': | ||
interfaces=[{ "type": "osa", "id": "{{ zvm.nodes[item].interface.subchannels.split(',') | map('regex_replace', '0.0.', '') | join(',') }}"}] | ||
elif args.network.lower() == 'roce': | ||
interfaces=[{ "type": "pci", "id": "{{ zvm.nodes[item].interface.ifname }}"}] | ||
|
||
guest_parameters = { | ||
"boot_method": "network", | ||
"storage_volumes" : [], | ||
"ifaces" : interfaces, | ||
"netboot": { | ||
"cmdline": args.cmdline, | ||
"kernel_uri": args.kernel, | ||
"initrd_uri": args.initrd, | ||
} | ||
} | ||
|
||
zvm = HypervisorZvm(args.zvmname,args.zvmhost, args.zvmuser, args.zvmpass, parameters) | ||
zvm.login() | ||
print("Logged in ") | ||
zvm.start(args.zvmuser, args.cpu, args.memory, guest_parameters) | ||
print("VM Started") | ||
zvm.logoff() | ||
print("Logged out") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -159,3 +159,4 @@ | |
ansible.builtin.service: | ||
name: NetworkManager | ||
state: restarted | ||
when: installation_type | lower != 'zvm' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
- name: Generate param files | ||
template: | ||
src: param-file.param.j2 | ||
dest: ~/{{ abi.ansible_workdir }}/{{ env.cluster.networking.metadata_name }}-{{ item }}.param | ||
with_sequence: start=0 end={{ (zvm.nodes | length) - 1 }} stride=1 | ||
loop_control: | ||
extended: yes | ||
index_var: item | ||
|
||
- name: Copy rootfs.img | ||
ansible.builtin.copy: | ||
src: "~/{{ abi.ansible_workdir }}/boot-artifacts/agent.{{ ansible_architecture }}-rootfs.img" | ||
dest: /var/www/html/rootfs.img | ||
remote_src: yes | ||
|
||
- name: Copy initrd.img | ||
ansible.builtin.copy: | ||
src: "~/{{ abi.ansible_workdir }}/boot-artifacts/agent.{{ ansible_architecture }}-initrd.img" | ||
dest: /var/lib/libvirt/images/pxeboot/initrd.img | ||
remote_src: yes | ||
|
||
- name: Copy kernel.img | ||
ansible.builtin.copy: | ||
src: "~/{{ abi.ansible_workdir }}/boot-artifacts/agent.{{ ansible_architecture }}-kernel.img" | ||
dest: /var/lib/libvirt/images/pxeboot/kernel.img | ||
remote_src: yes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
rd.neednet=1 ai.ip_cfg_override=1 console=ttysclp0 coreos.live.rootfs_url=http://{{ env.bastion.networking.ip }}:8080/agent.{{ ansible_architecture }}-rootfs.img ip={{ zvm.nodes[item].interface.ip }}::{{ zvm.gateway }}:{{ zvm.subnetmask }}{% if zvm.network_mode | lower != 'roce' %}::{{ zvm.nodes[item].interface.ifname }}:none{% endif %} nameserver={{ zvm.nameserver }} zfcp.allow_lun_scan=0 {% if zvm.network_mode | lower != 'roce' %}rd.znet={{ zvm.nodes[item].interface.nettype }},{{ zvm.nodes[item].interface.subchannels }},{{ zvm.nodes[item].interface.options }}{% endif %} {% if zvm.disk_type | lower != 'fcp' %}rd.dasd={{ zvm.nodes[item].dasd.disk_id }}{% else %}rd.zfcp={{ zvm.nodes[item].lun[0].paths[0].fcp}},{{ zvm.nodes[item].lun[0].paths[0].wwpn }},{{ zvm.nodes[item].lun[0].id }} {% endif %} random.trust_cpu=on rd.luks.options=discard ignition.firstboot ignition.platform.id=metal console=tty1 console=ttyS1,115200n8 coreos.inst.persistent-kargs="console=tty1 console=ttyS1,115200n8" |