From 77aa104c416cc6ff68b35a9a249ad1f36903c9f9 Mon Sep 17 00:00:00 2001 From: k-shiva-sai <73527143+k-shiva-sai@users.noreply.github.com> Date: Fri, 14 Jun 2024 17:36:04 +0530 Subject: [PATCH] Livedisk with FCP changes (#286) Enables to use the FCP live disk to boot the nodes. --------- Signed-off-by: K Shiva Sai Co-authored-by: K Shiva Sai --- docs/set-variables-host-vars.md | 6 ++++-- .../host_vars/KVMhostname1-here.yaml.template | 4 +++- .../host_vars/KVMhostname2-here.yaml.template | 4 +++- .../host_vars/KVMhostname3-here.yaml.template | 4 +++- roles/boot_LPAR/tasks/main.yaml | 13 +++++++++++++ roles/boot_LPAR/templates/boot_lpar.py | 15 ++++++++++++--- 6 files changed, 38 insertions(+), 8 deletions(-) diff --git a/docs/set-variables-host-vars.md b/docs/set-variables-host-vars.md index 549e516a..4ddc7c00 100644 --- a/docs/set-variables-host-vars.md +++ b/docs/set-variables-host-vars.md @@ -92,6 +92,8 @@ ## 7 - (Optional) Livedisk info **Variable Name** | **Description** | **Example** :--- | :--- | :--- -**lpar.livedisk.livedisktype** | (Optional) Storage type. DASD is the only tested type as of now. | dasd -**lpar.livedisk.devicenr** | (Optional) the device no of the DASD live disk | c6h1 +**lpar.livedisk.livedisktype** | (Optional) Storage type. DASD and SCSI are tested types as of now. | dasd/scsi +**lpar.livedisk.lun** | (Required if livedisktype is scsi) The Lunid of the disk when the livedisktype is SCSI. | 4003402b00000000 +**lpar.livedisk.wwpn** | (Required if livedisktype is scsi) World-wide port number when livedisktype is SCSI. | 500507630a1b50a4 +**lpar.livedisk.devicenr** | (Optional) the device no of the live disk | c6h1 **lpar.livedisk.livedisk_root_pass** | (Optional) root password for the livedisk | p@ssword diff --git a/inventories/default/host_vars/KVMhostname1-here.yaml.template b/inventories/default/host_vars/KVMhostname1-here.yaml.template index b53a9cc5..096c9359 100644 --- a/inventories/default/host_vars/KVMhostname1-here.yaml.template +++ b/inventories/default/host_vars/KVMhostname1-here.yaml.template @@ -91,5 +91,7 @@ lpar: # Section 7 -live disk info livedisk: livedisktype: #X + lun: #X + wwpn: #X devicenr: #X - livedisk_root_pass: #X \ No newline at end of file + livedisk_root_pass: #X diff --git a/inventories/default/host_vars/KVMhostname2-here.yaml.template b/inventories/default/host_vars/KVMhostname2-here.yaml.template index 8a5dc9bf..f6aff163 100644 --- a/inventories/default/host_vars/KVMhostname2-here.yaml.template +++ b/inventories/default/host_vars/KVMhostname2-here.yaml.template @@ -91,5 +91,7 @@ lpar: # Section 7 -live disk info livedisk: livedisktype: #X + lun: #X + wwpn: #X devicenr: #X - livedisk_root_pass: #X \ No newline at end of file + livedisk_root_pass: #X diff --git a/inventories/default/host_vars/KVMhostname3-here.yaml.template b/inventories/default/host_vars/KVMhostname3-here.yaml.template index 432df5ac..3fc9d5d9 100644 --- a/inventories/default/host_vars/KVMhostname3-here.yaml.template +++ b/inventories/default/host_vars/KVMhostname3-here.yaml.template @@ -91,5 +91,7 @@ lpar: # Section 7 -live disk info livedisk: livedisktype: #X + lun: #X + wwpn: #X devicenr: #X - livedisk_root_pass: #X \ No newline at end of file + livedisk_root_pass: #X diff --git a/roles/boot_LPAR/tasks/main.yaml b/roles/boot_LPAR/tasks/main.yaml index b70489fe..e26bab7c 100644 --- a/roles/boot_LPAR/tasks/main.yaml +++ b/roles/boot_LPAR/tasks/main.yaml @@ -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: @@ -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 \ @@ -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 \ @@ -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 }}' + diff --git a/roles/boot_LPAR/templates/boot_lpar.py b/roles/boot_LPAR/templates/boot_lpar.py index 8550b4e3..b3ddbbc6 100644 --- a/roles/boot_LPAR/templates/boot_lpar.py +++ b/roles/boot_LPAR/templates/boot_lpar.py @@ -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() @@ -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, @@ -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() \ No newline at end of file +hmc.logoff() +