From nobody Mon Nov 7 03:39:19 2022 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 4N5H5z2Qrqz4gkV5; Mon, 7 Nov 2022 03:39:19 +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 4N5H5z20xTz4Gkm; Mon, 7 Nov 2022 03:39:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1667792359; 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=YaDmoM8O3PS3k3JzOt9v1JUY7v7TDX1zuqpS7A7P6+M=; b=fJMVclSjqWqU49r/t6rgzHjmGZTBqqJIPBPVRqLsgK6a25IcAyvj9yrGUZiY+hC8CuR8Hz sGedu88njwFLtSgAa0NqldzdkWFG106S6sgFgLhNTGzOyV+tFBEomaFuWzeF63exn0bd7t AfBsMycejykUnDBL2nOefqZybb/244F56mwU4+wQL38dswtPXSr8LPo2Vf/ZZSyoUUyoN6 1S6RNM9EhF0l2CVLFlplY+fwyPpBugZv1HbDsOd7umrliuA2qU/bdT/KZpH2Nf/T0f6hS3 KWaUX1AaNul1aCErG6+Gr6NxRxYFzU8+rQiam/sFwUDVbrx44ZlO6mi4Gl6F9Q== 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 4N5H5z12TPzmDP; Mon, 7 Nov 2022 03:39:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2A73dJKA027992; Mon, 7 Nov 2022 03:39:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2A73dJlO027991; Mon, 7 Nov 2022 03:39:19 GMT (envelope-from git) Date: Mon, 7 Nov 2022 03:39:19 GMT Message-Id: <202211070339.2A73dJlO027991@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Li-Wen Hsu Subject: git: 72a1cb05cd23 - main - rc(8): Add a zpoolupgrade rc.d script 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: lwhsu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 72a1cb05cd230ce0d12a7180ae65ddbba2e0cb6d Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1667792359; 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=YaDmoM8O3PS3k3JzOt9v1JUY7v7TDX1zuqpS7A7P6+M=; b=U5zf1RTG7a3H4jXR3s04s7zzlba0Fn/UlmU5FCk9HQrJwc/g0d/XiDNA8JdP8FkfhuqsUs As0GR3fXWkzumCBikMjpBVoQzbKGgspTGPdfi799FRbE7eJvbG9d/xGSZ7Fy3poGNrgEs2 uHB8W0yFvwQpIp0pEU5yI06wEONeCZIQAfav5h6lo+nSjohMagzYtKzbJZhpc8z/bPP5p0 +YNZL/1f9dKB12xlcma6lFvaTJuBbSKkMyupnQWlbl6J04L5Gb9ojkHTkvxdXsSWVtZ3bi KrtfmLMiZFbT7q2axfUyYx+OF4Xe6OESUOTS/dIPGcMWJC0cKKbijqOIpfpSyw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1667792359; a=rsa-sha256; cv=none; b=XupNwiGY2R1WxUmNZ+D+TS65/wv4QB7JAjWZbjUPF83nWGHW03WksejnuOdoDX52mb/LDC zMjD12GYMS9c20s7/7/5MFDxsDVlxxVQlReQLH7wqF/6KDKH6mM6o4lkGyL1jAS1P2zRPB cv2RPJfvqXnZkdVW29/u7cgjrWc2BAcECUtwAORrEFLVwDRz84lcsI9+0S/fa+LDoeUnk3 UNAggjlhbZ+8gLgBFFXoDnrzyooChu/Tmr3hi6h+v42BL3GDZZ0LDcrT0zgbrGTQ2Z+dPw QY37nUQuGQGrYfHTGAcFt061R4TKHG1SXuPXzUfvjMCb80zc13kH/hNpg6WzTg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by lwhsu: URL: https://cgit.FreeBSD.org/src/commit/?id=72a1cb05cd230ce0d12a7180ae65ddbba2e0cb6d commit 72a1cb05cd230ce0d12a7180ae65ddbba2e0cb6d Author: Li-Wen Hsu AuthorDate: 2022-11-07 03:30:09 +0000 Commit: Li-Wen Hsu CommitDate: 2022-11-07 03:30:09 +0000 rc(8): Add a zpoolupgrade rc.d script If a zpool is created by makefs(8), its version is 5000, i.e., all feature flags are off. Introduce an rc script to run `zpool upgrade` over the assigned zpools on the first boot. This is useful to the ZFS based VM images built from release(7). Reviewed by: imp, markj, mav Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D37282 --- libexec/rc/rc.conf | 2 ++ libexec/rc/rc.d/Makefile | 1 + libexec/rc/rc.d/zpoolupgrade | 25 +++++++++++++++++++++++++ share/man/man5/rc.conf.5 | 9 ++++++++- 4 files changed, 36 insertions(+), 1 deletion(-) diff --git a/libexec/rc/rc.conf b/libexec/rc/rc.conf index bc908075d033..a71a3fa4063d 100644 --- a/libexec/rc/rc.conf +++ b/libexec/rc/rc.conf @@ -77,6 +77,8 @@ zfskeys_enable="NO" # Set YES to autoload ZFS encryption keys zfs_bootonce_activate="NO" # Set YES to make successful bootonce BE permanent zpool_reguid="" # Set to zpools for which the GUID should be replaced # upon first boot. +zpool_upgrade="" # Set to zpools for which the version should be upgraded + # upon first boot. # ZFSD support zfsd_enable="NO" # Set to YES to automatically start the ZFS fault diff --git a/libexec/rc/rc.d/Makefile b/libexec/rc/rc.d/Makefile index e8ee61ffdff8..0f0d87bdde80 100644 --- a/libexec/rc/rc.d/Makefile +++ b/libexec/rc/rc.d/Makefile @@ -328,6 +328,7 @@ ZFS+= zfsd ZFS+= zfskeys ZFS+= zpool ZFS+= zpoolreguid +ZFS+= zpoolupgrade ZFS+= zvol ZFSPACKAGE= rc .endif diff --git a/libexec/rc/rc.d/zpoolupgrade b/libexec/rc/rc.d/zpoolupgrade new file mode 100755 index 000000000000..6f5720bac6a7 --- /dev/null +++ b/libexec/rc/rc.d/zpoolupgrade @@ -0,0 +1,25 @@ +#!/bin/sh + +# PROVIDE: zpoolupgrade +# REQUIRE: zpool +# BEFORE: mountcritlocal +# KEYWORD: firstboot nojail + +. /etc/rc.subr + +name="zpoolupgrade" +desc="Upgrade zpool version" +rcvar="zfs_enable" +start_cmd="zpoolupgrade_start" + +zpoolupgrade_start() +{ + local pool + + for pool in ${zpool_upgrade}; do + zpool upgrade $pool + done +} + +load_rc_config $name +run_rc_command "$1" diff --git a/share/man/man5/rc.conf.5 b/share/man/man5/rc.conf.5 index f9ceabc83120..43fa44a5f1cb 100644 --- a/share/man/man5/rc.conf.5 +++ b/share/man/man5/rc.conf.5 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 28, 2022 +.Dd November 7, 2022 .Dt RC.CONF 5 .Os .Sh NAME @@ -2109,6 +2109,13 @@ A space-separated list of ZFS pool names for which new pool GUIDs should be assigned upon first boot. This is useful when using a ZFS pool copied from a template, such as a virtual machine image. +.It Va zpool_upgrade +.Pq Vt str +A space-separated list of ZFS pool names for which version should be upgraded +upon first boot. +This is useful when using a ZFS pool generated by +.Xr makefs 8 +utility. .It Va gptboot_enable .Pq Vt bool If set to