Re: any primer on running bhyve guests sharing disk with host ?

2015-01-06 Thread John Baldwin
On 1/3/15 1:43 PM, Craig Rodrigues wrote:
 On Sat, Jan 3, 2015 at 8:15 AM, Luigi Rizzo ri...@iet.unipi.it wrote:
 
 Hi,
 in order to do some kernel testing, I would like to run bhyve guests
 using (through NFS, probably) the host's file system.
 diskless(8) is probably one way to go, i was wondering if
 someone has instructions for that.
 Specifically:
 - how to bhyveload a kernel (rather than the full disk image);
   as an alternative, given a kernel, something to build an image
   that can be passed to bhyveload

 - how to pass the necessary config (rootpath) to the client
   without having to rely on a specialized dhcp server

 I used to be familiar with diskless configs, so i can probably sort
 out the server side myself.


 Neel already covered -h with bhyveload which you can also use with -H
to vmrun.sh, though the other way I do this is to NFS export my work
tree from the host to the guest so I can run kgdb on the host but do the
build / install in the guest itself. 

 I don't think there is a way to do exactly what you want.
 I would recommend doing the following:
 
 (1)  Enable bvmdebug in your kernel config:
 https://wiki.freebsd.org/BHyVe/gdb
   This allows you to do kgdb remote debugging into a bhyve VM.

At this point it is probably simpler to use the serial port instead.  I
have hacked up vmrun.sh locally to always create a /dev/nmdmvmname2B
device hooked up to com2 and to add 0x80 to the flags for uart1 in
device.hints in all my VMs.  You can then use kgdb from the host and
'target remote /dev/nmdmvmname2A'.

--- /usr/share/examples/bhyve/vmrun.sh  2014-11-20 18:38:34.0 -0500
+++ /home/john/bhyve/vmrun.sh   2015-01-06 09:54:47.0 -0500
@@ -230,6 +230,9 @@
nextslot=$(($nextslot + 1))
i=$(($i + 1))
done
+   if kldstat -qm nmdm; then
+   devargs=$devargs -l com2,/dev/nmdm${vmname}2B
+   fi

${FBSDRUN} -c ${cpus} -m ${memsize} ${apic_opt} -A -H -P\
-g ${gdbport}   \


-- 
John Baldwin
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: any primer on running bhyve guests sharing disk with host ?

2015-01-06 Thread Julian Elischer

On 1/6/15 10:55 PM, John Baldwin wrote:

On 1/3/15 1:43 PM, Craig Rodrigues wrote:

On Sat, Jan 3, 2015 at 8:15 AM, Luigi Rizzo ri...@iet.unipi.it wrote:


Hi,
in order to do some kernel testing, I would like to run bhyve guests
using (through NFS, probably) the host's file system.
diskless(8) is probably one way to go, i was wondering if
someone has instructions for that.
Specifically:
- how to bhyveload a kernel (rather than the full disk image);
   as an alternative, given a kernel, something to build an image
   that can be passed to bhyveload

- how to pass the necessary config (rootpath) to the client
   without having to rely on a specialized dhcp server

I used to be familiar with diskless configs, so i can probably sort
out the server side myself.


 Neel already covered -h with bhyveload which you can also use with -H
to vmrun.sh, though the other way I do this is to NFS export my work
tree from the host to the guest so I can run kgdb on the host but do the
build / install in the guest itself. 


I don't think there is a way to do exactly what you want.
I would recommend doing the following:

(1)  Enable bvmdebug in your kernel config:
https://wiki.freebsd.org/BHyVe/gdb
   This allows you to do kgdb remote debugging into a bhyve VM.

At this point it is probably simpler to use the serial port instead.  I
have hacked up vmrun.sh locally to always create a /dev/nmdmvmname2B
device hooked up to com2 and to add 0x80 to the flags for uart1 in
device.hints in all my VMs.  You can then use kgdb from the host and
'target remote /dev/nmdmvmname2A'.


I've found the main good part of using bvmdebug is the ability to 
attach to it from a different machine using tcp.
I think bhyve should offer the opportunity to make ALL serial ports or 
similar be attached to sockets..


--- /usr/share/examples/bhyve/vmrun.sh  2014-11-20 18:38:34.0 -0500
+++ /home/john/bhyve/vmrun.sh   2015-01-06 09:54:47.0 -0500
@@ -230,6 +230,9 @@
nextslot=$(($nextslot + 1))
i=$(($i + 1))
done
+   if kldstat -qm nmdm; then
+   devargs=$devargs -l com2,/dev/nmdm${vmname}2B
+   fi

${FBSDRUN} -c ${cpus} -m ${memsize} ${apic_opt} -A -H -P\
-g ${gdbport}   \




___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: any primer on running bhyve guests sharing disk with host ?

2015-01-04 Thread Luigi Rizzo
On Sat, Jan 03, 2015 at 11:00:13AM -0800, Neel Natu wrote:
 Hi Luigi,
 
 On Sat, Jan 3, 2015 at 8:15 AM, Luigi Rizzo ri...@iet.unipi.it wrote:
  Hi,
  in order to do some kernel testing, I would like to run bhyve guests
  using (through NFS, probably) the host's file system.
  diskless(8) is probably one way to go, i was wondering if
  someone has instructions for that.
  Specifically:
  - how to bhyveload a kernel (rather than the full disk image);
as an alternative, given a kernel, something to build an image
that can be passed to bhyveload
 
 
 You can use the -h option to bhyveload(8) to do this.

thank you, i have it up and running now.
For the records this is what I am using:

sudo bhyveload -m 512 -h /tmp/diskless vm1

and in /tmp/diskless i have the following:
boot/
loader.rc:
set hint.uart.0.at=isa
set hint.uart.0.port=0x3F8
set hint.uart.0.flags=0x10
set vfs.root.mountfrom=nfs:192.168.1.126:/
boot /boot/kernel.diskless
kernel.diskless

The 'set' commands in loader.rc are enough to have the serial
console detected and the root path.
They could be given through -e options to bhyveload so in the end
you only need to put a suitable kernel into /some/place/boot/kernel/kernel
and call bhyveload -h /some/place -e hint.uart.0.at=isa ...

Current issues which I am investigating:
- for some reason the guest sends packets with invalid UDP checksums
  over vtnet0, which can be solved by removing (in if_vtnet.c)
  TXCSUM from if_capenable.

- when using NFS root there seems to be no way to avoid the dhcp phase,
  which is unfortunate because it adds unnecessary delays to the boot.
  This can be probably fixed easily because there are already kenv
  variables (boot.netif.name and friends) for the purpose.

cheers
luigi
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


any primer on running bhyve guests sharing disk with host ?

2015-01-03 Thread Luigi Rizzo
Hi,
in order to do some kernel testing, I would like to run bhyve guests
using (through NFS, probably) the host's file system.
diskless(8) is probably one way to go, i was wondering if
someone has instructions for that.
Specifically:
- how to bhyveload a kernel (rather than the full disk image);
  as an alternative, given a kernel, something to build an image
  that can be passed to bhyveload

- how to pass the necessary config (rootpath) to the client
  without having to rely on a specialized dhcp server

I used to be familiar with diskless configs, so i can probably sort
out the server side myself.

cheers
luigi
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: any primer on running bhyve guests sharing disk with host ?

2015-01-03 Thread Slawa Olhovchenkov
On Sat, Jan 03, 2015 at 05:15:11PM +0100, Luigi Rizzo wrote:

 Hi,
 in order to do some kernel testing, I would like to run bhyve guests
 using (through NFS, probably) the host's file system.
 diskless(8) is probably one way to go, i was wondering if
 someone has instructions for that.
 Specifically:
 - how to bhyveload a kernel (rather than the full disk image);
   as an alternative, given a kernel, something to build an image
   that can be passed to bhyveload
 
 - how to pass the necessary config (rootpath) to the client
   without having to rely on a specialized dhcp server
 
 I used to be familiar with diskless configs, so i can probably sort
 out the server side myself.

May be I missunderstand you, but diskless client-specific config relay
on client IP address (ex: /conf/ip/1.2.3.4/...).

Also, diskless boot relay on BIOS network support (by PXE, for
example), with working NIC, assigned IP address and etc.
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: any primer on running bhyve guests sharing disk with host ?

2015-01-03 Thread Craig Rodrigues
On Sat, Jan 3, 2015 at 8:15 AM, Luigi Rizzo ri...@iet.unipi.it wrote:

 Hi,
 in order to do some kernel testing, I would like to run bhyve guests
 using (through NFS, probably) the host's file system.
 diskless(8) is probably one way to go, i was wondering if
 someone has instructions for that.
 Specifically:
 - how to bhyveload a kernel (rather than the full disk image);
   as an alternative, given a kernel, something to build an image
   that can be passed to bhyveload

 - how to pass the necessary config (rootpath) to the client
   without having to rely on a specialized dhcp server

 I used to be familiar with diskless configs, so i can probably sort
 out the server side myself.



I don't think there is a way to do exactly what you want.
I would recommend doing the following:

(1)  Enable bvmdebug in your kernel config:
https://wiki.freebsd.org/BHyVe/gdb
  This allows you to do kgdb remote debugging into a bhyve VM.
(2)  Build your disk image with makefs.  You can use this script as an
example:

https://github.com/freebsd/freebsd-ci/tree/master/scripts/build/build-ufs-image.sh

If you still want the bhyve image to use the host's root file system, you
can start with the information here:
https://www.freebsd.org/doc/handbook/network-diskless.html
since you won't be using PXE, you will need to populate these variables in
loader.conf in your disk image:

http://svnweb.freebsd.org/base/head/sys/nfs/nfs_diskless.c?revision=273174view=markup#l146

--
Craig
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: any primer on running bhyve guests sharing disk with host ?

2015-01-03 Thread Neel Natu
Hi Luigi,

On Sat, Jan 3, 2015 at 8:15 AM, Luigi Rizzo ri...@iet.unipi.it wrote:
 Hi,
 in order to do some kernel testing, I would like to run bhyve guests
 using (through NFS, probably) the host's file system.
 diskless(8) is probably one way to go, i was wondering if
 someone has instructions for that.
 Specifically:
 - how to bhyveload a kernel (rather than the full disk image);
   as an alternative, given a kernel, something to build an image
   that can be passed to bhyveload


You can use the -h option to bhyveload(8) to do this.

For e.g., bhyveload -h / vmx will load the kernel from
/boot/kernel/kernel and use the loader configuration from /boot.

 - how to pass the necessary config (rootpath) to the client
   without having to rely on a specialized dhcp server


You can set environment variables using the -e option:
bhyveload -e boot.nfsroot.server=1.2.3.4 -e
boot.nfsroot.path=/exports/guest1

There are a number of other environment variables set by the PXE
loader - see sys/boot/i386/libi386/pxe.c. I haven't done this myself
therefore not sure if this would work.

best
Neel

 I used to be familiar with diskless configs, so i can probably sort
 out the server side myself.

 cheers
 luigi
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org