首页 » OpenStack系统架构设计实战 » OpenStack系统架构设计实战全文在线阅读

《OpenStack系统架构设计实战》7.5.1 完全安装

关灯直达底部

安装Ironic之前,假定OpenStack其他组件已经部署完成。为了让Ironic正常运行,需要在OpenStack其他组件上做相应配置。

1.配置Keystone

为使用Keystone鉴权,需要在KeyStone里为Ironic创建一个用户,并赋予service租户和admin角色。

keystone user-create --name=ironic --pass=IRONIC_PASSWORD [email protected] comkeystone user-role-add --user=ironic --tenant=service --role=admin

创建Ironic服务,返回的serviceid在下一步中使用。

keystone service-create --name=ironic --type=baremetal /--description="Ironic bare metal provisioning service"

创建Ironic的endpoint,上一步创建服务时返回了一个serviceid,创建endpoint时需要用到这个值。另外,IRONIC_NODE可根据自己的情况替换,是ironic-api所在的地址。

keystone endpoint-create /--service-id=the_service_id_above /--publicurl=http://IRONIC_NODE:6385 /--internalurl=http://IRONIC_NODE:6385 /--adminurl=http://IRONIC_NODE:6385

2.创建数据库

Ironic使用单独的数据库来存储系统信息,这里以MySQL来举例说明。

在MySQL里面创建数据库Ironic,并且赋予Ironic用户访问权限,IRONIC_DBPASS-WORD用实际的密码替换。

# mysql -u root -pmysql> CREATE DATABASE ironic CHARACTER SET utf8;mysql> GRANT ALL PRIVILEGES ON ironic.* TO 'ironic'@'localhost' /IDENTIFIED BY 'IRONIC_DBPASSWORD';mysql> GRANT ALL PRIVILEGES ON ironic.* TO 'ironic'@'%' /IDENTIFIED BY 'IRONIC_DBPASSWORD';

3.安装Ironic服务

直接从Ubuntu源进行安装。

Ubuntu 14.04 (trusty) or higher: apt-get install ironic-api ironic-conductor python-ironicclient

4.参数配置

Ironic和OpenStack其他组件一样,通过配置文件进行配置。通过Ubuntu源安装的Ironic配置文件通常是/etc/ironic/ironic.conf。

1)配置数据库连接,IRONIC_DBPASSWORD和DB_IP根据具体情况替换。

[database]...# The SQLAlchemy connection string used to connect to the# database (string value)#connection=<None>connection = mysql://ironic:[email protected]_IP/ironic?charset=utf8

2)配置消息队列服务,RABBIT_HOST用实际地址替换。

[DEFAULT]...# The RabbitMQ broker address where a single node is used# (string value)rabbit_host=RABBIT_HOST# The RabbitMQ userid (string value)#rabbit_userid=guest# The RabbitMQ password (string value)#rabbit_password=guest# The RabbitMQ virtual host (string value)#rabbit_virtual_host=/

3)配置Keystone部分参数,使得Ironic可以使用KeyStone鉴权。注意,IDENTITY_IP用Keystone的IP替代,用户名(ironic)和密码(IRONIC_PASSWORD)也要根据Ironic在Keystone注册时的用户名和密码替换。

[DEFAULT]...# Method to use for authentication: noauth or keystone.# (string value)auth_strategy=keystone...[keystone_authtoken]# Host providing the admin Identity API endpoint (string# value)#auth_host=127.0.0.1auth_host=IDENTITY_IP# Port of the admin Identity API endpoint (integer value)#auth_port=35357# Protocol of the admin Identity API endpoint(http or https)# (string value)#auth_protocol=https# Complete public Identity API endpoint (string value)#auth_uri=<None>auth_uri=http://IDENTITY_IP:5000/# Keystone account username (string value)#admin_user=<None>admin_user=ironic# Keystone account password (string value)#admin_password=<None>admin_password=IRONIC_PASSWORD# Keystone service account tenant name to validate user tokens# (string value)#admin_tenant_name=adminadmin_tenant_name=service# Directory used to cache files related to PKI tokens (string# value)#signing_dir=<None>

4)配置Neutron的endpoint,NEUTRON_IP用Neutron的实际地址替换。

[neutron]# URL for connecting to neutron. (string value)#url=http://127.0.0.1:9696url=http://NEUTRON_IP:9696

5)配置Glance,Ironic会从Glance下载image,GLANCE_IP用Glance的实际地址替换。

[glance]# A list of URL schemes that can be downloaded directly via# the direct_url. Currently supported schemes: [file]. (list# value)#allowed_direct_url_schemes=# Default glance hostname or IP address. (string value)#glance_host=$my_ipglance_host=GLANCE_IP# Default glance port. (integer value)#glance_port=9292# Default protocol to use when connecting to glance. Set to# https for SSL. (string value)#glance_protocol=http# A list of the glance api servers available to nova. Prefix# with https:// for SSL-based glance API servers. Format is# [hostname|IP]:port. (string value)#glance_api_servers=<None>

6)创建Ironic使用的数据库表。

ironic-dbsync --config-file /etc/ironic/ironic.conf create_schema

7)重启Ironic服务。

service ironic-api restartservice ironic-conductor restart

以上完成Ironic的基本配置,为了支持Ironic,OpenStack的Nova、Neutron、Glance等组件,也需要做相应配置。

5.配置Nova以启用Ironic

Nova需要配置Ironic提供的驱动器以支持Ironic,Nova的配置文件是/etc/nova/nova.conf,这个文件在控制节点和计算节点上要同步修改。

1)配置default段,如下:

[default]# Driver to use for controlling virtualization. Options# include: libvirt.LibvirtDriver, xenapi.XenAPIDriver,# fake.FakeDriver, baremetal.BareMetalDriver,# vmwareapi.VMwareESXDriver, vmwareapi.VMwareVCDriver (string# value)#compute_driver=<None>compute_driver=nova.virt.ironic.IronicDriver# Firewall driver (defaults to hypervisor specific iptables# driver) (string value)#firewall_driver=<None>firewall_driver=nova.virt.firewall.NoopFirewallDriver# The scheduler host manager class to use (string value)#scheduler_host_manager=nova.scheduler.host_manager.HostManagerscheduler_host_manager=nova.scheduler.ironic_host_manager.IronicHostManager# Virtual ram to physical ram allocation ratio which affects# all ram filters. This configuration specifies a global ratio# for RamFilter. For AggregateRamFilter, it will fall back to# this configuration value if no per-aggregate setting found.# (floating point value)#ram_allocation_ratio=1.5ram_allocation_ratio=1.0# Amount of disk in MB to reserve for the host (integer value)#reserved_host_disk_mb=0reserved_host_memory_mb=0# Full class name for the Manager for compute (string value)#compute_manager=nova.compute.manager.ComputeManagercompute_manager=ironic.nova.compute.manager.ClusteredComputeManager# Flag to decide whether to use baremetal_scheduler_default_filters or not.# (boolean value)#scheduler_use_baremetal_filters=Falsescheduler_use_baremetal_filters=True

2)配置Ironic段内容,IRONIC_PASSWORD是Ironic在Keystone注册的用户名,IDENTITY_IP是Keystone的IP,IRONIC_NODE是Ironic API的IP。

[ironic]# Ironic keystone admin nameadmin_username=ironic#Ironic keystone admin password.admin_password=IRONIC_PASSWORD# keystone API endpointadmin_url=http://IDENTITY_IP:35357/v2.0# Ironic keystone tenant name.admin_tenant_name=service# URL for Ironic API endpoint.api_endpoint=http://IRONIC_NODE:6385/v1

3)在Nova控制节点上重启nova-scheduler服务。

service nova-scheduler restart

4)在计算节点上重启nova-compute服务。

service nova-compute restart

6.配置Neutron以支持Ironic

Ironic需要的DHCP、PXE boot等功能,在OpenStack中由Neutron组件提供。本节以创建的一个Flat网络为例,来讲述Neutron的配置步骤。

1)编辑/etc/neutron/plugins/ml2/ml2_conf.ini,按照如下设置:

[ml2]type_drivers = flattenant_network_types = flatmechanism_drivers = openvswitch[ml2_type_flat]flat_networks = physnet1[ml2_type_vlan]network_vlan_ranges = physnet1[securitygroup]firewall_driver = neutron.agent.linux.iptables_firewall.OVSHybridIptables-FirewallDriverenable_security_group = True[ovs]bridge_mappings = physnet1:br-eth2# Replace eth1-with the interface on the neutron node which you# are using to connect to the bare metal server

2)如果neutron-openvswitch-agent是以ovs_neutron_plugin.ini作为配置文件,则编辑这个文件,修改其中的bridge_mappings。

[ovs]bridge_mappings = physnet1:br-eth2# Replace eth1-with the interface on the neutron node which you# are using to connect to the bare metal server

3)重启neutron-openvswitch-agent。

Service neutron-openvswitch-agent restart

4)创建br-int虚拟交换机。

ovs-vsctl add-br br-int

5)创建br-eth2虚拟交换机,处理与Ironic之间的通信,挂接eth2接口到br-eth2。注意,eth2是和Ironic通信的物理网口,根据自己的实际情况修改。

ovs-vsctl add-br br-eth2ovs-vsctl add-port br-eth1-eth2

6)重启Open vSwitch Agent。

service neutron-plugin-openvswitch-agent restart

Agent重启后,连接虚拟交换机br-eth2和br-int之间的veth pair会被自动创建。Open vSwitch配置如下:

ovs-vsctl show Bridge br-intfail_mode: securePort "int-br-eth2" Interface "int-br-eth2"type: patchoptions: {peer="phy-br-eth2"}Port br-int Interface br-inttype: internal Bridge "br-eth2"Port "phy-br-eth2" Interface "phy-br-eth2"type: patchoptions: {peer="int-br-eth2"}Port "eth2" Interface "eth2"Port "br-eth2" Interface "br-eth2"type: internal ovs_version: "2.3.0"

7)为Ironic的实例创建网络。

neutron net-create --tenant-id $TENANT_ID sharednet1 --shared /--provider:network_type flat --provider:physical_network physnet1

8)创建子网。

neutron subnet-create sharednet1 $NETWORK_CIDR --name $SUBNET_NAME /--ip-version=4 --gateway=$GATEWAY_IP --allocation-pool /start=$START_IP,end=$END_IP --enable-dhcp

7.镜像准备

在使用Ironic部署裸机系统时,需要两种镜像,一种是user镜像,这个镜像最终要安装到服务器上,包含能引导硬件正常启动的操作系统;另一种是deploy镜像,起辅助作用,内置了一堆Ironic的脚本。通过deploy镜像的辅助,最终将user镜像写入裸机的磁盘上,实现裸机按需自动化部署。

deploy镜像和user镜像的制作,都需要用到社区提供的脚本软件disk-image-builder。下面讲述deploy镜像和user镜像的制作过程。制作镜像之前,先要根据裸机的硬件类型安装好目标机器的操作系统。再在这一已安装并能正常运行的操作系统上,为这一特定的裸机硬件类型制作镜像。我们知道给裸机安装系统本质上就是一种ghost,必须预先在相同硬件类型的系统上制作母版。

1)安装disk-image-builder。

sudo pip install diskimage-builder

2)制作user镜像,以Ubuntu为例。

disk-image-create ubuntu baremetal dhcp-all-interfaces -o my-image

这一步将会创建3个文件,my-image.qcow2、my-image.vmlinuz和my-image.initrd。

3)制作deploy镜像。

ramdisk-image-create ubuntu deploy-ironic -o my-deploy-ramdisk

这一步将会创建my-deploy-ramdisk.kernel和my-deploy-ramdisk.initramfs两个文件。

8.将user镜像上传到Glance

将上一步创建的两个镜像分别上传到Glance。

1)上传kernel。

glance image-create --name my-kernel --is-public True /--disk-format aki < my-image.vmlinuz

将返回的UUID保存到变量$MY_VMLINUZ_UUID中。

2)上传ramdisk。

glance image-create --name my-image.initrd --is-public True /--disk-format ari < my-image.initrd

将返回的UUID保存到变量$MY_INITRD_UUID中。

3)上传硬盘镜像文件,并且关联到kernel和ramdisk。

glance image-create --name my-image --is-public True /--disk-format qcow1---container-format bare --property /kernel_id=$MY_VMLINUZ_UUID --property /ramdisk_id=$MY_INITRD_UUID < my-image.qcow2

如此user镜像上传完毕。

下面上传deploy镜像。

1)上传kernel。

glance image-create --name deploy-vmlinuz --is-public True /--disk-format aki < my-deploy-ramdisk.kernel

将返回的UUID保存到变量$DEPLOY_VMLINUZ_UUID中。

2)上传ramdisk。

glance image-create --name deploy-initrd --is-public True /--disk-format ari < my-deploy-ramdisk.initramfs

将返回的UUID保存到变量$DEPLOY_INITRD_UUID。

$DEPLOY_VMLINUZ_UUID和$DEPLOY_INITRD_UUID在创建Nova Flavor时会用到。

9.创建Flavor

Nova需要为Ironic创建单独的Flavor,这是正确调度到物理机的前提条件。如果Ironic管理了多种硬件型号的裸机,也需要为每一种型号的裸机创建单独的Flavor。

1)设置与物理机器匹配的环境变量。

RAM_MB=1024CPU=2DISK_GB=100ARCH={i686|x86_64}

2)创建裸机Flavor。

nova flavor-create my-baremetal-flavor auto $RAM_MB $DISK_GB $CPU

3)关联到deploy镜像。

在I版本、J版本、K版本中由于版本变化,操作命令有所差异。

I版本对应的命令如下:

nova flavor-key my-baremetal-flavor set /cpu_arch=$ARCH /"baremetal:deploy_kernel_id"=$DEPLOY_VMLINUZ_UUID /"baremetal:deploy_ramdisk_id"=$DEPLOY_INITRD_UUID

从J版本开始,需要为每一个裸机设置deploy镜像。

nova flavor-key my-baremetal-flavor set cpu_arch=$ARCH

将deploy镜像关联到每个裸机的driver_info。

ironic node-update $NODE_UUID add /driver_info/pxe_deploy_kernel=$DEPLOY_VMLINUZ_UUID /driver_info/pxe_deploy_ramdisk=$DEPLOY_INITRD_UUID

K版本对应的命令如下:

nova flavor-key my-baremetal-flavor set cpu_arch=$ARCH

将deploy镜像关联到每个裸机的driver_info。

ironic node-update $NODE_UUID add /driver_info/deploy_kernel=$DEPLOY_VMLINUZ_UUID /driver_info/deploy_ramdisk=$DEPLOY_INITRD_UUID

10.配置Ironic driver

(1)配置PXE

PXE是Ironic将deploy镜像部署到裸机上的典型技术方案,这里讲述如何在Ironic中配置PXE。PXE需要和ironic-conductor组件部署在同一台服务器上。

1)创建tftp目录,确保运行ironic-conductor的用户有读写权限。

sudo mkdir -p /tftpbootsudo chown -R ironic /tftpboot

2)安装tftp server和syslinux包。

Ubuntu: (Up to and including 14.04) sudo apt-get install tftpd-hpa syslinux-common syslinuxUbuntu: (14.10 and after) sudo apt-get install tftpd-hpa syslinux-common pxelinux

3)设置tftp服务器的目录为/tftpboot,修改/etc/default/tftpd-hpa。

TFTP_DIRECTORY="/tftpboot"#这里是用户的tftpd-hpa的服务目录,建立在哪里都行

4)复制PXE镜像到/tftpboot。

Ubuntu (Up to and including 14.04): sudo cp /usr/lib/syslinux/pxelinux.0 /tftpbootUbuntu (14.10 and after): sudo cp /usr/lib/PXELINUX/pxelinux.0 /tftpboot

5)如果syslinux版本大于4,需要将syslinux的模块库复制到/tftpboot。

Ubuntu: sudo cp /usr/lib/syslinux/modules/*/ldlinux.* /tftpboot

6)在/tftpboot目录里创建map文件。

echo 'r ^([^/]) /tftpboot//1' > /tftpboot/map-fileecho 'r ^(/tftpboot/) /tftpboot//2' >> /tftpboot/map-file

7)让map文件生效,按照下面内容修改/etc/xinetd.d/tftp,并且重启xinetd服务。

server_args = -v -v -v -v -v --map-file /tftpboot/map-file /tftpbootservice xinetd restart

(2)iPXE安装

iPXE是PXE的一个替代,在J版本中引入。如果觉得PXE配置麻烦,那么iPXE是个很好的选择。iPXE也需要和ironic-conducotr部署在同一台机器上。

1)创建TFTP目录,确保运行ironic-conductor的用户有读写权限。

sudo mkdir -p /tftpbootsudo chown -R ironic /tftpboot

2)在/tftpboot目录里创建map文件。

echo 'r ^([^/]) /tftpboot//1' > /tftpboot/map-fileecho 'r ^(/tftpboot/) /tftpboot//2' >> /tftpboot/map-file

3)安装TFTP服务器和HTTP服务器。

sudo apt-get install tftpd-hpa apache2

4)将TFTP服务器的目录设置为/tftpboot,修改/etc/default/tftpd-hpa。

TFTP_DIRECTORY="/tftpboot"#这里是用户的tftpd-hpa的服务目录,建立在哪里都行

5)修改/etc/ironic/ironic.conf,配置TFTP和HTTP参数,以及HTTP服务地址。

[pxe]# Ironic compute node's tftp root path. (string value)tftp_root=/tftpboot# IP address of Ironic compute node's tftp server. (string# value)tftp_server=192.168.0.2[deploy]# Ironic compute node's http root path. (string value)http_root=/var/www# Ironic compute node's HTTP server URL. Example:# http://192.1.2.3:8080 (string value)http_url=http://192.168.0.2

6)安装iPXE软件包。

Ubuntu: apt-get install ipxe

7)复制iPXE启动镜像到/tftpboot目录。

Ubuntu: cp /usr/lib/ipxe/undionly.kpxe /tftpboot

8)修改/etc/ironic/ironic.conf,配置Ironic使用iPXE。

[pxe]# Enable iPXE boot. (boolean value)ipxe_enabled=True# Neutron bootfile DHCP parameter. (string value)pxe_bootfile_name=undionly.kpxe# Template file for PXE configuration. (string value)pxe_config_template=$pybasedir/drivers/modules/ipxe_config.template

9)重启ironic-conductor服务。

service ironic-conductor restart

(3)配置Neutron

iPXE需要依赖Neutron配置ipxe标签,步骤如下:

1)配置dnsmasq配置文件,默认是/etc/dnsmasq.conf,配置内容如下:

# Create the "ipxe" tag if request comes from iPXE user classdhcp-userclass=set:ipxe,iPXE# Alternatively, create the "ipxe" tag if request comes from DHCP option 175# dhcp-match=set:ipxe,175

2)在Neutron DHCP Agent配置文件里面(/etc/neutron/dhcp_agent.ini),配置dnsmasq配置文件。

[DEFAULT]dnsmasq_config_file = /etc/dnsmasq.conf

3)重启neutron-dhcp-agent进程。

service neutron-dhcp-agent restart

11.IPMI配置

Ironic通常通过IPMI对服务器进行上下电控制,以及启动引导设置,根据服务器类型的不同,也可能是使用iLO(HP的服务器采用)或者其他技术。这里只对IPMI进行讨论。需要确保在ironic-conductor服务器上安装了IPMI软件包,以便Ironic可以通过IPMI来控制远程裸机的启停。

apt-get -y install ipmitool

安装成功IPMI软件包后,测试一下能否正常使用。

ipmitool -I lanplus -H <ip-address> -U <username> -P <password> chassis power status

ip-address是远程的主机的IPMI地址。如果出错,检查一下裸机上是否正确设置了IPMI参数,以及服务器上的IPMI软件包安装是否正常。

12.注册

Ironic服务配置好后,接下来最重要的事情是向Ironic登记注册裸机,只有注册过户的裸机,才能被Ironic统一管理。

1)创建node,必须指定驱动器。本例以最常见的pxe_ipmitool为例。

ironic node-create -d pxe_ipmitool+--------------+--------------------------------------+| Property | Value|+--------------+--------------------------------------+| uuid | dfc6189f-ad83-4261-9bda-b27258eb1987 || driver_info | {} || extra| {} || driver | pxe_ipmitool || chassis_uuid ||| properties | {} || name | None |

2)配置驱动器所需的详细信息,可以先用driver-properties命令来查看一下指定的驱动器需要配置哪些字段。

ironic driver-properties pxe_ipmitool+----------------------+-----------------------------------------------------+| Property | Description ||+----------------------+-----------------------------------------------------+| ipmi_address | IP address or hostname of the node. Required. || ipmi_password| password. Optional. || ipmi_username| username; default is NULL user. Optional. || ... | ... || deploy_kernel| UUID (from Glance) of the deployment kernel. Required.|| deploy_ramdisk | UUID (from Glance) of the ramdisk that is mounted at | boot time. Required.|+----------------------+-----------------------------------------------------+ironic node-update $NODE_UUID add /driver_info/ipmi_username=$USER /driver_info/ipmi_password=$PASS /driver_info/ipmi_address=$ADDRESS

3)更新node的属性,以匹配之前在Nova里为该node硬件类型所创建的Flavor。

ironic node-update $NODE_UUID add /properties/cpus=$CPU /properties/memory_mb=$RAM_MB /properties/local_gb=$DISK_GB /properties/cpu_arch=$ARCH

4)如果是K版本,需要为驱动器指定deploy镜像的kernel和ramdisk。

ironic node-update $NODE_UUID add /driver_info/deploy_kernel=$DEPLOY_VMLINUZ_UUID /driver_info/deploy_ramdisk=$DEPLOY_INITRD_UUID /

5)登记裸机的网卡MAC地址。

ironic port-create -n $NODE_UUID -a $MAC_ADDRESS

6)使用validate命令验证注册是否正确。

ironic node-validate $NODE_UUID+------------+--------+--------+| Interface | Result | Reason |+------------+--------+--------+| console | True ||| deploy | True ||| management | True ||| power| True ||

如果验证不通过,会提示缺少哪些信息。

ironic node-validate $NODE_UUID+------------+--------+------------------------------------------------------+| Interface | Result | Reason|+------------+--------+------------------------------------------------------+| console | None | not supported|| deploy | False | Cannot validate iSCSI deploy. Some parameters were missingin node's instance_info. Missing are: ['root_gb', 'image_source'] || management | False | Missing the following IPMI credentials in node's driver_info: ['ipmi_address'].|| power| False | Missing the following IPMI credentials in node's driver_info: ['ipmi_address'].|+------------+--------+------------------------------------------------------+

在配置好各项服务,完成裸机向Ironic注册后,Nova即可自动侦测到裸机节点,并作为可用资源供调度器进行调度。可以通过如下命令分别在Ironic和Nova里检查一下裸机节点是否可用。如果在Nova里面能够查看到,就说明成功了。

$ ironic node-list+-----------------+--------------+------------+------------------+-----------+| UUID | Instance UUID | Power State | Provisioning State | Maintenance |+-----------------+--------------+------------+------------------+-----------+| 86a2b1bb-8b29-4964-a817-f90031debddb | None | power off | None|False|+-----------------+--------------+------------+------------------+-----------+$ ironic node-show 86a2b1bb-8b29-4964-a817-f90031debddb+-----------------+--------------+------------+------------------+-----------+| Property| Value |+-----------------+--------------+------------+------------------+-----------+| instance_uuid | None || properties|{u'memory_mb': u'1024', u'cpu_arch': u'x86_64', u'local_gb': u'10',||| u'cpus': u'1'} || maintenance | False || driver_info | { [SNIP] }|| extra | {}|| last_error | None|| created_at | 2014-11-20T23:57:03+00:00 || target_provision_state | None|| driver | pxe_ipmitool|| updated_at | 2014-11-21T00:47:34+00:00 || instance_info | {}|| chassis_uuid | 7b49bbc5-2eb7-4269-b6ea-3f1a51448a59|| provision_state| None|| reservation | None|| power_state | power off || console_enabled| False || uuid | 86a2b1bb-8b29-4964-a817-f90031debddb|+-----------------+--------------+------------+------------------+-----------+$ nova hypervisor-show 1+-------------------------+--------------------------------------+| Property| Value|+-------------------------+--------------------------------------+| cpu_info| baremetal cpu|| current_workload| 0 || disk_available_least | - || free_disk_gb | 10 || free_ram_mb | 1024 || host_ip | [ SNIP ] || hypervisor_hostname | 86a2b1bb-8b29-4964-a817-f90031debddb || hypervisor_type | ironic || hypervisor_version| 1 || id| 1 || local_gb| 10 || local_gb_used | 0 || memory_mb | 1024 || memory_mb_used | 0 || running_vms | 0 || service_disabled_reason | - || service_host | my-test-host || service_id| 6 || state | up || status | enabled|| vcpus | 1 || vcpus_used| 0 |+-------------------------+--------------------------------------+

13.维护模式

如果不想让某个裸机被Nova自动管理,可以将该裸机从可用资源池中移除。方法是将该裸机设置为维护模式。

$ ironic node-set-maintenance $NODE_UUID on

在K版本中,可以用--reason备注原因,以方便管理维护。

$ ironic node-set-maintenance $UUID on --reason "Need to add ram."$ ironic node-show $UUID+------------------------+--------------------------------------+| Property | Value|+------------------------+--------------------------------------+| target_power_state | None || extra | {} || last_error | None || updated_at | 2015-04-27T15:43:58+00:00 || maintenance_reason | Need to add ram. || ... | ... || maintenance | True || ... | ... |+------------------------+--------------------------------------+

要取消维护模式,可使用如下命令:

$ ironic node-set-maintenance $NODE_UUID off