From f6aec67eb870a0683d4b191015800d5aaec0cdcd Mon Sep 17 00:00:00 2001 From: Dalton Hubble Date: Sat, 17 Sep 2016 02:29:05 -0700 Subject: [PATCH] scripts: Add libvirt create subcommand and --os-variant * Add `scripts/libvirt create` subcommand for rkt setups * Add --os-variant=generic to remove nag messages to specify * Rename places QEMU/KVM VMs were called libvirt VMs --- Documentation/getting-started-docker.md | 4 ++-- Documentation/getting-started-rkt.md | 6 ++--- README.md | 4 ++-- scripts/README.md | 19 ++++++++-------- scripts/libvirt | 29 ++++++++++++++----------- 5 files changed, 33 insertions(+), 29 deletions(-) diff --git a/Documentation/getting-started-docker.md b/Documentation/getting-started-docker.md index 6425b56c..bb414e4c 100644 --- a/Documentation/getting-started-docker.md +++ b/Documentation/getting-started-docker.md @@ -1,7 +1,7 @@ # Getting Started with Docker -In this tutorial, we'll run `bootcfg` on your Linux machine with Docker to network boot and provision a cluster of CoreOS machines locally. You'll be able to create Kubernetes clustes, etcd clusters, and test network setups. +In this tutorial, we'll run `bootcfg` on your Linux machine with Docker to network boot and provision a cluster of QEMU/KVM CoreOS machines locally. You'll be able to create Kubernetes clustes, etcd clusters, and test network setups. *Note*: To provision physical machines, see [network setup](network-setup.md) and [deployment](deployment.md). @@ -53,7 +53,7 @@ In this case, dnsmasq runs a DHCP server allocating IPs to VMs between 172.17.0. ## Client VMs -Create VM nodes which have known hardware attributes. The nodes will be attached to the `docker0` bridge where Docker's containers run. +Create QEMU/KVM VMs which have known hardware attributes. The nodes will be attached to the `docker0` bridge, where Docker's containers run. sudo ./scripts/libvirt create-docker sudo virt-manager diff --git a/Documentation/getting-started-rkt.md b/Documentation/getting-started-rkt.md index 7c0df5bd..0946b9b0 100644 --- a/Documentation/getting-started-rkt.md +++ b/Documentation/getting-started-rkt.md @@ -1,7 +1,7 @@ # Getting Started with rkt -In this tutorial, we'll run `bootcfg` on your Linux machine with `rkt` and `CNI` to network boot and provision a cluster of CoreOS machines locally. You'll be able to create Kubernetes clustes, etcd clusters, and test network setups. +In this tutorial, we'll run `bootcfg` on your Linux machine with `rkt` and `CNI` to network boot and provision a cluster of QEMU/KVM CoreOS machines locally. You'll be able to create Kubernetes clustes, etcd clusters, and test network setups. *Note*: To provision physical machines, see [network setup](network-setup.md) and [deployment](deployment.md). @@ -91,9 +91,9 @@ In this case, dnsmasq runs a DHCP server allocating IPs to VMs between 172.15.0. ## Client VMs -Create VM nodes which have known hardware attributes. The nodes will be attached to the `metal0` bridge where your pods run. +Create QEMU/KVM VMs which have known hardware attributes. The nodes will be attached to the `metal0` bridge, where your pods run. - sudo ./scripts/libvirt create-rkt + sudo ./scripts/libvirt create sudo virt-manager You can use `virt-manager` to watch the console and reboot VM machines with diff --git a/README.md b/README.md index 9a9602a8..276238bb 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ Guides and a service for network booting and provisioning CoreOS clusters on vir * Config Templates * [Ignition](Documentation/ignition.md) * [Cloud-Config](Documentation/cloud-config.md) -* Tutorials (qemu/kvm/libvirt) +* Tutorials (QEMU/KVM/libvirt) * [bootcfg with rkt](Documentation/getting-started-rkt.md) * [bootcfg with Docker](Documentation/getting-started-docker.md) * [Configuration](Documentation/config.md) @@ -44,7 +44,7 @@ Guides and a service for network booting and provisioning CoreOS clusters on vir ### Examples -The [examples](examples) network boot and provision CoreOS clusters. Network boot [libvirt](scripts/README.md#libvirt) VMs to try the examples on your Linux laptop. +The [examples](examples) network boot and provision CoreOS clusters. Network boot [QEMU/KVM](scripts/README.md#libvirt) VMs to try the examples on your Linux laptop. * Multi-node [Kubernetes cluster](Documentation/kubernetes.md) * Multi-node Kubernetes cluster with rkt container runtime (i.e. rktnetes) diff --git a/scripts/README.md b/scripts/README.md index 9f4da77a..e725ed4a 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -23,19 +23,20 @@ This will create: ## libvirt -Create libvirt VM nodes which are configured to boot from the network. The `scripts/libvirt` script will create virtual machines on the `metal0` or `docker0` bridge with known hardware attributes (e.g. UUID, MAC address). +Create QEMU/KVM VMs which are configured to boot from the network. The `scripts/libvirt` script will create virtual machines on the `metal0` or `docker0` bridge with known hardware attributes (e.g. UUID, MAC address). $ sudo ./scripts/libvirt USAGE: libvirt Commands: - create-docker create libvirt nodes on the docker0 bridge - 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 + create create QEMU/KVM nodes on a rkt CNI metal0 bridge + create-rkt create QEMU/KVM nodes on a rkt CNI metal0 bridge + create-docker create QEMU/KVM nodes on the docker0 bridge + create-uefi create UEFI QEMU/KVM nodes on the rkt CNI metal0 bridge + start start the QEMU/KVM nodes + reboot reboot the QEMU/KVM nodes + shutdown shutdown the QEMU/KVM nodes + poweroff poweroff the QEMU/KVM nodes + destroy destroy the QEMU/KVM nodes ## k8s-certgen diff --git a/scripts/libvirt b/scripts/libvirt index 00b14225..850c9ea3 100755 --- a/scripts/libvirt +++ b/scripts/libvirt @@ -1,17 +1,18 @@ #!/bin/bash # Manage VM nodes which have a specific set of hardware attributes. +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +source "${DIR}/common.sh" + if [ "$EUID" -ne 0 ] then echo "Please run as root" exit fi -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -source "${DIR}/common.sh" - function main { case "$1" in + "create") create_rkt;; "create-docker") create_docker;; "create-rkt") create_rkt;; "create-uefi") create_uefi;; @@ -30,16 +31,18 @@ function main { function usage { echo "USAGE: ${0##*/} " 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" - echo -e "\tpoweroff\tpoweroff the libvirt nodes" - echo -e "\tdestroy\t\tdestroy the libvirt nodes" + echo -e "\tcreate\t\tcreate QEMU/KVM nodes on a rkt CNI metal0 bridge" + echo -e "\tcreate-rkt\tcreate QEMU/KVM nodes on a rkt CNI metal0 bridge" + echo -e "\tcreate-docker\tcreate QEMU/KVM nodes on the docker0 bridge" + echo -e "\tcreate-uefi\tcreate UEFI QEMU/KVM nodes on the rkt CNI metal0 bridge" + echo -e "\tstart\t\tstart the QEMU/KVM nodes" + echo -e "\treboot\t\treboot the QEMU/KVM nodes" + echo -e "\tshutdown\tshutdown the QEMU/KVM nodes" + echo -e "\tpoweroff\tpoweroff the QEMU/KVM nodes" + echo -e "\tdestroy\t\tdestroy the QEMU/KVM nodes" } -COMMON_VIRT_OPTS="--memory=1024 --vcpus=1 --os-type=linux --noautoconsole --pxe --disk pool=default,size=6 " + +COMMON_VIRT_OPTS="--memory=1024 --vcpus=1 --pxe --disk pool=default,size=6 --os-type=linux --os-variant=generic --noautoconsole" function create_docker { virt-install --name $NODE1_NAME --network=bridge:docker0,mac=$NODE1_MAC $COMMON_VIRT_OPTS --boot=hd,network