[libvirt] [jenkins-ci PATCH] guests: add more detailed docs on deploying FreeBSD

Daniel P. Berrangé posted 1 patch 4 years, 2 months ago
Failed in applying to current master (apply log)
There is a newer version of this series
guests/README.markdown | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
[libvirt] [jenkins-ci PATCH] guests: add more detailed docs on deploying FreeBSD
Posted by Daniel P. Berrangé 4 years, 2 months ago
Provide instructions on how to download & deploy a working FreeBSD
install that's suitable for CI, as there are several gotchas not
mentioned in the current docs.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 guests/README.markdown | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/guests/README.markdown b/guests/README.markdown
index 7e63540..d76beb1 100644
--- a/guests/README.markdown
+++ b/guests/README.markdown
@@ -137,6 +137,26 @@ FreeBSD
 Installation of FreeBSD guests must be performed manually; alternatively,
 the official qcow2 images can be used to quickly bring up such guests.
 
+  $ MAJOR=11
+  $ MINOR=3
+  $ VER=$MAJOR.$MINOR-RELEASE
+  $ cd /var/lib/libvirt/images
+  $ wget -O libvirt-freebsd-$MAJOR.qcow2.xz \
+      https://download.freebsd.org/ftp/releases/VM-IMAGES/$VER/amd64/Latest/FreeBSD-$VER-amd64.qcow2.xz
+  $ unxz libvirt-freebsd-$MAJOR.qcow2.xz
+  $ virt-install \
+      --import \
+      --name libvirt-freebsd-$MAJOR \
+      --vcpus 2 \
+      --graphics vnc \
+      --noautoconsole \
+      --console pty \
+      --sound none \
+      --rng device=/dev/urandom,model=virtio \
+      --memory 2000 \
+      --os-variant freebsd$MAJOR.$MINOR \
+      --file /var/lib/libvirt/images/libvirt-freebsd-$MAJOR.qcow2
+
 Some manual tweaking will be needed, in particular:
 
 * `/etc/ssh/sshd_config` must contain the `PermitRootLogin yes` directive;
@@ -145,6 +165,17 @@ Some manual tweaking will be needed, in particular:
 
 * the root password must be manually set to "root" (without quotes).
 
+The default qcow2 images are only 4GB in size which will be too small
+to be useful. To enlarge them do
+
+ $ virsh blockresize libvirt-freebsd-$MAJOR \
+     /var/lib/libvirt/images/libvirt-freebsd-$MAJOR.qcow2 20G
+
+Then inside the guest, as root, enlarge the partition & filesystem
+
+ # gpart resize -i 3 -a 4k -s 39845761 vtbd0
+ # service growfs onestart
+
 Once these steps have been performed, FreeBSD guests can be managed just
 like all other guests.
 
-- 
2.23.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [jenkins-ci PATCH] guests: add more detailed docs on deploying FreeBSD
Posted by Andrea Bolognani 4 years, 2 months ago
On Tue, 2020-01-07 at 11:09 +0000, Daniel P. Berrangé wrote:
[...]
> +  $ MAJOR=11
> +  $ MINOR=3

We should use

  MAJOR=12
  MINOR=1

here so that people who are following instructions to the letter get
the latest FreeBSD version.

> +  $ VER=$MAJOR.$MINOR-RELEASE
> +  $ cd /var/lib/libvirt/images

This is not necessary...

> +  $ wget -O libvirt-freebsd-$MAJOR.qcow2.xz \
> +      https://download.freebsd.org/ftp/releases/VM-IMAGES/$VER/amd64/Latest/FreeBSD-$VER-amd64.qcow2.xz
> +  $ unxz libvirt-freebsd-$MAJOR.qcow2.xz

... if you change paths so that they are absolute here.

The advantage of doing so is that you can tell people to run the two
commands above under sudo (otherwise they'd have to run everything
inside a root shell).

> +  $ virt-install \
> +      --import \
> +      --name libvirt-freebsd-$MAJOR \
> +      --vcpus 2 \
> +      --graphics vnc \
> +      --noautoconsole \
> +      --console pty \
> +      --sound none \
> +      --rng device=/dev/urandom,model=virtio \
> +      --memory 2000 \

This should be

  --memory 2048

to be consistent with our default for 'lcitool install'.

> +      --os-variant freebsd$MAJOR.$MINOR \

This should be

  --os-variant freebsd$MAJOR.0

because the machine you're running this on might now have a recent
enough osinfo-db version: my Fedora 31 installation with virt-preview
enabled, for example, doesn't know about FreeBSD 12.1 yet.

> +      --file /var/lib/libvirt/images/libvirt-freebsd-$MAJOR.qcow2

I had never encountered --file before, and seeing how it's
apparently not documented I assume it's an old form for --disk.
Please use --disk instead.

[...]
> +The default qcow2 images are only 4GB in size which will be too small
> +to be useful. To enlarge them do

Please remove the specific size - it might change later. It's enough
to say that they are too small.

> + $ virsh blockresize libvirt-freebsd-$MAJOR \
> +     /var/lib/libvirt/images/libvirt-freebsd-$MAJOR.qcow2 20G

This should be 15G to be consistent with the default used by lcitool.

> +Then inside the guest, as root, enlarge the partition & filesystem
> +
> + # gpart resize -i 3 -a 4k -s 39845761 vtbd0

You can leave out '-s ...' entirely, and gpart will do the right
thing by changing the partition to use as much disk space as
possible. I think dropping '-a 4k' would be safe too.

As an additional tweak, this whole section about resizing the disk
could go right after the one describing how to install the guest,
but I don't really have a strong preference either way.

-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list