From af24107ac3d8ccb3c433a41d2e3002b6eee6dfcd Mon Sep 17 00:00:00 2001 From: Yolanda Robla Mota Date: Fri, 7 Oct 2016 17:17:17 +0200 Subject: [PATCH] Add instructions to deploy bifrost on virsh Change-Id: I0005acde1b193f2ee6593dcf97a6f3b0a0760547 --- tools/README.md | 4 +- tools/virsh_dev_env/README.md | 59 +++++++++++++ tools/virsh_dev_env/network/br_direct.xml | 6 ++ tools/virsh_dev_env/network/default.xml | 15 ++++ tools/virsh_dev_env/vm/baremetal.xml | 101 ++++++++++++++++++++++ 5 files changed, 184 insertions(+), 1 deletion(-) create mode 100644 tools/virsh_dev_env/README.md create mode 100644 tools/virsh_dev_env/network/br_direct.xml create mode 100644 tools/virsh_dev_env/network/default.xml create mode 100644 tools/virsh_dev_env/vm/baremetal.xml diff --git a/tools/README.md b/tools/README.md index ddb410968..2c1671c3f 100644 --- a/tools/README.md +++ b/tools/README.md @@ -2,4 +2,6 @@ Tools ===== This directory contains some tooling for local developer testing, such as -vagrant config files. These are not intended for production use. +vagrant config files or libvirt templates. + +These are not intended for production use. diff --git a/tools/virsh_dev_env/README.md b/tools/virsh_dev_env/README.md new file mode 100644 index 000000000..e43747ba8 --- /dev/null +++ b/tools/virsh_dev_env/README.md @@ -0,0 +1,59 @@ +Deploying with libvirt +====================== + +In order to deploy bifrost with libvirt, but managing baremetal servers, a special +network config needs to be setup. + +Two networks need to be created: +- default network, that will be a standard virtual network, using NAT. +- provisioning network, that will be used for PXE boot. As we need to setup + a dhcp server on bifrost guest, creating a virtual network will give + conflicts between guest and host. So to avoid it, we can define a + network that uses macvtap interfaces, associated with the physical + interface. + Please note that you will need to have macvlan enabled on your kernel. + +When creating the guest, a minimum of 8GB of memory is needed in order to +build disk images properly. Also when defining the interfaces for the guest, the two +networks that have been created need to be attached. + +These sample commands will spin up a bifrost vm based on centos: + +virsh net-define --file network/default.xml +virsh net-start default +virsh net-define --file network/br_direct.xml +virsh net-start br_direct +virsh define --file vm/baremetal.xml +virsh start baremetal +virsh console baremetal + +Where to get guest images +========================= +In order to create the guest VMs, you will need a cloud image +for the distro you want to deploy. You will need to download the +guest image on a directory on the host, and then in the template +for the VM, you can specify it on the disk section, as shown +in the example template. + +Please follow the information on this link to get the images: + +http://docs.openstack.org/image-guide/obtain-images.html + +Add credentials to guest image +============================== + +Normally guest images come without user and password, they rely on ssh to +allow access. In this case, it can be useful to enable ssh access to some +user from host to guest. A way to do that, is creating a config drive +and reference it on the template for the guest VM. + +A useful script to generate config drives can be found at: + +https://github.com/larsks/virt-utils/blob/master/create-config-drive + +Relying on this script, a config drive can be created with: + +create-config-drive -k ~/.ssh/id_rsa.pub config.iso + +And then this ISO can be referenced on the guest VM template. + diff --git a/tools/virsh_dev_env/network/br_direct.xml b/tools/virsh_dev_env/network/br_direct.xml new file mode 100644 index 000000000..206205859 --- /dev/null +++ b/tools/virsh_dev_env/network/br_direct.xml @@ -0,0 +1,6 @@ + + br_direct + + + + diff --git a/tools/virsh_dev_env/network/default.xml b/tools/virsh_dev_env/network/default.xml new file mode 100644 index 000000000..0d6fe9240 --- /dev/null +++ b/tools/virsh_dev_env/network/default.xml @@ -0,0 +1,15 @@ + + default + 76d95e35-3cf6-4a43-bf31-9d10717982e6 + + + + + + + + + + + + diff --git a/tools/virsh_dev_env/vm/baremetal.xml b/tools/virsh_dev_env/vm/baremetal.xml new file mode 100644 index 000000000..e995ac78b --- /dev/null +++ b/tools/virsh_dev_env/vm/baremetal.xml @@ -0,0 +1,101 @@ + + baremetal + 99714ffa-c947-4ff9-818d-ca11ee152494 + 8388608 + 8388608 + 2 + + /machine + + + + + + + Broadwell + + + + + + + destroy + restart + restart + + + + + + /usr/libexec/qemu-kvm + + + + + + +
+ + + + + + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + + + +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + system_u:object_r:svirt_image_t:s0:c71,c869 + +