From owner-freebsd-virtualization@freebsd.org Sun Jun 24 10:13:17 2018 Return-Path: Delivered-To: freebsd-virtualization@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8EE35102291E for ; Sun, 24 Jun 2018 10:13:17 +0000 (UTC) (envelope-from bogorodskiy@gmail.com) Received: from mail-lf0-x232.google.com (mail-lf0-x232.google.com [IPv6:2a00:1450:4010:c07::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E563B83039 for ; Sun, 24 Jun 2018 10:13:16 +0000 (UTC) (envelope-from bogorodskiy@gmail.com) Received: by mail-lf0-x232.google.com with SMTP id n24-v6so12266788lfh.3 for ; Sun, 24 Jun 2018 03:13:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:subject:message-id:mime-version :content-disposition:user-agent; bh=FJ3/oxosEPW6d2ya72MihzIgiEeB6LNcSKbxoal1XFk=; b=QFwhYZo7qPt7oIps3N38utOd2wSnlgco467oFxe56xdqU75/VBsjz02hyTeVlAIm9j J5CN31ueKK+HI+QsxHsKP+ryt1jNMiC0yHP+b8QPgbiqVTJtlwDdXeqQ9BDe70hxrHt4 6BtJb4yqdlgVxrASJ47Q+/hYk9HrOsEKy9VuglwJ/E1LGW9dV8zGE8q9GvEe8k/RHjbj Tpdb2jAkt2k6dMIk5dRx458p0C5a5gf01MApQd+Zode5lN9iNpMrxWDN2rGU5H4mFLiD ugQH1YbK091e/WESEXJJB90APmC42uY3uCVdrz8DNtDZX8BzN3rzCUd+ZsNEZjcFSEFi rW/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:subject:message-id :mime-version:content-disposition:user-agent; bh=FJ3/oxosEPW6d2ya72MihzIgiEeB6LNcSKbxoal1XFk=; b=bTEuqkMxj7DRjUQRbK4A0Bcd3aRrjeTIrTtz/wLUsWkpvicY/ZPqpHSwtgfEqqS/vM RAAwowV5IcbKC3m4OF0B1IraiUtYsT2gCupzACzVFj6gAAYFahB1rvL6ULBF/4194e89 j12+pMoaz4N19cTVq0HpCUjKN7YqIHCqrwGFk2K61Ils7qYiV5v6Ezi1FHqGaiOHorip nmYRun32WcVyfNMSlcYCOXJYuBVbmoIXXxnnxwkFDcB0Mt7lZW8lpZMljPW74rJ0FX9f bJOm6hiCd1B1wbUaIUQlYr3hKm3Kbtk38nlAE1SKUPzkT11nDmwW0kiC0RA2Q3iayhDh qeww== X-Gm-Message-State: APt69E0xUa5tw1qCNehXlLeTO7TeGF3a20YbJPgW5av7edcixxuXPIzL 49TFd5ycYkVSWs1okyWELbB6qA== X-Google-Smtp-Source: ADUXVKKlFPZxZD6P8gSIx0xQIu9wj1EMfhtWkFGF6vgMoW56EYUKM/eTAMk2bf7lNu852yF1fXR/oA== X-Received: by 2002:a19:a78a:: with SMTP id q132-v6mr3527631lfe.126.1529835194776; Sun, 24 Jun 2018 03:13:14 -0700 (PDT) Received: from kloomba ([213.147.213.47]) by smtp.gmail.com with ESMTPSA id i67-v6sm1898346lji.49.2018.06.24.03.13.13 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 24 Jun 2018 03:13:14 -0700 (PDT) Sender: Roman Bogorodskiy Date: Sun, 24 Jun 2018 14:13:02 +0400 From: Roman Bogorodskiy To: freebsd-virtualization@freebsd.org Subject: RFC: bhyve supported features reporting Message-ID: <20180624101301.GB2252@kloomba> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="xgyAXRrhYN0wYx8y" Content-Disposition: inline User-Agent: Mutt/1.10.0 (2018-05-17) X-BeenThere: freebsd-virtualization@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: "Discussion of various virtualization techniques FreeBSD supports." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jun 2018 10:13:17 -0000 --xgyAXRrhYN0wYx8y Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Bhyve evolves over time, and new features get added, such as new devices support, new guest configurations and so on. However, it's not really straight-forward to figure out what features a given bhyve binary supports. This makes it harder to develop tools on top of bhyve, specifically error reporting. For example, libvirt's bhyve driver [1] probes bhyve capabilities [2] using: * Running 'bhyve -h' and parsing output, * For detecting devices, it runs 'bhyve -s 0,dev' and parses error output to see if the device is supported. It's not very effective because 'bhyve' binary has to be executed multiple times just to check things. Additionally, it's harder to check things on a deeper level, e.g. specific device parameters. Also, this is error-prone because help output generally is not designed for machine-parsing, and this could easily break on slight formatting change. I would like to discuss introducing a general way of reporting features bhyve supports. To start a discussion, I've created a simple draft/PoC which adds '-f' (as for features) command line switch to bhyve. This switch makes bhyve print its supported features. I'll use JSON as example, however, as it's done using libxo, XML is also supported. Example JSON output with inline comments below: "bhyve": { // 'features' schema version using the common versioning pattern: // major version increments on incompatible changes, // minor version increments on compatible changes (extensions). "schema_version": "1.0", // there could also go some general properties like max_cpus etc // list of specific features, mostly should be self-descriptive "features": { "rtc_utc": { "description": "RTC keeps UTC time", "cmd": { "switch": "-u" } }, "wire_guest_memory": { "description": "Wire guest memory", "cmd": { "switch": "-S" } }, "devices": { "description": "Devices support", "cmd": { "switch": "-s", "arguments": [ =20 // Probably, it'd be better to make this more organized, // e.g. instead of a string with all arguments and ar= g/value paris, // use a list of objects which would include possible= values, // required/optional, etc {"options": "virtio-net,tapN,mac=3Dxx:xx:xx:xx:xx:xx", "description": "Virtio network device" }, {"options": "virtio-blk,path,nocache,direct,ro,sectorsize=3Dlogical= /physical", "description": "Virtio block device" }, {"options": "fbuf,rfb,rfb=3DIP:port,w=3Dwidth,h=3Dheigh,vga=3Dvgaco= nf,wait,password=3Dpassword", "description": "Framebuffer device" } ] } } } } Sample code is here: https://reviews.freebsd.org/D15992. At this point it's just an excuse to start a discussion; it needs some macros to make items creation easier, and it needs to have all the other features/devices populated. 1: https://libvirt.org/drvbhyve.html 2: https://github.com/libvirt/libvirt/blob/master/src/bhyve/bhyve_capabilities= =2Ec Roman Bogorodskiy --xgyAXRrhYN0wYx8y Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBAgAGBQJbL26tAAoJEMltX/4IwiJqFP0H/Ar75ephp349XKXEK3ltpkF+ vsO3KLENOH73EkXHixwLN571rq754fyYzUpeB4NT/a3ao8af8BuinZuIoEVEAqBK +4gi/DUXJd2Rabpxc6yy4OYv2o8eHRkUQfhv0J/LBnlGRGj6mbBoBbBNpnyjEwHg rvDvbyHUiCka60XULNZDf2mUOaOmntmok5Ns7kFZfDenin+GlecVaAGKrUwsUfZ4 mHrdD2xJwaumWQV9tmPdscTUeMEu+7/7HSk7ujH96w/upzGsiYQp60tNrspROmNn tt6ei6CB7PUEvKjzMltz1XGAZ+gW3smWWZerfqeWTufGQ6fVXQNYLREKKRf+Kfk= =OXji -----END PGP SIGNATURE----- --xgyAXRrhYN0wYx8y--