From nobody Thu Apr 11 12:05:32 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VFdgc3vMTz5HJKG; Thu, 11 Apr 2024 12:05:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VFdgc34lHz50gg; Thu, 11 Apr 2024 12:05:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1712837132; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=o36XvPqu0zSwDED6aNWmbOJsR/6Ar/utOI7KP1YnzkY=; b=NUeaK2kYc0RxocFmPjf/HN5Zk1iiH58d5Oxm6pLY13T+W+3mO8vYPiHtH42x87j8iGJ3Mp d5bV5I6c7NTdbKCWPT9bocog/FmsdQwn2KDv2MI5jjg7TyO63x4Uzp0JKI+cFdSpQOEzCU cqyfWMursV9eVUpNkgvo9Fg67j9FPWVNVvgKr1v9za6fHCaLqzrmrCJ/KzvIFiXbAL+rXi OGqDjlmVjLq1BnXutJNWeXTwQw8TIPuM+U6NgDjyS/P56gJ0Zlv8MCYis7LGtyQXWd67lC cvtDvfjP+em3e9s/1FMeBcjeWKyOjS+HWc51VumOc1XPZNRQcqTFyI4gJpwa7A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1712837132; a=rsa-sha256; cv=none; b=NWquMr0V7KQGNLwIdgtO4B2zkyXb+kCVD81n8fPl6IKnJt5TN7jtPg0Q/lIBvwJN7BJk2G JO/FdZ0n6SG+oNw5w30RuFGzwIz+ieO26jFP8ljPmyO7vD+/dZlOGYF3dgaL+uaUPnCmDn nBMDyqDgd3KknyM8JZgb0cRMekHBkymAgeyLTaWkU+4k9qoOoLfketsYDKYKbOlsw9dlAw 82O5vzsGts7AwKCEbVOCMOmRGzZyYPvoh3pikXX07mObAb4uVqeev8cxDB+87yKlP5AR3l +Exybzo3TUUL2Zu1dQ27S/QVZOSiCUDg/XU5JUzuxNnmOxTH5Dtjf7QiM3G3OQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1712837132; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=o36XvPqu0zSwDED6aNWmbOJsR/6Ar/utOI7KP1YnzkY=; b=cpt/KJn/op2eajbqVPgPTc0Q/tXPluF3LUDRdV3XrByEXxDVt5Zv7T8/n35IqmJDdZaOH1 7vLZX3mHC3sbZIlhk0NhdIOM+EJyCM3+xdPmZJWv6xC/HFHspw0HJZDEv90DnNMlx6DYQa Yk4lCXxAkAG4q82mootbRf2L2uuZWNmSQkLtOm+ZjY57LjER09DzCL4brttTYJn+RItRi2 7jAJ1rdwODoDHxBTt14A/bQAYlVp/Jm+nw+/SXG3jmGjrlxLwRniIukCTwJ30W47V2pa5I avY0fZlhJFKCOl8Mv1xAlPiNfLVtf+RadI9sGMoy7hfTogx0pDp4CPcCLVWF3g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VFdgc2Yq7z1KKW; Thu, 11 Apr 2024 12:05:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 43BC5WvT011595; Thu, 11 Apr 2024 12:05:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43BC5W9Q011592; Thu, 11 Apr 2024 12:05:32 GMT (envelope-from git) Date: Thu, 11 Apr 2024 12:05:32 GMT Message-Id: <202404111205.43BC5W9Q011592@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Baptiste Daroussin Subject: git: 227e7a205edf - stable/14 - release: add basic cloudinit images List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: dev-commits-src-all+owner@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 227e7a205edf782129cba606f2d06b40e4728d98 Auto-Submitted: auto-generated The branch stable/14 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=227e7a205edf782129cba606f2d06b40e4728d98 commit 227e7a205edf782129cba606f2d06b40e4728d98 Author: Baptiste Daroussin AuthorDate: 2024-03-15 08:43:20 +0000 Commit: Baptiste Daroussin CommitDate: 2024-04-11 12:05:10 +0000 release: add basic cloudinit images Provide both zfs and ufs images which a 1MB partition reserved for the config drive wearing a GPT Label "config-drive" to allow consumer to know where they should push the config drive on the provided image. This has been tested on OVHCloud baremetal via "bring your own image" Also tested on openstack Reviewed by: emaste Sponsored by: OVHCloud Differential Revision: https://reviews.freebsd.org/D44369 (cherry picked from commit 78b6117dac99c80fe618979fef4ef322b97415fa) (cherry picked from commit a977444652a59332c53b652b912c38a1d1802b58) --- release/Makefile.vm | 4 ++++ release/tools/basic-cloudinit.conf | 36 ++++++++++++++++++++++++++++++++++++ release/tools/vmimage.subr | 5 +++++ 3 files changed, 45 insertions(+) diff --git a/release/Makefile.vm b/release/Makefile.vm index 3a3b3bcd5f9d..a936e6cb98ca 100644 --- a/release/Makefile.vm +++ b/release/Makefile.vm @@ -19,6 +19,7 @@ RAW_DESC= Unformatted raw disk image CLOUDWARE_TYPES?= AZURE \ BASIC-CI \ + BASIC-CLOUDINIT \ EC2 \ GCE \ OCI \ @@ -29,6 +30,9 @@ AZURE_DESC= Microsoft Azure platform image BASIC-CI_FORMAT= raw BASIC-CI_FSLIST= ufs BASIC-CI_DESC= Image for CI +BASIC-CLOUDINIT_FORMAT= raw +BASIC-CLOUDINIT_FSLIST?= ufs zfs +BASIC-CLOUDINIT_DESC?= Images for VM with cloudinit disk config support EC2_FORMAT= raw EC2_FSLIST= ufs zfs EC2_FLAVOURS= BASE CLOUD-INIT diff --git a/release/tools/basic-cloudinit.conf b/release/tools/basic-cloudinit.conf new file mode 100644 index 000000000000..da4bed5ea5b5 --- /dev/null +++ b/release/tools/basic-cloudinit.conf @@ -0,0 +1,36 @@ +#!/bin/sh +# +# + +# Should be enough for base image, image can be resized in needed +export VMSIZE=5g + +# 1M config drive should be enough in most cases +export CONFIG_DRIVE=YES +export CONFIG_DRIVE_SIZE=1M + +# Set to a list of third-party software to enable in rc.conf(5). +export VM_RC_LIST="sshd growfs nuageinit" + +vm_extra_pre_umount() { + cat << EOF >> ${DESTDIR}/etc/rc.conf +dumpdev="AUTO" +ifconfig_DEFAULT="DHCP" +sshd_enable="YES" +EOF + + cat << EOF >> ${DESTDIR}/boot/loader.conf +autoboot_delay="-1" +beastie_disable="YES" +loader_logo="none" +console="comconsole,vidconsole" +EOF + cat <> ${DESTDIR}/etc/ssh/sshd_config +PasswordAuthentication yes +UsePAM no +EOF + + touch ${DESTDIR}/firstboot + + return 0 +} diff --git a/release/tools/vmimage.subr b/release/tools/vmimage.subr index 6eaf17b07948..eda22e061c6d 100644 --- a/release/tools/vmimage.subr +++ b/release/tools/vmimage.subr @@ -242,6 +242,10 @@ vm_create_disk() { BOOTPARTSOFFSET=":${VM_BOOTPARTSOFFSET}" fi + if [ -n "${CONFIG_DRIVE}" ]; then + CONFIG_DRIVE="-p freebsd/config-drive::${CONFIG_DRIVE_SIZE}" + fi + case "${VMFS}" in ufs) FSPARTTYPE=freebsd-ufs @@ -315,6 +319,7 @@ vm_create_disk() { mkimg -s ${PARTSCHEME} -f ${VMFORMAT} \ ${BOOTPARTS} \ ${SWAPOPT} \ + ${CONFIG_DRIVE} \ ${ROOTFSPART} \ -o ${VMIMAGE}