当node节点state为manage时,可执行inspector
ironic node-set-provision-state <node_uuid> manage
ironic node-set-provision-state <node_uuid> inspect

inspect阶段

执行inspect后ironic会发送PUT请求到 /v1/nodes/{node_ident}/provision , ironic-api 收到这个请求后会根据 body 的 target 字段做处理:

class NodeStatesController(rest.RestController):
    _custom_actions = {
    'power': ['PUT'],
    'provision': ['PUT'],
    'raid': ['PUT'],
}
    def get(self, node_ident):
        .......
    def raid(self, node_ident, target_raid_config):
        ......
    def power(self, node_ident, target, timeout=None):
        ......
    def provision(self, node_ident, target, configdrive=None,
              clean_steps=None, rescue_password=None):
        if target in (ir_states.ACTIVE, ir_states.REBUILD):#判断状态
            rebuild = (target == ir_states.REBUILD)
            pecan.request.rpcapi.do_node_deploy(context=pecan.request.context,
                                        node_id=rpc_node.uuid,
                                        rebuild=rebuild,
                                        configdrive=configdrive,
                                        topic=topic)
        elif target == ir_states.VERBS['inspect']:#调用inspect_hardware方法
            pecan.request.rpcapi.inspect_hardware(pecan.request.context, rpc_node.uuid, topic=topic)
ironic/api/controllers/v1/node.py

相关文章: