On Wed, Apr 25, 2018 at 04:45:02PM +0200, j@xxxxxxxxx wrote: > Hi, > > OpenBSD lacks /proc, so some of the detection mechanisms in > virt-what don't work there. However sysctl is available and could be > used instead in those cases. > > Attached is a patch that adds the functionality and uses it to > detect a SmartOS hypervisor. Sorry for the delay, I have now pushed this. Rich. > Cheers, > Jasper > From 2da054ad59f024c749eeb3ef1ff4404dd791589f Mon Sep 17 00:00:00 2001 > From: Jasper Lievisse Adriaanse <jasper@xxxxxxxxx> > Date: Wed, 25 Apr 2018 16:41:32 +0200 > Subject: [PATCH] Allow using sysctl, for example when /proc isn't available > > --- > virt-what.in | 13 +++++++++++++ > 1 file changed, 13 insertions(+) > > diff --git a/virt-what.in b/virt-what.in > index 2011ff4..d037a99 100644 > --- a/virt-what.in > +++ b/virt-what.in > @@ -38,6 +38,13 @@ have_cpuinfo () { > test -e "${root}/proc/cpuinfo" > } > > +use_sysctl() { > + # Lacking /proc, on some systems sysctl can be used instead. > + OS=$(uname) || fail "failed to get operating system name" > + > + [ "$OS" == "OpenBSD" ] > +} > + > fail () { > echo "virt-what: $1" >&2 > exit 1 > @@ -304,6 +311,12 @@ if ! "$skip_qemu_kvm"; then > # We are running as a spapr KVM guest on ppc64 > echo kvm > skip_lkvm=true > + elif use_sysctl; then > + # SmartOS KVM > + product=$(sysctl -n hw.product) > + if echo "$product" | grep -q 'SmartDC HVM'; then > + echo kvm > + fi > else > # This is known to fail for qemu with the explicit -cpu > # option, since /proc/cpuinfo will not contain the QEMU > -- > 2.16.2 > > _______________________________________________ > virt-tools-list mailing list > virt-tools-list@xxxxxxxxxx > https://www.redhat.com/mailman/listinfo/virt-tools-list -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org _______________________________________________ virt-tools-list mailing list virt-tools-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/virt-tools-list