Commandes

Ansible Collection

ansible-galaxy collection install git+https://opendev.org/openstack/ansible-collections-openstack.git

CLI

pip install python-openstackclient

Images

Lister et afficher les images :

openstack image list
openstack image show debian-11-genericcloud-arm64_2022-09-11

Creer une image Debian :

wget http://cloud.debian.org/images/cloud/bullseye/latest/debian-11-genericcloud-amd64.qcow2
openstack image create --disk-format qcow2 --container-format bare --public --file debian-11-genericcloud-amd64.qcow2  debian-11-genericcloud-amd64_2022-09-11

Instances

Resizer une instance (downtime). Pour limiter le downtime il faut désactiver le service compute de tous les hyperviseurs sauf celui sur lequel se trouve l’instance à redimensionner (https://os1.pkgdata.net/admin/hypervisors/).

openstack --os-cloud teoxane flavor list
openstack --os-cloud teoxane server resize --flavor cpu4-ram8-disk50 os203-live8 --wait
openstack --os-cloud teoxane server resize confirm os203-live8

Déplacer un volume vers un autre host

openstack --os-cloud colas server stop os1001
openstack --os-cloud colas server remove volume os1001 os1001-home
openstack --os-cloud admin volume migrate --host hn006.pkgdata.net@lvm#LVM_iSCSI os1001-home
openstack --os-cloud admin volume show caaf2838-a8c4-4d73-9b9c-6fde4cb42339
openstack --os-cloud colas server add volume os1001 os1001-home
openstack --os-cloud colas server start os1001

Augmenter la taile d’un volume

Sur on002 :

. burgerking-openrc.sh
cinder list
cinder extend <volume> 100

Se connecter sur la VM :

resize2fs /dev/sdb

NE PAS OUBLIER DE COMMITER LA NOUVELLE TAILLE SUR TERRAFORM

Troubleshooting

LXC qui ne démarre pas

lxc-start -n infra1_horizon_container-280bb506 -l DEBUG --logfile=test-lxc.log --logpriority=9
lxc-start: infra1_horizon_container-280bb506: lxccontainer.c: wait_on_daemonized_start: 859 Received container state "ABORTING" instead of "RUNNING"
lxc-start: infra1_horizon_container-280bb506: tools/lxc_start.c: main: 308 The container failed to start
lxc-start: infra1_horizon_container-280bb506: tools/lxc_start.c: main: 311 To get more details, run the container in foreground mode
lxc-start: infra1_horizon_container-280bb506: tools/lxc_start.c: main: 313 Additional information can be obtained by setting the --logfile and --logpriority options

cat test-lxc.log
lxc-start infra1_horizon_container-280bb506 20221010123856.771 ERROR    network - network.c:lxc_ovs_attach_bridge:2377 - Failed to attach "280bb506_eth1" to openvswitch bridge "br-mgmt": ovs-vsctl: cannot create a port named 280bb506_eth1 because a port named 280bb506_eth1 already exists on bridge br-mgmt

Basculer la passerelle SNAT sur un autre compute

switch-l3-host.sh hn004.pkgdata.net

Configuration VRRP (cf. https://medium.com/@nuriel_25979/virtual-ip-with-openstack-neutron-dd9378a48bdf)

Note : Ne fonctionne pas en mode DVR / DVR_SNAT car l’IP floating n’est pas vraiment associée. Du coup tout le traffic passe par le network node (SNAT).

openstack --os-cloud teoxane port create vrrp_ip_floating1 --network private-network1 --no-security-group --fixed-ip subnet=private-subnet1,ip-address=192.168.100.100

openstack --os-cloud admin floating ip create --project teoxane public-network1 --floating-ip-address 168.119.18.171 --fixed-ip-address 192.168.100.100 --port $(openstack --os-cloud teoxane port list --name vrrp_ip_floating1 --column ID --format value) --description "IP publique Teoxane / Associé à vrrp_ip_floating1"
openstack --os-cloud teoxane security group create --description '[PRIVATE] VRRP from proxy' private-vrrp
openstack --os-cloud teoxane security group rule delete $(openstack --os-cloud teoxane security group rule list private-vrrp --egress --column ID --format value | xargs)
openstack --os-cloud teoxane security group rule create private-vrrp --protocol 112 --remote-group private-vrrp
openstack --os-cloud teoxane server create os201 --availability-zone fsn1-dc7 --flavor cpu1-ram2-disk10 --image debian-11-genericcloud-amd64_2022-09-11 --network private-network1 --security-group default --security-group private-vrrp --security-group public-haproxy --security-group private-haproxy-peers --security-group public-ssh --security-group private-letsencrypt --key-name remi --property keepalived_role=master --property vrrp_ip_floating=192.168.100.100 --user-data user-data/vrrp_init.sh

Debug journal LXC

journactl -f -m