Ironic baremetal node Rescue/unrescue mode

Source: Internet
Author: User
Tags deprecated

Environment Ironic-api Ironic-conductor,ironicclient are upgraded to Queens version

Official Website Description API version is 1.38 to support rescue/unrescue, so modify the next OPENRC file

Export os_project_domain_name=defaultexport os_user_domain_name=defaultexport os_project_name= adminexport os_username=adminexport Os_password=admin_passexport os_auth_url=http:   172.18.211.69:10006/v3export os_identity_api_version=3export os_image_api_version =2export ironic_api_version=1.38
View Code

You should also update the properties with the current bare metal image, plus ramdisk_id and kernel_id

[Email protected] ~]# glance image-List+--------------------------------------+----------------------------+| ID | Name |+--------------------------------------+----------------------------+| D65ebb0b-450c-42b4-b820-8acbd4dc61f5 | bm_cents72 | | 0c0d1bf2-cf15-4754-b885-3df251c1206c | Deploy-kernel-q | | 356c2be5-9372-44A5-90FD-4250C829A3DC | Deploy-ramdisk-q |+--------------------------------------+----------------------------+[[Email protected]~] #glance image-update d65ebb0b-450c-42b4-b820-8acbd4dc61f5--ramdisk-ID=356c2be5-9372-44A5-90FD-4250C829A3DC--kernel-ID=0c0d1bf2-cf15-4754-b885-3df251c1206c+------------------+----------------------------------------------------------------------------------+| Property | Value |+------------------+-------------------- --------------------------------------------------------------+| Checksum | 0838e4a4cd54b4d9e59e4c60c8531baf | | Container_format | Bare | | Created_at |2018- to-07T11: -: 57Z | | Disk_format | Qcow2 | |ID| D65ebb0b-450c-42b4-b820-8acbd4dc61f5 | | Img_hv_type | BareMetal | | kernel_id | 0c0d1bf2-cf15-4754-b885-3df251c1206c | | Locations | [{"URL":"Swift+http://glance_username%3aswift:[email Protected]:7480/auth || | /1.0/glance/d65ebb0b-450c-42b4-b820-8acbd4dc61f5", "Metadata": {}}]              || Min_disk |0|| Min_ram |0|| name | bm_cents72 | | Owner | f216a10d409d4fbb812222691216527d | | protected | False | | ramdisk_id | 356c2be5-9372-44A5-90FD-4250C829A3DC | | Size |1160380416|| Status | active | | tags | ["Store:swift"]                                                                  || Updated_at |2018- to-29T01: -: 45Z | | Virtual_size | None | | Visibility | Public |+------------------+-------------------- --------------------------------------------------------------+
View Code

Need to modify the next ironic configuration file, add Resuce interface and Rescuing_network

[Default]default_network_interface = Neutronenabled_vendor_interfaces = Ipmitool,no-vendorenabled_storage_ interfaces = Cinder,noopenabled_raid_interfaces = Agent,no-raidenabled_power_interfaces = Ipmitoolenabled_network_ interfaces = Flat,noop,neutronenabled_management_interfaces = Ipmitoolenabled_inspect_interfaces = no-inspectenabled _deploy_interfaces = iscsi,directenabled_console_interfaces = No-consoleenabled_rescue_interfaces = Agentenabled_ boot_interfaces = Pxeenabled_hardware_types = Ipmienabled_drivers = Pxe_ipmitool,agent_ipmitool,pxe_ipmitool_socat, Agent_ipmitool_socat  [neutron]provisioning_network = 7d614f0e-c778-4781-937e-832ed78d103dcleaning_network = 7d614f0e-c778-4781-937e-832ed78d103drescuing_network = 7d614f0e-c778-4781-937e-832ed78d103d
ironic.conf

Update node's driver_info and driver

Ironic node-update b2e71756-750c-47b9-b08a-9ae577d1098a Add driver_info/rescue_kernel= 0C0D1BF2-CF15-4754-B885-3DF251C1206C driver_info/rescue_ramdisk=5bcf0917-429-42eb-b93b-3cdb50a8008e  Ironic Node-update b2e71756-750c-47b9-b08a-9ae577d1098a Replace Driver=ipmi
View Code

Official website releasenotes Instructions Queens IPA version Support rescue and Unrescue, but Ironicclient cannot be transferred rescue command, and the document is not updated

[Email protected] ~]# ironic node-set-provision-state bm172e18e211e24 unrescuethe "Ironic" CLI is deprecated and would be Removed in the s* release. Please use the "OpenStack baremetal" CLI instead.usage:ironic node-set-provision-state [--config-drive <config-drive [                                       --clean-steps <clean-steps>]                                       [--wait [wait_timeout]]                                       <node> <provision-state >ironic node-set-provision-state:error:argument <provision-state>: Invalid choice: ' Unrescue ' (choose from ') Deleted ', ' Provide ', ' clean ', ' manage ', ' active ', ' rebuild ', ' inspect ', ' abort ', ' adopt ')
View Code

Try using the API call

[Email protected] tftpboot]# curl-g-i-x PUT http://172.18.211.69:10032/v1/nodes/ B2e71756-750c-47b9-b08a-9ae577d1098a/states/provision-h "x-openstack-ironic-api-version:1.38"-H "User-Agent: Python-ironicclient "-H" content-type:application/json "-H" accept:application/json "-H" X-auth-token: Gaaaaabbb4eecki1zaieb5vsgoa0afz5zgi_zbogqn55hvvgxksv6ij2lk3iag3e7zxbfx4xrml1hjbqmlkg2j6yhwhx48o4ywh_ Weagae2jgqtw-bmskpfelpueh0jdkjef-irdwocgl503jf1kzw0d9mu6f3dclj4mqxsamc_yrmsziasp9sm "-D" {"Target": "Rescue", " Rescue_password ":" 1234qwer "} ' http/1.1 202 acceptedcontent-length:0x-openstack-ironic-api-minimum-version: 1.1x-openstack-ironic-api-maximum-version:1.38x-openstack-ironic-api-version:1.38location:http:// 172.18.211.69:10032/v1/nodes/b2e71756-750c-47b9-b08a-9ae577d1098a/statesopenstack-request-id: Req-ee486f13-d97b-4dfd-b394-905e518172c0date:fri, 2018 03:21:23 GMT
View Code

Return to 202 Accepted, now look at bare metal status

[[email protected] tftpboot]# ironic node-listthe "ironic" CLI is deprecated and would be removed in the s* release. Use the "OpenStack baremetal" CLI instead.+--------------------------------------+-----------------+--------- -----------------------------+-------------+--------------------+-------------+| UUID | Name | Instance UUID | Power State | Provisioning State | Maintenance |+--------------------------------------+-----------------+--------------------------------------+-- -----------+--------------------+-------------+| b2e71756-750c-47b9-b08a-9ae577d1098a | Bm172e18e211e24 | 876336B7-E7AE-4869-A242-8F9063947DFD | Power off | Rescuing | False |+--------------------------------------+-----------------+--------------------------------------+-------- -----+--------------------+-------------+[[email protected] tftpboot]# ironic node-listthe "ironic" CLI is Deprecated and would be removeD in the s* release. Use the "OpenStack baremetal" CLI instead.+--------------------------------------+-----------------+--------- -----------------------------+-------------+--------------------+-------------+| UUID | Name | Instance UUID | Power State | Provisioning State | Maintenance |+--------------------------------------+-----------------+--------------------------------------+-- -----------+--------------------+-------------+| b2e71756-750c-47b9-b08a-9ae577d1098a | Bm172e18e211e24 | 876336B7-E7AE-4869-A242-8F9063947DFD | Power On | Rescue | False |+--------------------------------------+-----------------+--------------------------------------+-------- -----+--------------------+-------------+
View Code

Description has entered the rescue mode, now landing under the IMPI console to see the bare metal status

Loading rescue image

Load complete, go to deploy RAMDisk

Ironic node SSH login system, LSBLK can view the original system disk, mount can chroot into the system, some repair operations, etc.

[[email protected] ironic]# ssh [Email protected]coreos stable (1068.10.0) Last Login:fri may 04:20:52 2018 F Rom 192.168.0.25Update strategy:no rebootsfailed units:1 update-engine-stub.timer[email protected] ~ $ sudo su-r  Ootupdate strategy:no rebootsfailed units:1 update-engine-stub.timerhost-192-168-1-110 ~ #lsblkNAME MAJ:MIN RM SIZE      RO TYPE mountpointsda 8:0 0 465.8G 0 disk '-sda1 8:1 0 465.8G 0 disksdb 8:16 0 465.8G 0 DISKSDC 8:32 0 465.8G 0 disksdd 8:48 0 465.8G 0 disksde 8:64 0 465.8G 0 disksdf 8:80 0 465.8G 0 disks  DG 8:96 0 465.8G 0 DISKSDH 8:112 0 465.8G 0 disksdi 8:128 0 465.8G 0 disksdj 8:144 0 465.8G 0 DISKSDK 8:160 0 465.8G 0 disksdl 8:176 0 465.8G 0 disksdm 8:192 0 465.8G 0 disksdn 8:208 0 465   .8G 0 disksdo 8:224 0 465.8G 0 DISKSDP 8:240 0 465.8G 0 disksdq 65:0 0 465.8G 0 DISKSDR 65:16    0 465.8G 0 Disksds 65:32 0 465.8G 0 DISKSDT 65:48 0 465.8G 0 disksdu 65:64 0 465.8G 0 disksdv 65:80 0 465.8G 0 disks  DW 65:96 0 465.8G 0 disksdx 65:112 0 465.8G 0 disksdy 65:128 0 465.8G 0 disksdz 65:144 0 465.8G 0 Diskloop0 7:0 0 225.8M 0 loop/usr host-192-168-1-110 ~ # mount/dev/sda1/mnthost-192-168-1-110 ~ # chroot/mnt[  [email protected]/]# lsbin boot Dev etc home lib lib64 media mnt opt proc root run sbin SRV sys tmp usr var[[email protected]/] #cat/etc/redhat-releasecentos Linux release 7.2.1511 (Core)
View Code

And according to the IPA code rescue.py, IPA will write the incoming Rescue_password encryption to the/etc/ipa-rescue-config/ipa-rescue-password file and close the API interface

host-192-168-1-110 ~ # cat/etc/ipa-rescue-config/ipa-rescue-passwordetaadfdldfo7k
View Code

At the same time IPA will run the finalize_rescue.sh script with the path under/usr/share/oem/

#!/bin/bash Create_rescue_user () {echo "Adding rescue user with root privileges ..." crypted_pass=$ (</etc/ipa-res Cue-config/ipa-rescue-password) sudo useradd-m rescue-g sudo-p $crypted _pass sudo echo "rescue all= (All) nopasswd : All ">/etc/sudoers.d/rescue} setup_dhcp_network () {dhcp_config_template=/usr/share/oem/ Rescue-dhcp-config.network echo "Configuring DHCP networks on all interfaces ..." echo "removing all existing networ    K-Configuration ... "sudo rm/etc/systemd/network/* echo" Configuring all interfaces except loopback to DHCP ... " For interface in $ (ls/sys/class/net); do if [$interface! = "Lo"]; Then sudo sed "s/rescue_network_interface/$interface/" $DHCP _config_template >/etc/systemd/network/50-$inte Rface.network | | True fi do sudo systemctl restart SYSTEMD-NETWORKD} echo "Attempting to start rescue mode configuration. ." if [-f/etc/ipa-rescue-config/ipa-rescue-password]; Then # NOTE (mariojv) An exit code of 0 are always forced here to avoid making IPA # restart after something fails.    IPA should not restart when the this script # executes to avoid exposing it API to a tenant network. Create_rescue_user | | Exit 0 Setup_dhcp_network | |  Exit 0 # TODO (MARIOJV) ADD support for configdrive and static networkselse echo "one or more of the files needed for Rescue mode does not exist, not rescuing. " Fi
finalize_rescue.sh

Assuming that you need to restore the bare metal state after the file system has been repaired, you can use the Unrescue command, which does not require rescue_password at this moment

[Email protected] ~]# curl-g-i-x PUT http://172.18.211.69:10032/v1/nodes/b2e71756-750c-47b9-b08a-9ae577d1098a/ States/provision-h "x-openstack-ironic-api-version:1.38"-H "user-agent:python-ironicclient"-H "Content-Type: Application/json "-H" accept:application/json "-H" x-auth-token:gaaaaabbb5iulr8qrcszunxewlsdhrrpk6vaz7jhwvk70_ lv6thwoztjathctszvljqikizvjnopbqhtppd_w7as-u5nem5net-y0qjei7rg8k8amaogzoqked5lc4trxx8e_124-fkafceqxhge8og8i__ Gzyaipyyc7fsfbmgmg9-btbt0xje "-d ' {" target ":" Unrescue "} ' http/1.1 202 acceptedcontent-length: 0x-openstack-ironic-api-minimum-version:1.1x-openstack-ironic-api-maximum-version: 1.38x-openstack-ironic-api-version:1.38location:http://172.18.211.69:10032/v1/nodes/ B2e71756-750c-47b9-b08a-9ae577d1098a/statesopenstack-request-id:req-8dbfb5c3-2440-4405-881a-5eef6841014edate: Fri, 2018 04:34:40 GMT
View Code

View bare metal status at this time, restored to active state

[[email protected] tftpboot]# ironic node-list+--------------------------------------+-----------------+---- ----------------------------------+-------------+--------------------+-------------+| UUID | Name | Instance UUID | Power State | Provisioning State | Maintenance |+--------------------------------------+-----------------+--------------------------------------+-- -----------+--------------------+-------------+| b2e71756-750c-47b9-b08a-9ae577d1098a | Bm172e18e211e24 | 876336B7-E7AE-4869-A242-8F9063947DFD | Power On | unrescuing | False |+--------------------------------------+-----------------+--------------------------------------+-------- -----+--------------------+-------------+ [[email protected] tftpboot]# ironic node-list+-------------------- ------------------+-----------------+--------------------------------------+-------------+--------------------+ -------------+|              Uuid                   | Name | Instance UUID | Power State | Provisioning State | Maintenance |+--------------------------------------+-----------------+--------------------------------------+-- -----------+--------------------+-------------+| b2e71756-750c-47b9-b08a-9ae577d1098a | Bm172e18e211e24 | 876336B7-E7AE-4869-A242-8F9063947DFD | Power On | active | False |+--------------------------------------+-----------------+--------------------------------------+-------- -----+--------------------+-------------+
View Code

Ironic baremetal node Rescue/unrescue mode

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.