From nobody Mon Mar 18 09:58:55 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 4Tyr0b2sNcz5D7t6; Mon, 18 Mar 2024 09:58:55 +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 4Tyr0b2JmWz4nlW; Mon, 18 Mar 2024 09:58:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1710755935; 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=jwemQ0TRP+1SvPVQ/rT5zwrbfllGGHaNpiPs5NjQ8Bw=; b=KanKkTsaFd+4WFK5w49TBGotOSfVEpx7APY1D70Yq3gGugZKylMKLJw6Wg0/2Mk6gfoWrG sQU7wu23ug/D0vVk3C1Ta7EeWS1LB+zP00XJkRF00s9b4mVTfgnm1X8uvqAOQo5Kzggdok EL9sTWl99+Npyhtbf4isVNebLfOLAMzknSgaYsjDnYXqjehMMT2JZJeTuSRu4lW3VxGnZc uhKOJhBt+IlqJwWPUjhAEXecRwwKvYjF5c+GTUiogguKi8/PJ4vIHkBzm1ndtU3XOMiEzx +LmdqaTlDtZh55OsCx/TGrlMv6PlwNdIi7pC2aL9Q8z9I4NUx8lRWjlQbzWSLw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1710755935; a=rsa-sha256; cv=none; b=cTxAULSjGciXeWo26r1tkz2M+NdzMga6PG/diUqouYl/bjpT2gpJlHMMOmODNsqwYzXgu5 t3/CgHPpW7ToeO5Qzj5mFTsVY82NNekTPLBzBF4MhGHFOUsfim4As0fKl3uNGLIvKJAr4Z 750nKmI0jychfD1Su677KcFzYTYkT0aVMQBPnbFGYtQ4IcMa+jCJdfSVJsFC/z/U5eJ73y KHpyIMnNp4bQMaM/w7ZNMXfE0ZPNEHPuFiqNInRq2hls95+7lQdUBTPUlvDe935M/gpMmT XQrgDs6O80Tj2rMcG5UIeF8FCAHIF6TI/vbDCsfi9jJau2lTCmeO3jHvO+wfog== 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=1710755935; 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=jwemQ0TRP+1SvPVQ/rT5zwrbfllGGHaNpiPs5NjQ8Bw=; b=Nl+tDbDRmDnE54Yv8q+hzdcspn/mC6iLz+p9HQlHeuTuEos/kojLzBTWa+TKnMTvunceyQ 585NXr0rfb2QD3s0lN4AOl3mYPRWpLNp5OzMSeRSt2j9o7rvTs6iLUh/6h6XAOvIRzwPyS 1e2XHpGY3pH3xNf1hrRBuZ62+qv5OBndHVafYyPL5WGWfW+reWh51/nux+yvYh3jv5cVGa Oi0ndu9OiRbydzyBRaT4pRi37wcgj1EVkajTb64hpONyDaC89H1tq57oppwlILnZ3cVP/h 214Ehzkytx5b9BtVgHdsHbG8JbrmqAuuUDECG9tUfoCI3phYXX9VEcbV1wBaNw== 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 4Tyr0b1pTvzJH1; Mon, 18 Mar 2024 09:58:55 +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 42I9wthN091396; Mon, 18 Mar 2024 09:58:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 42I9wtPN091393; Mon, 18 Mar 2024 09:58:55 GMT (envelope-from git) Date: Mon, 18 Mar 2024 09:58:55 GMT Message-Id: <202403180958.42I9wtPN091393@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: 78b6117dac99 - main - 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: owner-dev-commits-src-all@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/main X-Git-Reftype: branch X-Git-Commit: 78b6117dac99c80fe618979fef4ef322b97415fa Auto-Submitted: auto-generated The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=78b6117dac99c80fe618979fef4ef322b97415fa commit 78b6117dac99c80fe618979fef4ef322b97415fa Author: Baptiste Daroussin AuthorDate: 2024-03-15 08:43:20 +0000 Commit: Baptiste Daroussin CommitDate: 2024-03-18 09:58:50 +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. 2 formats available: qcow2 and raw 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 --- 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 b9c43e8b491f..2b252aa18c3a 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 qcow2 +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 41437a9e1edb..0346e33b81b4 100644 --- a/release/tools/vmimage.subr +++ b/release/tools/vmimage.subr @@ -239,6 +239,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 @@ -312,6 +316,7 @@ vm_create_disk() { mkimg -s ${PARTSCHEME} -f ${VMFORMAT} \ ${BOOTPARTS} \ ${SWAPOPT} \ + ${CONFIG_DRIVE} \ ${ROOTFSPART} \ -o ${VMIMAGE}