Skip to content

Commit

Permalink
Livedisk with FCP changes (IBM#286)
Browse files Browse the repository at this point in the history
Enables to use the FCP live disk to boot the nodes.

---------

Signed-off-by: K Shiva Sai <[email protected]>
Co-authored-by: K Shiva Sai <[email protected]>
  • Loading branch information
k-shiva-sai and K Shiva Sai authored Jun 14, 2024
1 parent 1ba5bc1 commit 77aa104
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 8 deletions.
6 changes: 4 additions & 2 deletions docs/set-variables-host-vars.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@
## 7 - (Optional) Livedisk info
**Variable Name** | **Description** | **Example**
:--- | :--- | :---
**lpar.livedisk.livedisktype** | <b>(Optional)</b> Storage type. DASD is the only tested type as of now. | dasd
**lpar.livedisk.devicenr** | <b>(Optional)</b> the device no of the DASD live disk | c6h1
**lpar.livedisk.livedisktype** | <b>(Optional)</b> Storage type. DASD and SCSI are tested types as of now. | dasd/scsi
**lpar.livedisk.lun** | <b>(Required if livedisktype is scsi)</b> The Lunid of the disk when the livedisktype is SCSI. | 4003402b00000000
**lpar.livedisk.wwpn** | <b>(Required if livedisktype is scsi)</b> World-wide port number when livedisktype is SCSI. | 500507630a1b50a4
**lpar.livedisk.devicenr** | <b>(Optional)</b> the device no of the live disk | c6h1
**lpar.livedisk.livedisk_root_pass** | <b>(Optional)</b> root password for the livedisk | p@ssword
Original file line number Diff line number Diff line change
Expand Up @@ -91,5 +91,7 @@ lpar:
# Section 7 -live disk info
livedisk:
livedisktype: #X
lun: #X
wwpn: #X
devicenr: #X
livedisk_root_pass: #X
livedisk_root_pass: #X
Original file line number Diff line number Diff line change
Expand Up @@ -91,5 +91,7 @@ lpar:
# Section 7 -live disk info
livedisk:
livedisktype: #X
lun: #X
wwpn: #X
devicenr: #X
livedisk_root_pass: #X
livedisk_root_pass: #X
Original file line number Diff line number Diff line change
Expand Up @@ -91,5 +91,7 @@ lpar:
# Section 7 -live disk info
livedisk:
livedisktype: #X
lun: #X
wwpn: #X
devicenr: #X
livedisk_root_pass: #X
livedisk_root_pass: #X
13 changes: 13 additions & 0 deletions roles/boot_LPAR/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@
ipv6_string: "ip=[{{ node.networking.ipv6 }}]::[{{ node.networking.ipv6_gateway }}]:{{ node.networking.ipv6_prefix }}::{{ env.cluster.networking.interface }}:none"
when: env.use_ipv6 == true

- name: set live disk lun
set_fact:
live_disk_lun: "{{ node.lpar.livedisk.lun if (node.lpar.livedisk.lun is defined and node.lpar.livedisk.lun is not none) else 'na' }}"

- name: set live disk wwpn
set_fact:
live_disk_wwpn: "{{ node.lpar.livedisk.wwpn if (node.lpar.livedisk.wwpn is defined and node.lpar.livedisk.wwpn is not none) else 'na' }}"

- name: Debug
debug:
msg:
Expand All @@ -41,6 +49,8 @@
--initrd {{ rhcos_download_url }}{{ rhcos_live_initrd }} \
--livedisktype {{ node.lpar.livedisk.livedisktype }} \
--devicenr {{ node.lpar.livedisk.devicenr }} \
--livedisklun {{ live_disk_lun }} \
--livediskwwpn {{ live_disk_wwpn }} \
--netset_ip {{ node.networking.ip }} \
--netset_gateway {{ node.networking.gateway }} \
--netset_network_type osa \
Expand All @@ -64,6 +74,8 @@
--initrd {{ rhcos_download_url }}{{ rhcos_live_initrd }} \
--livedisktype {{ node.lpar.livedisk.livedisktype }} \
--devicenr {{ node.lpar.livedisk.devicenr }} \
--livedisklun {{ live_disk_lun }} \
--livediskwwpn {{ live_disk_wwpn }} \
--netset_ip {{ node.networking.ip }} \
--netset_gateway {{ node.networking.gateway }} \
--netset_network_type osa \
Expand All @@ -72,3 +84,4 @@
--netset_dns "{{ node.networking.nameserver1 }},{{ node.networking.nameserver2 }}" \
--log_level DEBUG \
--cmdline 'rd.neednet=1 console=ttysclp0 coreos.inst.install_dev=sda coreos.live.rootfs_url=http://{{ env.bastion.networking.ip }}:8080/bin/{{ rhcos_live_rootfs }} coreos.inst.ignition_url=http://{{ env.bastion.networking.ip }}:8080/ignition/{{ ignition }}.ign ip={{ node.networking.ip }}::{{ node.networking.gateway }}:{{ node.networking.subnetmask }}:{{ node.networking.hostname }}.{{ env.cluster.networking.metadata_name }}.{{ env.cluster.networking.base_domain }}:{{ node.networking.device1 }}:none nameserver={{ env.bastion.networking.ip }} cio_ignore=all,!condev zfcp.allow_lun_scan=0 rd.znet=qeth,{{ node.lpar.networking.nic.card1.dev_num }},layer2=1 {{ ipv6_string }} {{ rd_zfcp_string }}'
15 changes: 12 additions & 3 deletions roles/boot_LPAR/templates/boot_lpar.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ def list_of_strings(arg):
parser.add_argument("--netset_network_device", type=str, help="network device id")
parser.add_argument("--netset_password", type=str, help="live disk password")
parser.add_argument("--netset_dns", type=list_of_strings, help="comma seperated list of dns addresss in order")
parser.add_argument("--livedisklun", type=str, help="Lun id when the disk type is scsi and will be na when disktype is dasd")
parser.add_argument("--livediskwwpn", type=str, help="wwpn id of the scsi disk and will be na when disktype is dasd")

parser.add_argument("--log_level", type=str, help="can be of type INFO or DEBUG")
args = parser.parse_args()
Expand Down Expand Up @@ -59,7 +61,7 @@ def list_of_strings(arg):
lpar_memory = args.memory
lpar_parameters = {
"boot_params": {
"boot_method" : args.livedisktype,
"boot_method" : args.livedisktype.lower(),
"devicenr": args.devicenr,
'netsetup': {
"mac": None,
Expand All @@ -78,6 +80,13 @@ def list_of_strings(arg):
}
}
}

if args.livedisktype.lower()=="dasd" and args.livedisklun=="na" and args.livediskwwpn=="na":
pass
elif args.livedisktype.lower()=="scsi" and args.livedisklun!="na" and args.livediskwwpn!="na":
lpar_parameters["boot_params"]["lun"]=args.livedisklun
lpar_parameters["boot_params"]["wwpn"]=args.livediskwwpn
else:
raise Exception("Please check the live disk details")
hmc.start(lpar_name, lpar_cpu, lpar_memory, lpar_parameters)
hmc.logoff()
hmc.logoff()

0 comments on commit 77aa104

Please sign in to comment.