-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enhancement: Support for zVM compute nodes to Hosted Control Plane - …
…vswitch FCP/DASD (#227) Enhancement: Support for zVM compute nodes to Hosted Control Plane - vswitch FCP/DASD - Code changes for supporting zVM for Hosted Control Plane - Supported network type : vswitch - Supported disk types: FCP/DASD - Updated the documentation for the same --------- Signed-off-by: root <[email protected]> Co-authored-by: root <[email protected]>
- Loading branch information
1 parent
3d66a58
commit b21d3c8
Showing
18 changed files
with
305 additions
and
40 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
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
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 @@ | ||
--- | ||
- 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 agent-{{ item }}" | ||
|
||
- name: Booting zvm node | ||
shell: | | ||
python /root/ansible_workdir/boot_nodes.py \ | ||
--zvmname "{{ hypershift.agents_parms.zvm_parameters.nodes[item].name }}" \ | ||
--zvmhost "{{ hypershift.agents_parms.zvm_parameters.nodes[item].host }}" \ | ||
--zvmuser "{{ hypershift.agents_parms.zvm_parameters.nodes[item].user }}" \ | ||
--zvmpass "{{ hypershift.agents_parms.zvm_parameters.nodes[item].password }}" \ | ||
--cpu "{{ hypershift.agents_parms.zvm_parameters.vcpus }}" \ | ||
--memory "{{ hypershift.agents_parms.zvm_parameters.memory }}" \ | ||
--kernel 'file:///var/lib/libvirt/images/pxeboot/kernel.img' \ | ||
--initrd 'file:///var/lib/libvirt/images/pxeboot/initrd.img' \ | ||
--cmdline "$(cat /root/ansible_workdir/agent-{{ item }}.parm)" | ||
- name: Attaching dasd disk | ||
shell: vmcp attach {{ hypershift.agents_parms.zvm_parameters.nodes[item].dasd.disk_id }} to {{ hypershift.agents_parms.zvm_parameters.nodes[item].name }} | ||
when: "{{ hypershift.agents_parms.zvm_parameters.disk_type | lower == 'dasd' }}" | ||
|
||
- name: Attaching fcp disks | ||
shell: vmcp attach {{ hypershift.agents_parms.zvm_parameters.nodes[item].lun[0].paths[0].fcp.split('.')[-1] }} to {{ hypershift.agents_parms.zvm_parameters.nodes[item].name }} | ||
when: "{{ hypershift.agents_parms.zvm_parameters.disk_type | lower == 'fcp' }}" | ||
|
||
- name: Wait for the agent to come up | ||
shell: oc get agents -n "{{ hypershift.hcp.clusters_namespace }}-{{ hypershift.hcp.hosted_cluster_name }}" --no-headers -o custom-columns=NAME:.metadata.name,APPROVED:.spec.approved | awk '$2 == "false"' | wc -l | ||
register: agent_count | ||
until: agent_count.stdout | int == 1 | ||
retries: 40 | ||
delay: 10 | ||
|
||
- name: Get the name of agent | ||
shell: oc get agents -n {{ hypershift.hcp.clusters_namespace }}-{{ hypershift.hcp.hosted_cluster_name }} --no-headers -o custom-columns=NAME:.metadata.name,APPROVED:.spec.approved | awk '$2 == "false"' | ||
register: agent_name | ||
|
||
- name: Approve agents | ||
shell: oc -n {{ hypershift.hcp.clusters_namespace }}-{{ hypershift.hcp.hosted_cluster_name }} patch agent {{ agent_name.stdout.split(' ')[0] }} -p '{"spec":{"approved":true,"hostname":"compute-{{item}}.{{ hypershift.hcp.hosted_cluster_name }}.{{ hypershift.hcp.basedomain }}","installerArgs":"[\"--append-karg\",\"rd.neednet=1\", \"--append-karg\", \"ip={{ hypershift.agents_parms.zvm_parameters.nodes[item].osa.ip }}::{{ hypershift.agents_parms.zvm_parameters.gateway }}:{{ hypershift.agents_parms.zvm_parameters.subnetmask }}:compute-{{ item }}.{{ hypershift.hcp.hosted_cluster_name }}.{{ hypershift.hcp.basedomain }}:{{ hypershift.agents_parms.zvm_parameters.nodes[item].osa.ifname }}:none\", \"--append-karg\", \"nameserver={{ hypershift.agents_parms.zvm_parameters.nameserver }}\", \"--append-karg\",\"rd.znet=qeth,{{ hypershift.agents_parms.zvm_parameters.nodes[item].osa.id }},layer2=1\",\"--append-karg\", {% if hypershift.agents_parms.zvm_parameters.disk_type | lower != 'fcp' %}\"rd.dasd=0.0.{{ hypershift.agents_parms.zvm_parameters.nodes[item].dasd.disk_id }}\"{% else %}\"rd.zfcp={{ hypershift.agents_parms.zvm_parameters.nodes[item].lun[0].paths[0].fcp}},{{ hypershift.agents_parms.zvm_parameters.nodes[item].lun[0].paths[0].wwpn }},{{ hypershift.agents_parms.zvm_parameters.nodes[item].lun[0].id }}\"{% endif %}]"}}' --type merge | ||
|
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,40 @@ | ||
#!/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='') | ||
|
||
args = parser.parse_args() | ||
|
||
parameters = { | ||
'transfer-buffer-size': 8000 | ||
} | ||
|
||
guest_parameters = { | ||
"boot_method": "network", | ||
"storage_volumes" : [], | ||
"ifaces" : [], | ||
"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
4 changes: 2 additions & 2 deletions
4
roles/create_inventory_setup_hypershift/templates/inventory_template.j2
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{% if hypershift.compute_node_type | lower != 'zvm' %} | ||
[kvm_host_hypershift] | ||
kvm_host_hypershift ansible_host={{ hypershift.kvm_host }} ansible_user={{ hypershift.kvm_host_user }} ansible_become_password={{ kvm_host_password }} | ||
|
||
|
||
|
||
{% endif %} | ||
[bastion_hypershift] | ||
bastion_hypershift ansible_host={{ hypershift.bastion_hypershift }} ansible_user={{ hypershift.bastion_hypershift_user }} |
Oops, something went wrong.