iSCSI 部署驱动程序中的带内清理支持

https://bugs.launchpad.net/ironic/+bug/1526405

目前使用 iSCSI 的部署驱动程序不支持带内清理。我们需要使这些驱动程序也支持带内清理操作。

问题描述

基于 iSCSI 进行部署的驱动程序目前不支持带内清理。因此,无法对使用这些驱动程序注册的节点执行诸如磁盘擦除、带内 RAID 配置等带内清理步骤。

以下驱动程序(省略测试驱动程序)目前执行基于 iSCSI 的部署

  • pxe_{ipmitool,ipminative,seamicro,iboot,ilo,

    drac,snmp,irmc,amt,msftocs,ucs,wol}

  • iscsi_ilo

  • iscsi_irmc

提议的变更

  • 弃用选项 CONF.agent.agent_erase_devices_priority 并将其移动到 CONF.deploy.agent_erase_devices_priority

  • 将以下方法添加到 iscsi_deploy.ISCSIDeploy(这些方法将执行 AgentDeploy 当前执行的相同操作)

    • prepare_cleaning - 此方法将为每个 Ironic 端口创建 Neutron 清理端口,并调用 self.boot 以准备启动 ramdisk 并返回 states.CLEANWAIT。方法定义如下

      def prepare_cleaning(self, task):
          """Boot into the agent to prepare for cleaning.
      
          :param task: a TaskManager object containing the node
          :raises NodeCleaningFailure: if the previous cleaning ports cannot
              be removed or if new cleaning ports cannot be created
          :returns: states.CLEANWAIT to signify an asynchronous prepare
          """
      
    • tear_down_cleaning - 此方法将删除为 Ironic 端口创建的清理端口,并调用 self.boot 以清理 ramdisk 启动。它将返回 None。方法定义如下

      def tear_down_cleaning(self, task):
          """Cleans up the environment after cleaning.
      
          :param task: a TaskManager object containing the node
          :raises NodeCleaningFailure: if the cleaning ports cannot be
              removed
          """
      
    • execute_clean_step - 此方法将调用 deploy_utils.agent_execute_clean_step。方法定义如下

      def execute_clean_step(self, task, step):
          """Execute a clean step asynchronously on the agent.
      
          :param task: a TaskManager object containing the node
          :param step: a clean step dictionary to execute
          :raises: NodeCleaningFailure if the agent does not return a command
              status
          :returns: states.CLEANWAIT to signify the step will be completed
              async
          """
      
    • get_clean_steps - 此方法将调用 deploy_utils.agent_get_clean_steps 以从 agent ramdisk 获取清理步骤。它还将重新分配清理优先级到磁盘擦除。

      如果使用 bash ramdisk,这将返回一个空列表。它将通过检查节点驱动程序内部信息中是否存在 agent_url 来检测。

      方法定义如下

      def get_clean_steps(self, task):
          """Get the list of clean steps from the agent.
      
          :param task: a TaskManager object containing the node
          :returns: A list of clean step dictionaries. Returns an
              empty list if bash ramdisk is used.
      """
      
  • 对于一直使用 DIB ramdisk 的部署者,当他们尝试进行清理时,节点将卡在 states.CLEANWAIT 中。这是因为 DIB ramdisk 不像 agent ramdisk 那样进行心跳。因此,此类部署者可能会遇到节点进入 states.CLEANFAIL 的问题。为了克服这个问题,将执行以下操作

    • 在启动部署 ramdisk 进行清理时,发送 bash ramdisk 参数(deploy_key、iscsi_target_iqn 等)。这将使 bash ramdisk 能够调用 pass_deploy_info vendor passthru。

    • 如果节点处于 CLEANWAIT 状态,则在 pass_deploy_info vendor passthru 中,我们将设置节点的清理步骤并要求 conductor 恢复清理。

    • 如果节点处于 CLEANWAIT 状态,我们还会跳过 pass_deploy_info vendor passthru 的验证。

备选方案

无。

数据模型影响

无。

状态机影响

无。

REST API 影响

无。

客户端 (CLI) 影响

无。

RPC API 影响

无。

驱动程序 API 影响

无。

Nova 驱动程序影响

无。

Ramdisk 影响

N/A

安全影响

使用 iscsi_deploy.ISCSIDeploy 的驱动程序将执行带内磁盘擦除,这将为租户带来安全优势。

其他最终用户影响

无。

可扩展性影响

无。

性能影响

无。

其他部署者影响

无。

开发人员影响

无。

实现

负责人

主要负责人

rameshg87

工作项

  • 为带内清理向 iscsi_deploy.ISCSIDeploy 添加新方法。

  • 修改 pass_deploy_info,使其在清理期间被调用时做好准备。

依赖项

  • 完成部署-启动接口分离的工作 [2],以启用所有驱动程序的带内清理。

测试

将添加单元测试。

升级和向后兼容性

无。

文档影响

新的 CONF 选项及其影响将被记录。

参考资料

[1] https://specs.openstack.org/openstack/ironic-specs/specs/approved/deprecate-bash-ramdisk.html [2] https://blueprints.launchpad.net/ironic/+spec/new-boot-interface