From f930b5f7462a926205f37af59c0cc10807d3bb96 Mon Sep 17 00:00:00 2001 From: Neill Cox Date: Thu, 19 Oct 2023 16:26:55 +1100 Subject: [PATCH] :memo: Update documentation --- README.md | 30 ++++++++++++---- TODO.md | 21 +++++++++++ docs/create_aio_vm.md | 5 +++ docs/notes.md | 84 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 133 insertions(+), 7 deletions(-) create mode 100644 TODO.md create mode 100644 docs/create_aio_vm.md create mode 100644 docs/notes.md diff --git a/README.md b/README.md index f68261e..53c81e4 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,4 @@ -A quick and dirty script to help set up a RHOSP AIO - -This has grown a bit. At some point I will make this a proper readme, but for now a few notes: +A set of quick and dirty scripts to help set up a RHOSP AIO The goal is to build a VM (although you could use baremetal) and deploy a RHOSP AIO to it. Then to add a project, flavors, images, networks to support testing os-migrate. @@ -8,20 +6,38 @@ After that create a VM to migrate, a conversion host to do the migration. This may well be useful for other things, but this is the current aim. +There are/will be example scripts in the examples directory + +Everything is a bit of a mess but here's a brief overview: + +## create_aio_vm.py + +Uses virt-install to build a VM to deploy a RHOSP 16 AIO on. + I am primarily targetting RHEL8.4 and RHOSP16.2. As a result I'm tied to virt-install v3.2.0 which makes using cloud-init for configuring network on the AIO VM a little annoying. Later versions allow you to pass in a network config, but 3.2.0 means I have to use nmcli and bootcmd to get the network configure. There is a vestigial network-config.tpl in the virt-install directory but it is not actually used yet. -EVerything is a bit of a mess but here's a brief overview: +## os_migrate_setup.py -main.py - original script. Generates the yaml files and a dploy script to deploy a RHOSP AIO. Assumes a VM to run on. Don't run this on your laptop. You'll be sorry if you do. +build the OSP infrastructure to allow testing os-migrate. -os_migrate_setup.py - build the OSP infrastructure to allow testing os-migrate. +## os_migrate_teardown.py -os_migrate_teardown.py - remove that infrastructure (to allow for refinement/iteration) +remove that infrastructure (to allow for refinement/iteration) virt-install/create_aio_vm.py - use virt-install to create and configure a VM to run the other scripts on. +## prepare-deployment + +Original script. Generates the yaml files and a dploy script to deploy a RHOSP AIO. Assumes a VM to run on. Don't run this on your laptop. You'll be sorry if you do. + +## os_migrate_validate.py + +Check that the necessary infrastructure has been deployed. + +# Remember to mask and disable cloud-init if installing on a VM + ``` usage: main.py [-h] -u USERNAME -p PASSWORD -a ADDRESS [-i INTERFACE] [-m NETMASK] -d DNS [DNS ...] [-D DOMAIN] diff --git a/TODO.md b/TODO.md new file mode 100644 index 0000000..3919cfc --- /dev/null +++ b/TODO.md @@ -0,0 +1,21 @@ +# Tests + +There aren't any which. At least basic unit tests would be good. + +# Documentation + +There's a README, but it should be expanded. + +# Error handling. + +There's very litle and this is a complex process involving talking to other systems over the net. + +# Convert to Ansible + +Maybe this should all have been an ansible role. Maybe that will happen yet. + +# Ideas for specific scripts: + +## create_aio_vm + +Quite a few compromises to do with the versions of virt_install / libvirt available to me. \ No newline at end of file diff --git a/docs/create_aio_vm.md b/docs/create_aio_vm.md new file mode 100644 index 0000000..7c933a3 --- /dev/null +++ b/docs/create_aio_vm.md @@ -0,0 +1,5 @@ +# Documentation for create_aio_vm + +## Networking + +Networking has been a real pain. The RHOSP AIO deployment seems to force the vr-ctlplane interface to use dhcp. Originally I was trying to use static IPs configured with cloud-init (using bootcmd because of the version) but the deploy would die. To fix this I now speciiy MACs for the interfaces and then use an external DHCP server. Maybe this is configurable in the RHOSP standalone deploy. If so it would be better to use that. It would also be nice to do some feature switches so that if the version of virt-install allows I could use network-config instead of bootcmd \ No newline at end of file diff --git a/docs/notes.md b/docs/notes.md new file mode 100644 index 0000000..6149f3b --- /dev/null +++ b/docs/notes.md @@ -0,0 +1,84 @@ +# Installing os-migrate + +I now have two RHOSP-16.2 AIOs running on my homelab so it's time to install os-migrate. + +The intallation instructions are at: https://os-migrate.github.io/os-migrate/user/install-from-galaxy.html + +I setup a new Fedora 38 VM to run os-migrate from: + +```bash +virt-install -n os-migrate \ + --osinfo fedora37 \ + --memory 2048 \ + --vcpus 2 \ + --import \ + --disk /data/os-migrate.qcow2 \ + --graphics vnc \ + --cloud-init disable=on,clouduser-ssh-key=ncox.pub,root-password-file=rpw \ + --network bridge=br0 + ``` + + This VM is running at 172.23.0.53, on test-04(173.23.0.25) + + RHEL9 doesn't know about fedora38 + + Lots of stuffing around to get the bridge working + + ## Install and run os-miograte + +`dnf install ansible ` + +`vi os-migrate-vars.yml` + +Largely copied from the ~/.config/openstack/clouds.yaml files + + +Hints from os-migrate doco: + + +```bash +export OSM_DIR=/root/.ansible/collections/ansible_collections/os_migrate/os_migrate +export OSM_CMD="ansible-playbook -v -i $OSM_DIR/localhost_inventory.yml -e @os-migrate-vars.yml" +``` + +Despite what the os-migrate docs say, do not install python3-openstacksdk because on f38 the version is too recent. + +```bash +dnf install iputils python3-openstackclient +``` + +Let's try networks: + +```$OSM_CMD $OSM_DIR/playbooks/export_networks.yml``` + +Hmm, problems with versions. + +Going to need devel tools for openstacksdk + +``` +dnf install python3-devel +dnf group install "C Development Tools and Libraries" +``` + +We're going to need ansible-core in the venv or it will pick up system versions of things. +```bash +python3 -m venv venv +source venv/bin/activate +pip install --upgrade pip +python3 -m pip install --upgrade 'openstacksdk>=0.36,<0.99' +python3 -m pip install --upgrade 'ansible-core' +``` + + +Try again: + +``` +OSM_CMD $OSM_DIR/playbooks/export_networks.yml +``` + +```bash + 60 less os-migrate-data-test-1/clouds.yaml + 61 less os-migrate-data-test-1/networks.yml + 67 $OSM_CMD $OSM_DIR/playbooks/export_subnets.yml + 68 less os-migrate-data-test-1/subnets.yml +``` \ No newline at end of file