支持 System z (S/390) 上的 Linux 作为超visor 平台

https://blueprints.launchpad.net/cinder/+spec/linux-systemz

为了允许 Cinder 管理基于 FCP 的块存储在 System z 上的 Linux,需要进行一些平台特定的更改。

超出初始 Cinder 支持的额外 OpenStack 功能不包含在此蓝图中;我们将根据需要为这些功能提供特定的额外蓝图。

Nova 中所需的支持由单独的蓝图描述,该蓝图列为以下依赖项。

iSCSI 不需要任何更改。

问题描述

System z 上的 Linux 与其他 Linux 平台在以下方面不同

  • System z 使用不同的设备文件路径格式(基于 ccw,而不是基于 pci)

  • 光纤通道设备的自动发现可以配置为在线或离线。如果自动发现已关闭,则需要由 OpenStack 显式添加和删除设备(unit_add、unit_remove)

  • vHBAs 可以设置为在线或离线。离线 vHBAs 需要被忽略。

用例

提议的变更

修改 Cinder 中的代码以解决这些问题,具体取决于主机功能,指示 CPU 架构为 arch.S390Xarch.S390。有关详细信息,请参阅 工作项目 部分。

备选方案

数据模型影响

REST API 影响

安全影响

通知影响

其他最终用户影响

性能影响

其他部署者影响

无(此蓝图不需要在 cinder.conf 中进行平台特定的参数)

开发人员影响

无(更改不应影响其他平台)

实现

负责人

主要负责人

stefan-amann

其他贡献者

mzoeller maiera

工作项

cinder/brick/initiator/connector.py

  • connect_volume 需要支持 System z 特定的设备文件路径格式,并发出 unit_add 命令(通过调用新的 configure_scsi_device() 函数完成)

    if platform.machine() == 's390x':
        target_lun = "0x00%02d000000000000" %
                     int(connection_properties.get('target_lun', 0))
        host_device = ("/dev/disk/by-path/ccw-%s-zfcp-%s:%s" %
                      (pci_num,
                       target_wwn,
                       target_lun))
        self._linuxfc.configure_scsi_device(pci_num, target_wwn, target_lun)
    else :
        host_device = ("/dev/disk/by-path/pci-%s-fc-%s-lun-%s" %
                      (pci_num,
                       target_wwn,
                       connection_properties.get('target_lun', 0)))
    host_devices.append(host_device)
    
  • disconnect_volume 需要支持 System z 特定的设备文件路径格式,并发出 unit_remove 命令(通过调用新的 deconfigre_scsi_device() 函数完成)

    for device in devices:
        self._linuxscsi.remove_scsi_device(device["device"])
    if platform.machine() == 's390x':
        ports = connection_properties['target_wwn']
        wwns = []
        # we support a list of wwns or a single wwn
        if isinstance(ports, list):
            for wwn in ports:
                wwns.append(str(wwn))
        elif isinstance(ports, basestring):
            wwns.append(str(ports))
        hbas = self._linuxfc.get_fc_hbas_info()
        for hba in hbas:
            pci_num = self._get_pci_num(hba)
            if pci_num is not None:
                for wwn in wwns:
                    target_wwn = "0x%s" % wwn.lower()
                    target_lun = "0x00%02d000000000000"
                        % int(connection_properties.get('target_lun', 0))
                    host_device = ("/dev/disk/by-path/ccw-%s-zfcp-%s:%s" %
                                  (pci_num,
                                   target_wwn,
                                   target_lun))
                    self._linuxfc.deconfigure_scsi_device(
                                   pci_num,
                                   target_wwn,
                                   target_lun)
    

cinder/brick/initiator/linuxfc.py

  • 执行 unit_add 或 unit_remove 命令的实用函数。

    def configure_scsi_device(self, device_number, target_wwn, lun):
        out = None
        err = None
        zfcp_device_command = ("/sys/bus/ccw/drivers/zfcp/%s/%s/unit_add" %
                                (device_number,
                                 target_wwn))
        try:
            self.echo_scsi_command(zfcp_device_command, lun)
        except putils.ProcessExecutionError as exc:
            LOG.warn(_("zKVM unit_add call failed exit (
                                   %(code)s), stderr (%(stderr)s)")
                     % {'code': exc.exit_code, 'stderr': exc.stderr})
    
    
    
    def deconfigure_scsi_device(self, device_number, target_wwn, lun):
        out = None
        err = None
        zfcp_device_command = ("/sys/bus/ccw/drivers/zfcp/%s/%s/unit_remove" %
                                (device_number,
                                 target_wwn))
        try:
            self.echo_scsi_command(zfcp_device_command, lun)
        except putils.ProcessExecutionError as exc:
            LOG.warn(_("zKVM unit_remove call failed
                        exit (%(code)s), stderr (%(stderr)s)")
                     % {'code': exc.exit_code, 'stderr': exc.stderr})
    
  • 对于 System z,get_fc_hbas_info() 仅返回启用的 vHBAs。

    hbas_info = []
        for hba in hbas:
            if (platform.machine() != 's390x')
                or (hba['port_state'] == 'Online'):
                    ...same as today
    

依赖项

Nova 蓝图,用于在 System z 上的 Linux 中添加对 KVM/libvirt 的支持 https://blueprints.launchpad.net/nova/+spec/libvirt-kvm-systemz

测试

单元测试

  • 将在 System z 以及基于 Intel 的机器上添加和执行单元测试。

  • 我们将为 System z 上的 CI 测试提供环境。这由列为依赖项的 Nova 蓝图描述。我们将在该环境中测试 Cinder 和 Nova 在 System z 上的运行情况。

文档影响

  • 无需更改配置文档。

  • 将根据需要对平台进行文档更改(详细信息待定)。

参考资料