openstack

warning: Creating default object from empty value in /data/web/1/000/027/003/273448/htdocs/panticz.de/modules/taxonomy/taxonomy.pages.inc on line 33.

OpenStack: Live migrate VM to another OpenStack hypervisor

VM=foo-u1804

# list all vms on a hypervisor
openstack server list --all --status ACTIVE --host com1.example.com

# get current hypervisor
openstack server show ${VM} -c OS-EXT-SRV-ATTR:host -f value

# list avaiable hypervisors
openstack host list -c "Host Name" -c Service -f value | grep compute | cut -d" " -f1

# migrate VM
openstack server migrate ${VM} --live OS_COMPUTE_2

# get state
openstack server show ${VM} -c name -c OS-EXT-SRV-ATTR:host -c status -f value | paste - - -

# Links
https://docs.openstack.org/nova/pike/admin/live-migration-usage.html

OpenStack: Octavia LoadBalancer (LBaaS)

Create Amphora image
sudo apt install -y python-pip git qemu qemu-utils debootstrap kpartx
sudo pip install diskimage-builder
git clone https://review.openstack.org/p/openstack/octavia
cd octavia
sudo ./diskimage-create/diskimage-create.sh -d bionic -t raw
chmod a+r ./amphora-x64-haproxy.raw

Upload Amphora image
#openstack image create --container-format bare --disk-format qcow2 --private --file amphora-x64-haproxy.qcow2 --tag amphora amphora

OpenStack: Horizon

Configure start page
# /etc/kolla/horizon/custom_local_settings
# /etc/kolla/config/dev/horizon/custom_local_settings (kolla-ansible override)
HORIZON_CONFIG["user_home"] = "/project"

Links
https://docs.openstack.org/horizon/latest/contributor/ref/horizon.html
https://docs.openstack.org/mitaka/config-reference/dashboard/config-options.html

OpenStack: Cleanup project objects

# Delete VM
openstack server list --project=test-project --os-cloud=dev
openstack server delete test-project-vm

# Delete floating IP
openstack floating ip list --project=test-project --os-cloud=dev
openstack floating ip delete 1.2.3.4

# Delete router
openstack router list --project=test-project --os-cloud=dev
openstack subnet list --project=test-project --os-cloud=dev
openstack router remove subnet test-project-router test-project-subnet
openstack router delete test-project-router

# Delete subnet
openstack subnet list --project=test-project --os-cloud=dev

OpenStack: Cloud management with Ansible

Ansible OpenStack modules
https://docs.ansible.com/ansible/latest/search.html?q=os_

Ansible OpenStack module repository
https://github.com/ansible/ansible/tree/devel/lib/ansible/modules/cloud/openstack

# Fix; To utilize this module, the installed version ofthe shade library MUST be >=1.8.0
wget http://mirrors.kernel.org/ubuntu/pool/universe/p/python-shade/python-shade_1.30.0-2_all.deb -O /tmp/python-shade_1.30.0-2_all.deb
sudo dpkg -i /tmp/python-shade_1.30.0-2_all.deb

OpenStack multi cloud / user configurattion

Configure connections
# ~/.config/openstack/clouds.yaml
clouds:
admin-dev:
auth:
auth_url: http://keystone-admin.dev.example.com:35357/v3
project_name: admin
username: admin
user_domain_name: Default
project_domain_name: Default
interface: internal
foo-stage:
auth:
auth_url: http://api.stage.example.com:35357
project_name: fooproject
username: foo
user_domain_name: foodom
project_domain_name: foodom

Configure passwords
# ~/.config/openstack/secure.yaml
clouds:

OpenStack: Install OpenStack CLI client

release notes for openstack client tools
# installed
pip list | grep python-openstackclient
python-openstackclient 3.16.2

# available (for rocky release)
https://docs.openstack.org/releasenotes/python-openstackclient/rocky.html
https://github.com/openstack/python-magnumclient/releases

# install rocky client versions
pip install -U \
gnocchiclient \
"pankoclient<0.6.0" \
"python-barbicanclient<4.8.0" \
"python-cinderclient<4.0.1" \
python-cloudkittyclient \
"python-glanceclient<2.14.0" \
"python-heatclient<1.17.0" \

OpenStack: Regenerate kolla password file

OS_ENV=dev

rm /etc/kolla/passwords.yml
cp /etc/kolla/config/passwords-${OS_ENV}.yml /etc/kolla/passwords.yml

# marge new password / reorder passwords
# kolla-genpwd -p /etc/kolla/passwords.yml
# cp /etc/kolla/passwords.yml /etc/kolla/config/passwords-${OS_ENV}.yml

cat /etc/kolla/config/passwords-${OS_ENV}.yml | cut -d" " -f1 > /etc/kolla/passwords.yml
kolla-genpwd -p /etc/kolla/passwords.yml
mv /etc/kolla/passwords.yml /etc/kolla/config/passwords-${OS_ENV}.yml
ln -s /etc/kolla/config/passwords-${OS_ENV}.yml /etc/kolla/passwords.yml

Links

Bifrost / Ironic

Log
/var/log/ansible.log

Delete node
ironic node-set-provision-state ${NODE} deleted
ironic node-set-maintenance ${NODE} on
ironic node-delete ${NODE}
https://docs.openstack.org/tripleo-docs/latest/install/advanced_deployment/node_states.html

Rebuild Bifrost PXE boot image
mkdir /tmp/ansible_ubuntu
cd /tmp/ansible_ubuntu
xzcat /httpboot/ansible_ubuntu.initramfs | cpio -idmv
# apply changes
mv /httpboot/ansible_ubuntu.initramfs /httpboot/ansible_ubuntu.initramfs.$(date -I)

ironic / bifrost

# load env
. /opt/stack/bifrost/env-vars

# list nodes
ironic node-list

# remove / shutdown existing node
ironic node-set-provision-state foo.example.com deleted

# load node configuration
export BIFROST_INVENTORY_SOURCE=/opt/openstack-prepare-baremetal/bifrost/json/foo.example.com.json

# add new node
ansible-playbook -i inventory/bifrost_inventory.py enroll-dynamic.yaml
ironic node-update foo.example.com add properties/capabilities='boot_mode:uefi'

# deploy
ansible-playbook -v -i inventory/bifrost_inventory.py deploy-dynamic.yaml

# show node details

Syndicate content