From 1d608fac59bd29c1ead8d4bee77ca5dbdfe9fdd6 Mon Sep 17 00:00:00 2001 From: Dalton Hubble Date: Wed, 4 May 2016 00:50:37 -0700 Subject: [PATCH] scripts/libvirt: Add UEFI/GRUB VM setup and notes --- Documentation/{dev => }/grub.md | 14 ++++++++------ README.md | 2 +- scripts/README.md | 13 +++++++------ scripts/libvirt | 9 +++++++++ 4 files changed, 25 insertions(+), 13 deletions(-) rename Documentation/{dev => }/grub.md (69%) diff --git a/Documentation/dev/grub.md b/Documentation/grub.md similarity index 69% rename from Documentation/dev/grub.md rename to Documentation/grub.md index 18289d0a..58c2f64d 100644 --- a/Documentation/dev/grub.md +++ b/Documentation/grub.md @@ -1,7 +1,7 @@ # GRUB2 Netboot -GRUB netboot support is experimental. +Use GRUB to network boot UEFI hardware. ## Requirements @@ -9,9 +9,11 @@ For local development, install the dependencies for libvirt with UEFI. * [UEFI with QEMU](https://fedoraproject.org/wiki/Using_UEFI_with_QEMU) +Ensure that you've gone through the [bootcfg with rkt](getting-started-rkt.md) and [bootcfg](bootcfg.md) guides and understand the basics. + ## Containers -Run `bootcfg` with rkt according to [Getting Started with rkt](../getting-started-with-rkt), but mount the [grub](../../examples/groups/grub) group example. +Run `bootcfg` with rkt, but mount the [grub](../examples/groups/grub) group example. ## Network @@ -25,16 +27,16 @@ Run the `coreos.com/dnsmasq` ACI with rkt. ## Client VM -Create a VM with an e1000 or virtio network device. +Create UEFI VM nodes which have known hardware attributes. - sudo virt-install --name uefi-test --pxe --boot=uefi,network --disk pool=default,size=4 --network=bridge=metal0,model=e1000 --memory=1024 --vcpus=1 --os-type=linux --noautoconsole + sudo ./scripts/libvirt create-uefi ## Docker -If you use Docker, run `bootcfg` according to [Getting Started with Docker](../getting-started-with-docker), but mount the [grub](../../examples/groups/grub) group example. The start the `coreos/dnsmasq` Docker image, which bundles a `grub.efi`. +If you use Docker, run `bootcfg` according to [bootcfg with Docker](getting-started-docker.md), but mount the [grub](../examples/groups/grub) group example. Then start the `coreos/dnsmasq` Docker image, which bundles a `grub.efi`. sudo docker run --rm --cap-add=NET_ADMIN quay.io/coreos/dnsmasq -d -q --dhcp-range=172.17.0.43,172.17.0.99 --enable-tftp --tftp-root=/var/lib/tftpboot --dhcp-match=set:efi-bc,option:client-arch,7 --dhcp-boot=tag:efi-bc,grub.efi --dhcp-userclass=set:grub,GRUB2 --dhcp-boot=tag:grub,"(http;bootcfg.foo:8080)/grub","172.17.0.2" --log-queries --log-dhcp --dhcp-option=3,172.17.0.1 --dhcp-userclass=set:ipxe,iPXE --dhcp-boot=tag:pxe,undionly.kpxe --dhcp-boot=tag:ipxe,http://bootcfg.foo:8080/boot.ipxe --address=/bootcfg.foo/172.17.0.2 -Create a VM to verify the machine netboots. +Create a VM to verify the machine network boots. sudo virt-install --name uefi-test --pxe --boot=uefi,network --disk pool=default,size=4 --network=bridge=docker0,model=e1000 --memory=1024 --vcpus=1 --os-type=linux --noautoconsole \ No newline at end of file diff --git a/README.md b/README.md index 1bbe8058..3392582d 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,6 @@ The [examples](examples) show how to network boot and provision higher-order Cor * Multi-node etcd cluster * Network boot or Install to Disk * Multi-stage CoreOS installs -* [GRUB Netboot](Documentation/dev/grub.md) CoreOS +* [GRUB Netboot](Documentation/grub.md) CoreOS * iPXE Boot CoreOS with a root fs * iPXE Boot CoreOS diff --git a/scripts/README.md b/scripts/README.md index a33b73c9..5226e69e 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -27,12 +27,13 @@ Create libvirt VM nodes which are configured to boot from the network. The `scri USAGE: libvirt Commands: create-docker create libvirt nodes on the docker0 bridge - create-rkt create libvirt nodes on a rkt CNI metal0 bridge - start start the libvirt nodes - reboot reboot the libvirt nodes - shutdown shutdown the libvirt nodes - poweroff poweroff the libvirt nodes - destroy destroy the libvirt nodes + create-rkt create libvirt nodes on a rkt CNI metal0 bridge + create-uefi create UEFI libvirt nodes on the rkt CNI metal0 bridge + start start the libvirt nodes + reboot reboot the libvirt nodes + shutdown shutdown the libvirt nodes + poweroff poweroff the libvirt nodes + destroy destroy the libvirt nodes ## k8s-certgen diff --git a/scripts/libvirt b/scripts/libvirt index 12c34c8d..9e3b305c 100755 --- a/scripts/libvirt +++ b/scripts/libvirt @@ -10,6 +10,7 @@ function main { case "$1" in "create-docker") create_docker;; "create-rkt") create_rkt;; + "create-uefi") create_uefi;; "start") start;; "reboot") reboot;; "shutdown") shutdown;; @@ -27,6 +28,7 @@ function usage { echo "Commands:" echo -e "\tcreate-docker\tcreate libvirt nodes on the docker0 bridge" echo -e "\tcreate-rkt\tcreate libvirt nodes on a rkt CNI metal0 bridge" + echo -e "\tcreate-uefi\tcreate UEFI libvirt nodes on the rkt CNI metal0 bridge" echo -e "\tstart\t\tstart the libvirt nodes" echo -e "\treboot\t\treboot the libvirt nodes" echo -e "\tshutdown\tshutdown the libvirt nodes" @@ -48,6 +50,13 @@ function create_rkt { virt-install --name node4 -u 4ed46e8e-db69-471e-b874-0990dd65649d --pxe --disk pool=default,size=6 --boot=hd,network --network=bridge:metal0 --memory=1024 --vcpus=1 --os-type=linux --noautoconsole } +function create_uefi { + virt-install --name node1 -u 16e7d8a7-bfa9-428b-9117-363341bb330b --pxe --disk pool=default,size=6 --boot=uefi,network --network=bridge=metal0,model=e1000 --memory=1024 --vcpus=1 --os-type=linux --noautoconsole + virt-install --name node2 -u 264cd073-ca62-44b3-98c0-50aad5b5f819 --pxe --disk pool=default,size=6 --boot=uefi,network --network=bridge=metal0,model=e1000 --memory=1024 --vcpus=1 --os-type=linux --noautoconsole + virt-install --name node3 -u 39d2e747-2648-4d68-ae92-bbc70b245055 --pxe --disk pool=default,size=6 --boot=uefi,network --network=bridge=metal0,model=e1000 --memory=1024 --vcpus=1 --os-type=linux --noautoconsole + virt-install --name node4 -u 4ed46e8e-db69-471e-b874-0990dd65649d --pxe --disk pool=default,size=6 --boot=uefi,network --network=bridge=metal0,model=e1000 --memory=1024 --vcpus=1 --os-type=linux --noautoconsole +} + nodes=(node1 node2 node3 node4) function start {