From owner-freebsd-virtualization@freebsd.org Tue Jun 26 07:07:18 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 478011015516 for ; Tue, 26 Jun 2018 07:07:18 +0000 (UTC) (envelope-from bogorodskiy@gmail.com) Received: from mail-lj1-x234.google.com (mail-lj1-x234.google.com [IPv6:2a00:1450:4864:20::234]) (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 9A59083261; Tue, 26 Jun 2018 07:07:17 +0000 (UTC) (envelope-from bogorodskiy@gmail.com) Received: by mail-lj1-x234.google.com with SMTP id u6-v6so4774057lju.13; Tue, 26 Jun 2018 00:07:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=LoToIw59l2/kc6cHIrV/2eTR3r76PNq0H52Sx++hHkM=; b=S0Sfpz3d0yl2jiVSw3LYYbH0CNuS1EttrcRqopCYLD75tlPao3ghaQ4sXlEZnOPNOj 5w6cbfhQhkxmiJjhZB9lu+htK+MuaqM3igoUEn+J/OgnBp5j3Kj18IPO7Kli/QB2cTbD 7nBcRUCC/irb0XlMJDR7W8k0XoP5PI8Nw5pbk94DuwFaOHMDjhfYWS9++dicKW0iDnSm GX8K2gxgMm7Q2jEdI7hiMuOi0VcXujFhab2+4jX9a+GUzE4cLWxaE6zgF9hl1hRmnwHT Xg3EG9zpMmDtCpX9ooM5jz3u1r2xAPiJm6HIuxdiD+pEXXl/+j0xuqB9wMoa9qk6oG6y 8a7Q== 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:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=LoToIw59l2/kc6cHIrV/2eTR3r76PNq0H52Sx++hHkM=; b=VgvzfDKFk9qFHHm1o5hQibNs+c1OA4tg2xhLhftgMf0wpnLv55laJOBqsul2Edkqbh aKUvy6YU5114rh51ng+z54lJDQJO9dEnVb0ZInoo9/L45+c8Jqzhb2AuM7Zhyg9Fkt9N YEVsfkdgUciRIflKgn++SVnxuOolVpZ0Q1GGLbmWHpbbi6MGm6cinl6im2tRemwjS+vs xV7+yWq6X/AESA/1o5MogbsNCFCSZI4UyHv4m12uuve2wKZ8PgGgbIWMB9NKK2yXCn8p bsiNT2dNtfR0wXNWtxGEppE08AKAkTdqCTQbp24dY/gz2Pno6en2JqDjCfouaJbuDbAO Gx+w== X-Gm-Message-State: APt69E2bjv3tlWFs8QtXPKZHTtYe782rh48shaEKvwIICVc9gnwS4CFx UY/Mwi/Lu7Pyk3HXTtGe0M7+Xw== X-Google-Smtp-Source: AAOMgpfSwtgR35P5VesPxfRotAUi3ZTh3bdl6vWKL9pYfvUE9ZQ+btYnvTaDUD0m/GwHX5eunDH+iQ== X-Received: by 2002:a2e:8455:: with SMTP id u21-v6mr260267ljh.66.1529996835672; Tue, 26 Jun 2018 00:07:15 -0700 (PDT) Received: from kloomba ([213.147.213.47]) by smtp.gmail.com with ESMTPSA id h197-v6sm187008lfh.13.2018.06.26.00.07.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Jun 2018 00:07:14 -0700 (PDT) Sender: Roman Bogorodskiy Date: Tue, 26 Jun 2018 11:07:08 +0400 From: Roman Bogorodskiy To: araujo@freebsd.org Cc: freebsd-virtualization@freebsd.org Subject: Re: RFC: bhyve supported features reporting Message-ID: <20180626070704.GA1886@kloomba> References: <20180624101301.GB2252@kloomba> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="M9NhX3UHpAaciwkO" Content-Disposition: inline In-Reply-To: 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: Tue, 26 Jun 2018 07:07:18 -0000 --M9NhX3UHpAaciwkO Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Marcelo Araujo wrote: > Hi Roman, >=20 > I think it is doable, my only concern is the complexity and > maintainability, as along the way we will add more devices and would be > nice to have something transparent for those additions or at least > something easy to be extended. Yeah, it's true, I think it would be good to make it more compact somehow. I'll play around with macros to see if I can make it easier to add new items. > As an example this patch that you made: > https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D210111 >=20 > It has much less complexity, and seemed for me to be much easier to > maintain, however doesn't give us a detailed information like the latest > one you are proposing, I'm not sure if we really need so extensive detail= s, > I didn't see any bhyve device changing its options along the past years, > but that doesn't means it would not in the future. Yeah, this patch makes things easier, but doesn't cover all the cases. For example, at some point VNC authentication was added [1] through adding a 'password' keyword, but with an approach like that it's not possible to know if the given bhyve version supports that or not. 1: https://svnweb.freebsd.org/base?view=3Drevision&revision=3D319487 > I do believe if we remove the complexity or at least makes it easy to be > extend, IMHO it is a good idea. >=20 > Best, >=20 >=20 > 2018-06-24 18:13 GMT+08:00 Roman Bogorodskiy : >=20 > > 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": [ > > > > // Probably, it'd be better to make this more > > organized, > > // e.g. instead of a string with all arguments and > > arg/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=3Dvgaconf,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.c > > > > Roman Bogorodskiy > > >=20 >=20 >=20 > --=20 >=20 > --=20 > Marcelo Araujo (__)araujo@FreeBSD.org > \\\'',)http://www.FreeBSD.org \/ \ ^ > Power To Server. .\. /_) Roman Bogorodskiy --M9NhX3UHpAaciwkO Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBAgAGBQJbMeYYAAoJEMltX/4IwiJqyp8H/iRk2CYJE+eVFlIlOoKM9Y0J eRQlx/Bt3+TA/xFKzdX9lKKo/pTsJH9yxgv7oaEW4dTQ2z9Ry0oDUD4S6+u5S10a HPP1UthQAx6prHaqDccTwxDaXRJY0CyaYx5eOwNJYvesQ+MQ7ANtsCDetagLj2D6 rHvWsbJhv30K+YYe7sYcQx+xFT3HmI4qp7FjMZgyUatWZ4oUGtOWzWE/wp5d3e2E /v7ca+oqEPbqRfLlNY2upCg85HTtbI5epTaE2DzmSc9zV7kfEyh+1whnmhHO0FgN iD+d2DbO34kEjWdpvJ+qAuoFpYh5p5o9AD+SGrzipihLRTVcEqJroDGTv89U42U= =+LDG -----END PGP SIGNATURE----- --M9NhX3UHpAaciwkO--