Hi,

Together with Maxim Khitrov we have figured out what needs to
be set for XenServer (that's a Citrix product based on Xen) to
"recognize" the OpenBSD VM and let it do things like reboot and
so on.

I'd like to get this documented in the xen(4) man page instead
of referring users to mailing list archives.

There are two things that we can mention:

1) viridian capability, that XenServer comes with enabled by
   default, interferes with hostctl: you need to either disable
   it for your VM (if you have access) or MAKEDEV /dev/pvbus1
   and use that with hostctl(8).

2) to let XenServer management software know that OpenBSD is
   there in full glory we need to set a few XenStore properties
   with hostctl(8).  User needs to do this on every boot, so
   putting them somewhere around /etc/rc.local is necessary.

I've come up with the diff below.  Please let me know if this
makes sense and if we can improve it.

Maxim, can you please double check the script itself.  Are all
these values necessary?  I've changed a few things including
the BuildVersion value.

Thanks.

----- Forwarded message from Maxim Khitrov <m...@mxcrypt.com> -----

Date: Mon, 17 Jul 2017 17:07:02 -0400
From: Maxim Khitrov <m...@mxcrypt.com>
To: Mike Belopuhov <m...@belopuhov.com>
Cc: Dinar Talypov <t.dina...@gmail.com>, tech@openbsd.org
Subject: Re: [patch] fake pv drivers installation on xen

On Mon, Jul 17, 2017 at 3:40 PM, Mike Belopuhov <m...@belopuhov.com> wrote:
> On Mon, Jul 17, 2017 at 14:32 -0400, Maxim Khitrov wrote:
>> On Wed, Jan 18, 2017 at 2:16 PM, Dinar Talypov <t.dina...@gmail.com> wrote:
>> > I use Xenserver 7.0 with xencenter management console.
>> > without it doesn't allow shutdown or reboot.
>> > Anyway I'll try with hostctl.
>> >
>> > Thanks.
>>
>> Were you able to get this working with hostctl? I'm running OpenBSD
>> 6.1 amd64 on XenServer 7.0. When I run any hostctl command, such as
>> `hostctl device/vif/0/mac`, I get the following error:
>>
>> hostctl: ioctl: Device not configured
>>
>> During boot, I see these messages:
>>
>> pvbus0 at mainbus0: Hyper-V 0.0, Xen 4.6
>> xen0 at pvbus0: features 0x2705, 32 grant table frames, event channel 3
>> xbf0 at xen0 backend 0 channel 8: disk
>>
>
> You need to disable viridian compatibility in your Xenserver.
>
>> Running `hostctl -t` returns "/dev/pvbus0: Hyper-V"
>>
>
> That's because Xenserver announces Hyper-V compatibility layer
> (called viridian) before Xen for whatever reason.  You need to
> do "cd /dev; ./MAKEDEV pvbus1" and then use "hostctl -f /dev/pvbus1"
> with your commands (I assume -- never tried a Xenserver myself).
>
>> Any tips on getting hostctl to work?
>
> See above.  The easiest is probably just to disable viridian :)

Disabling viridian worked, thanks! For anyone else interested in doing
this, run the following command on your XenServer host:

xe vm-param-set uuid=<VM_UUID> platform:viridian=false

After that, you can add these commands to /etc/rc.local:

ostype=$(sysctl -n kern.ostype)
osrelease=$(sysctl -n kern.osrelease)

# PV driver version
hostctl attr/PVAddons/MajorVersion 6
hostctl attr/PVAddons/MinorVersion 2
hostctl attr/PVAddons/MicroVersion 0
hostctl attr/PVAddons/BuildVersion 76888
hostctl attr/PVAddons/Installed 1

# OS version
hostctl data/os_name "$ostype $osrelease"
hostctl data/os_uname $osrelease
hostctl data/os_distro $ostype

# Update XenStore
hostctl data/updated 1

-Max

----- End forwarded message -----


Index: xen.4
===================================================================
RCS file: /home/cvs/src/share/man/man4/xen.4,v
retrieving revision 1.1
diff -u -p -r1.1 xen.4
--- xen.4       9 Dec 2015 00:26:39 -0000       1.1
+++ xen.4       21 Jul 2017 13:00:52 -0000
@@ -28,6 +28,51 @@ driver performs HVM domU guest initializ
 virtual Xen interrupts, access to the XenStore configuration storage as
 well as a device probing facility for paravirtualized devices such as
 disk and network interfaces.
+.Sh CAVEATS
+When running under XenServer, it's useful to let it know that the guest
+has finished initializing by setting a few XenStore properties with
+.Xr hostctl 8
+in the
+.Pa /etc/rc.local
+script.
+.Bd -literal -offset indent
+ostype=$(sysctl -n kern.ostype)
+osrelease=$(sysctl -n kern.osrelease)
+osbuild=$(sysctl -n kern.osversion)
+osvermaj=${osrelease%\.*}
+osvermin=${osrelease#*\.}
+
+# PV driver version
+hostctl attr/PVAddons/MajorVersion $osvermaj
+hostctl attr/PVAddons/MinorVersion $osvermin
+hostctl attr/PVAddons/MicroVersion 0
+hostctl attr/PVAddons/BuildVersion $osbuild
+hostctl attr/PVAddons/Installed 1
+
+# OS version
+hostctl data/os_name "$ostype $osrelease"
+hostctl data/os_uname $osrelease
+hostctl data/os_distro $ostype
+
+# Update XenStore
+hostctl data/updated 1
+.Ed
+.Pp
+Please note, that XenStore is capable of advertising a Hyper-V compatibility
+layer called
+.Dq Viridian
+that may require an additional
+.Xr pvbus 4
+device node to be crated in
+.Pa /dev
+with
+.Xr MAKEDEV 8
+and all aforementioned invocations of
+.Xr hostctl 8
+to be amended with an
+.Fl f Ar /dev/pvbus1
+command line option.
+Viridian can also be disabled in the virtual machine configuration.
 .Sh SEE ALSO
 .Xr autoconf 4 ,
 .Xr intro 4 ,

Reply via email to