From nobody Mon Aug 5 17:04:28 2024 X-Original-To: freebsd-current@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 4Wd2ql692Wz5SM7g; Mon, 05 Aug 2024 17:05:07 +0000 (UTC) (envelope-from marietto2008@gmail.com) Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Wd2ql4NR3z4hhk; Mon, 5 Aug 2024 17:05:07 +0000 (UTC) (envelope-from marietto2008@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-pj1-x1035.google.com with SMTP id 98e67ed59e1d1-2cd5e3c27c5so7363173a91.3; Mon, 05 Aug 2024 10:05:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722877506; x=1723482306; darn=freebsd.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=LxpX7umltLmborJx1yxVtPEthZ4/adBRYru7143jDjE=; b=epLOOV9CEWmzSxJEeK6sasYYDn2PsufinmV/CQ3AEOewk2Cxopguc9wfE1DKprdCgl +Ctm8MVKndgGxfmJaWH72zvqkyL4uRxR/bnw3RGYlbf40pzYT51dgnw1x1KISpxdWsXL Zr/he0zOPnZ7EnQFa8Os2t4gHsUqlhASg7G/7KgUJed6qA0x3lLHQZ5xJHjudX8AJocM dgrI4viB89xOH1LupPe03C8EsGh+7A80k/z7tIk6fv3eXPsJlsAlLv0p6Khvd7pFKywN sYld8xl1Kjjy5WvQ9Z5Y5iKu8guuCU0kV7H/jqTdMg7Wt5ECgAUN/n03AgoSmDnyhmoW aA5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722877506; x=1723482306; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=LxpX7umltLmborJx1yxVtPEthZ4/adBRYru7143jDjE=; b=KIU4G4sdlY7VozLfOOd3JjtRgdkjRZNVukCsF5d3wW146qJy5CYULNRhaXBVUnD2yu icq6pE4r5WAXuFV3hhpSGF1t/0jqiYyRpOHayt+dRRWUkRdUHHO4/XfxMNU+oPr+9nGU 1UWxmXrWiBgWk/yCVtlAzmhVoXVpiq2g2aDP/ODIsOZRxar74khc9X60wktqXHTTB5yg fHaPbEQhmKSvYqV7ZJMHdWC+Gzzw8yt2kQQaSS/shUnsuOp6IcsYQgCcX3kZgCgVJQmP CQ/28t3TknI2U8mFQTBiqCjag6CGjSZA74KVI7uIWHfchwGn5ZG1WKV/C4UlrgRaRRwd gtsA== X-Forwarded-Encrypted: i=1; AJvYcCWXqyvkreoZge9gNjx2PlB41Bsko6JITvC0roVFhUbPYgEczQQT63Dk4CZnYEPdJ9NW2MdymSH0FfC6aWKlRNu3C6vtPV9h3+9DxQ== X-Gm-Message-State: AOJu0YyV69ngvc3DBUtOsL8aHGROPX4UoNF/2e9gAm0nAMPNs4w9WHvq UbAD5910cnZWTHfUx6Ge1l8I529mS2J064rafXWLTemLF6yXrMHgSX/uklP0sFFj2SL3b58RO38 FIbo7I9tsO34dOIB2pMSkuJDe2THd36LS X-Google-Smtp-Source: AGHT+IGB2FG7pLnGgwysyrP9sIlVk1KeS/A921M+8va43t9O5TiiFrBIn2GQPPcjXSUFt6HZUyfb3tpPSh4k7xR7iQQ= X-Received: by 2002:a17:90a:fa85:b0:2cd:410a:b010 with SMTP id 98e67ed59e1d1-2cff93c59fdmr10923089a91.2.1722877505570; Mon, 05 Aug 2024 10:05:05 -0700 (PDT) List-Id: Discussions about the use of FreeBSD-current List-Archive: https://lists.freebsd.org/archives/freebsd-current List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-current@FreeBSD.org MIME-Version: 1.0 References: <178d585e-2ce0-4b69-a017-8af7f9b78a57@omnilan.de> In-Reply-To: <178d585e-2ce0-4b69-a017-8af7f9b78a57@omnilan.de> From: Mario Marietto Date: Mon, 5 Aug 2024 19:04:28 +0200 Message-ID: Subject: Re: RFC: rc(8) script for bhyve(8) on FreeBSD To: Harry Schmalzbauer Cc: freebsd-current@freebsd.org, virtualization@freebsd.org Content-Type: multipart/alternative; boundary="000000000000b60fa5061ef2ad73" X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US] X-Rspamd-Queue-Id: 4Wd2ql4NR3z4hhk --000000000000b60fa5061ef2ad73 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hello. I'm also interested in writing a script to manage the bhyve vms. Even if I suspect that my approach will be different. My idea is to ask the user what he wants to do and then the script will configure the vm getting the information provided by the user. I will give a look at /etc/rc.d/bhyve,but I don't think I will study cirrina,it seems very complicated. On Mon, Aug 5, 2024 at 6:13=E2=80=AFPM Harry Schmalzbauer wrote: > Hello, > > two years elapsed since I last deployed a FreeBSD machine that utilizd > bhyve(8), which already had bhyve_config(5) support back then. > > I was astonished that I still couldn't find bhyve in /etc/rc.d in > 14.1-stable as of last week. > Since I utilize ng_bridge(8) and do some more things differently than > vm-bhyve / iocage and the like, I wanted to have something straight > forward, capable of making use of the wonderful bhyve_config(5) feature, > for use cases where /usr/share/examples/bhyve/vmrun.sh isn't suitable. > > Please find attached my first approch, which currently covers the > following features: > > - auto-preload FreeBSD guest using bhyveload(8) in case config file > doesn't define lpc.bootrom > - Allows referencing %(youname_somevar) in config file if defined as > bhyve_youname_somevar in rc.conf(5). > (For example: > bhyve_vmdisk_default_pool=3D"myppol2" > bhyve_vmdisk_default_dataset=3D"bhyveVOL/sys" > and > pci.0.3.0.path=3D/dev/zvol/%(vmdisk_default_pool)/%(vmdisk_default_datase= t)/%(name) > > in bhyve_config(5) file > ) > - Adaptive handling of start/stop requests depending on 'AUTO' 'ALL' or > specific list of VM names, depending on the non-bhyve_cfg(5) 'autostart' > option. > - Hopefully balanced amount of messages about what's going on, to be > user friendly but not spamming. > > There's a lot of room for improvements (selectable pre-jail/post-jail > order, bootdisk detection, priority handling, a useful 'status' > implementation, style) and for sure some bugs, but this version works > well for my current setup. > Happy to contribute if useful for others, feedback welcome. > > -harry > > > --=20 Mario. --000000000000b60fa5061ef2ad73 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello.

I'm also interest= ed in writing a script to manage the bhyve vms. Even if I suspect that my a= pproach will be different. My idea is to ask the user what he wants to do a= nd then the script will configure the vm getting the information provided b= y the user.
I will give a look at /etc/rc.d/bhyve,but I don&= #39;t think I will study cirrina,it seems very complicated.
=
On Mon= , Aug 5, 2024 at 6:13=E2=80=AFPM Harry Schmalzbauer <freebsd@omnilan.de> wrote:
Hello,

two years elapsed since I last deployed a FreeBSD machine that utilizd
bhyve(8), which already had bhyve_config(5) support back then.

I was astonished that I still couldn't find bhyve in /etc/rc.d in
14.1-stable as of last week.
Since I utilize ng_bridge(8) and do some more things differently than
vm-bhyve / iocage and the like, I wanted to have something straight
forward, capable of making use of the wonderful bhyve_config(5) feature, for use cases where /usr/share/examples/bhyve/vmrun.sh isn't suitable.<= br>
Please find attached my first approch, which currently covers the
following features:

- auto-preload FreeBSD guest using bhyveload(8) in case config file
doesn't define lpc.bootrom
- Allows referencing %(youname_somevar) in config file if defined as
bhyve_youname_somevar in rc.conf(5).
=C2=A0=C2=A0 (For example:
=C2=A0=C2=A0=C2=A0=C2=A0 bhyve_vmdisk_default_pool=3D"myppol2" =C2=A0=C2=A0=C2=A0=C2=A0 bhyve_vmdisk_default_dataset=3D"bhyveVOL/sys&= quot;
=C2=A0=C2=A0 =C2=A0 and
pci.0.3.0.path=3D/dev/zvol/%(vmdisk_default_pool)/%(vmdisk_default_dataset)= /%(name)
in bhyve_config(5) file
=C2=A0=C2=A0 )
- Adaptive handling of start/stop requests depending on 'AUTO' '= ;ALL' or
specific list of VM names, depending on the non-bhyve_cfg(5) 'autostart= '
option.
- Hopefully balanced amount of messages about what's going on, to be user friendly but not spamming.

There's a lot of room for improvements (selectable pre-jail/post-jail <= br> order, bootdisk detection, priority handling, a useful 'status' implementation, style) and for sure some bugs, but this version works
well for my current setup.
Happy to contribute if useful for others, feedback welcome.

-harry




--
Mario.
--000000000000b60fa5061ef2ad73--