讀古今文學網 > OpenStack系統架構設計實戰 > 7.5.1 完全安裝 >

7.5.1 完全安裝

安裝Ironic之前,假定OpenStack其他組件已經部署完成。為了讓Ironic正常運行,需要在OpenStack其他組件上做相應配置。

1.配置Keystone

為使用Keystone鑒權,需要在KeyStone裡為Ironic創建一個用戶,並賦予service租戶和admin角色。

keystone user-create --name=ironic --pass=IRONIC_PASSWORD --email=ironic@example. 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:IRONIC_DBPASSWORD@DB_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