Re: Problem with ZFS userboot changes r262331 and VM with mixed partitions

2014-03-05 Thread Kurt Lidl

Hi,

I encountered problems with the new changes to userboot
to boot ZFS.

About a month ago, I created a FreeBSD 10 VM with the following
layout:

=>   34  419430333  md0  GPT  (200G)
 341281  freebsd-boot  (64K)
16220971522  freebsd-ufs  (1.0G)
209731483886083  freebsd-swap  (4.0G)
   10485922  408944  freebsd-zfs  (195G)
  419430366  1   - free -  (512B)


The FreeBSD root file system is on p4, which is ZFS.
On the root file system, I have a symlink:

/boot -> /bootdir

/bootdir mounts p2 which is UFS.

So in this scenario, the kernel lives on UFS.
When I did this about a month ago, during the BHyve boot process,

(1)  userboot loaded the kernel from p2 (UFS)
(2)  The kernel booted, loaded zfs.ko, and then proceeded to mount p4 where
  the root file system lived (ZFS)

After r262331, when I try to boot the BHyve VM

(1)  I can see p4 from the loader prompt
(2)  The kernel doesn't load
(3)  If I try to load /boot/kernel/kernel from the loader prompt, I get:

ZFS: i/o error - all block copies unavailable

I don't fully understand all this logic.  Is there a bug that can be fixed here?


I ran into this same problem a couple of weeks ago when I first played
with the ZFS boot support in userboot.so.

The following set of operations on the hypervisor can be used to add
bootable support to your zfs installation.

(I don't know what the name of your zpool is on the emulated host.
If the name of that zpool is the same as the zpool on your hypervisor
host, you might have to go at this a different way.)  I have taken
to naming the zpool for the any clients to be the same as the name
of the virtual machine, so I can easily mount it on the host running
the hypervisor and fiddle with it.

For the purposes of this example, my virtual machine is called "vm0".
The zpool for that host lives in a zpool called "zdata" on my
hypervisor machine.  In my case, my /boot was a symlink that
pointed to /bootdir/boot, so you might need to adjust the
following slightly.

zfs import -f -R /mnt vm0

fsck_ufs /dev/zvol/zdata/vm0p2
mount /dev/zvol/zdata/vm0p2 /mnt/bootdir
cd /mnt
chflags -h nosunlink boot
rm boot
cp -R bootdir/* .
umount /mnt/bootdir
cd /
zpool export vm0

Good luck.

-Kurt

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


bhyve: allow specifiying tty by fd

2014-03-05 Thread Roman Bogorodskiy
Hi,

Currently bhyve(8) allows to specify either stdio or device path as a
TTY device. However, it could be useful to specify a TTY device by file
descriptor, e.g. when bhyve is being executed in an automated way by 
other application, so a result of openpty(3) could be passed to it.

Attached a poc patch for that. It allows to specify fd this way:

bhyve   -s 31,lpc -l com1,fd=19 vm0

Roman Bogorodskiy
Index: bhyve.8
===
--- bhyve.8	(revision 262780)
+++ bhyve.8	(working copy)
@@ -184,6 +184,8 @@
 the bhyve process.
 .It Pa /dev/xxx
 Use the host TTY device for serial port I/O.
+.It Li fd=N
+Use a specified file descriptor of the TTY device.
 .El
 .Pp
 Pass-through devices:
Index: uart_emul.c
===
--- uart_emul.c	(revision 262780)
+++ uart_emul.c	(working copy)
@@ -585,7 +585,11 @@
 
 	retval = -1;
 
-	fd = open(opts, O_RDWR);
+	if (!strncmp(opts, "fd=", 3)) {
+		fd = atoi(opts+3);
+	} else {
+		fd = open(opts, O_RDWR);
+	}
 	if (fd > 0 && isatty(fd)) {
 		sc->tty.fd = fd;
 		sc->tty.opened = true;
___
freebsd-virtualization@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
To unsubscribe, send any mail to 
"freebsd-virtualization-unsubscr...@freebsd.org"