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: flavor

# list all flavors
openstack flavor list --sort-column Name --all

# create
openstack server create --flavor m1.small --image "Ubuntu 18.04" --nic net-id=foo-network --security-group default --key-name foo-key foo-vm1

Formated output
for FLAVOR in $(openstack flavor list --sort-column Name -c Name -f value); do
echo ${FLAVOR}
openstack flavor show ${FLAVOR}
echo
done

delete all flavors
openstack flavor list --all -c ID -f value | xargs openstack flavor delete

OpenStack: Allow user access to tanent projects

Get mgmt user data
# get user ID and domain ID
openstack user list --long -c ID -c Name -c Domain | grep foo.bar

# get projects
openstack project list --long | grep safyievOokEgavUtdytPeurmebKowEff

# get assignments
openstack role assignment list --user JekUvyeijHaDrithWianvestUtevLiUk --project e72c94c20b4d40e3b971bc510d536e87 --names

# get Domain name
openstack domain list | grep safyievOokEgavUtdytPeurmebKowEff

Search tanent data
# get user domain ID
openstack domain list | grep yrgsonova

# get user id

OpenStack: Magnum

openstack coe service list
openstack stack list
openstack stack show d8a1c3af-7993-4493-91be-19cfce38a870
openstack coe cluster update k8s-cluster replace node_count=2

Configure deployment kolla-ansible
# cat /etc/kolla/config/magnum.conf
[cinder]
default_docker_volume_type = VT1

[trust]
cluster_user_trust = True

/etc/kolla/config/heat.conf
[DEFAULT]
#region_name = ch-zh1
region_name_for_services = RegionOne

# /etc/kolla/globals.yml
# magnum_tag: "7.0.0.1"
enable_magnum: "yes"

Redeploy / Reconfigure container

OpenStack: application credentials

Create applications credentials
openstack application credential create admin --role admin --expiration $(date -I -d '+1 month')T23:59:59 -c id -c secret #-f value

Configure clouds.yml
# ~/.config/openstack/clouds.yaml
clouds:
dev-app:
auth_type: "v3applicationcredential"
auth:
auth_url: https://keystone.example.com/v3
application_credential_id: "b9275fc5b3aadceeb407fbe941427425"
application_credential_secret: "HqfdfKk3q63xrnIZgdkizePfv1s27aYPBTrbiMKFNdrOU1JpdjfR0KSyomS4A01vSdxjkE9MzPuM4dVG7emWuA"

OpenStack: Image

Deaktivate image
IMAGE_NAME="Ubuntu 14.04"
openstack image list --status active --name "${IMAGE_NAME}" -c ID -f value | xargs openstack image set --deactivate --private
openstack image list --status active

List the images
openstack image list

Delete all images
for IMAGE in $(openstack image list -c ID -f value); do
openstack image set --unprotected ${IMAGE}
openstack image delete ${IMAGE}
done

Delete image
IMAGE_NAME="Ubuntu 16.04"
openstack image set --unprotected ${IMAGE_NAME}

OpenStack: Live migrate VM to another OpenStack hypervisor

VM=foo-u1804

# list all vms on a hypervisor
openstack server list --all --host ewos1-com51-prod

# 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

Syndicate content