コード例 #1
0
def get_curtin_yaml_config(request, node):
    """Return the curtin configration for the node."""
    osystem = node.get_osystem()
    release = node.get_distro_series()

    main_config = get_curtin_config(request, node)
    cloud_config = compose_curtin_cloud_config(request, node)
    archive_config = compose_curtin_archive_config(request, node)
    reporter_config = compose_curtin_maas_reporter(request, node)
    swap_config = compose_curtin_swap_preseed(node)
    kernel_config = compose_curtin_kernel_preseed(node)
    verbose_config = compose_curtin_verbose_preseed()
    network_yaml_settings = get_network_yaml_settings(osystem, release)
    network_config = compose_curtin_network_config(
        node,
        version=network_yaml_settings.version,
        source_routing=network_yaml_settings.source_routing,
    )

    if osystem not in ["ubuntu", "ubuntu-core", "centos", "rhel", "windows"]:
        maaslog.warning(
            "%s: Custom network configuration is not supported on '%s' "
            "('%s'). It is only supported on Ubuntu, Ubuntu-Core, CentOS, "
            "RHEL, and Windows. Please verify that this image supports custom "
            "network configuration." % (node.hostname, osystem, release))

    if curtin_supports_custom_storage():
        if osystem in ["windows", "ubuntu-core", "esxi"]:
            # Windows, ubuntu-core, and ESXi do not support custom storage.
            # Custom storage is still passed to allow Curtin to correctly
            # select the boot device.
            #
            # This also requires Curtin support. See (LP:1640301). If Curtin
            # doesn't support it, the storage config is not passed for
            # backwards compatibility.
            supports_custom_storage = curtin_supports_custom_storage_for_dd()
        elif osystem != "ubuntu":
            # CentOS/RHEL storage is now natively supported by Curtin. Other
            # GNU/Linux distributions may work as well. If Curtin lacks support
            # don't send storage configuration for backwards compatibility.
            supports_custom_storage = curtin_supports_centos_curthook()
        else:
            supports_custom_storage = True
    else:
        # Curtin has supported custom storage for Ubuntu since
        # 0.1.0~bzr275-0ubuntu1.
        supports_custom_storage = False

    if supports_custom_storage:
        storage_config = compose_curtin_storage_config(node)
    else:
        storage_config = []
        maaslog.warning(
            "%s: cannot deploy '%s' ('%s') with custom storage config; "
            "missing support from Curtin. Default to flat storage layout." %
            (node.hostname, node.osystem, node.distro_series))

    return (storage_config + archive_config + reporter_config +
            network_config + swap_config + kernel_config + verbose_config +
            cloud_config + [main_config])
コード例 #2
0
ファイル: preseed.py プロジェクト: sfeole/maas
def get_curtin_yaml_config(node, default_region_ip=None):
    """Return the curtin configration for the node."""
    main_config = get_curtin_config(node)
    cloud_config = compose_curtin_cloud_config(node)
    archive_config = compose_curtin_archive_config(node)
    reporter_config = compose_curtin_maas_reporter(node)
    swap_config = compose_curtin_swap_preseed(node)
    kernel_config = compose_curtin_kernel_preseed(node)
    verbose_config = compose_curtin_verbose_preseed()

    supports_custom_storage = True
    # Get the storage configration if curtin supports custom storage.
    if not curtin_supports_custom_storage():
        maaslog.error(
            "%s: cannot deploy with custom storage config; missing support "
            "from curtin." % node.hostname)
        supports_custom_storage = False

    network_config = compose_curtin_network_config(node)

    if node.osystem != "ubuntu":
        maaslog.info("%s: custom storage options are only supported on "
                     "Ubuntu. Using flat storage layout." % node.hostname)
        supports_custom_storage = False
        if (node.osystem == "windows"
                and curtin_supports_custom_storage_for_dd()):
            # Windows does not support custom storage, however we still pass
            # the storage config to ensure that curtin correctly selects the
            # boot device as the root device.
            #
            # This also requires curtin support. See (LP:1640301).
            supports_custom_storage = True

    if node.osystem == "custom":
        maaslog.info(
            "%s: deploying custom image '%s' with custom networking options. "
            "Please verify that this image supports custom network "
            "configuration." % (node.hostname, node.distro_series))

    if supports_custom_storage:
        storage_config = compose_curtin_storage_config(node)
    else:
        storage_config = []

    return (storage_config + [main_config] + archive_config + reporter_config +
            network_config + swap_config + kernel_config + verbose_config +
            cloud_config)