Projet

Général

Profil

Openstack Management TTNN » Historique » Version 1

Version 1/140 - Suivant » - Version actuelle
Mehdi Abaakouk, 16/10/2014 12:28


Openstack Management TTNN

Opération sur les VMs

Reboot VM en error

nova reset-state --active xxx.tetaneutral.net
nova reboot --hard --poll xxx.tetaneutral.net

Agrandissement d'un disque

Sur la machine 'openstack':

root@openstack:~/tools ./os-grow-disk.sh 
usage: os-grow-disk.sh CINDER_VOLUME_ID SIZE_GB

root@openstack:~/tools# ./os-grow-disk.sh bc6f01cb-c6b6-4413-b2ef-1f7df0031049 60
Cinder:
bc6f01cb-c6b6-4413-b2ef-1f7df0031049 , test4-bootdisk | 40 -> 60

Enter YES to update
YES
Testing g3 ssh connection...
Resizing the kvm blockdevice...
Block device 'vda' is resized
Updating cinder database with the new value...
Update finish

Puis sur la VM:

Il faut avoir un 'parted' récent ou patché avec le support du 'online resizepart':

'online resizepart' est natif depuis parted >= 3.1:
  • debian >= jessie
  • ubuntu >= 14.10
'online resizepart' backporté dans:
  • ubuntu >= 13.10 < 14.10

Pour debian wheezy, utilisation les packages ubuntu de 14.04 devrait marcher
(pas encore testé, à voir si le kernel veut bien reload la table des partitions après)

 
root@test4:~# parted /dev/vda print | grep vda
Disk /dev/vda: 64.4GB

root@test4# parted /dev/vda resizepart 1 
Warning: Partition /dev/vda1 is being used. Are you sure you want to continue?
Yes/No? Yes                                                               
End?  [42.9GB]? 64.4GB   # METTRE ICI LA TAILLE VU AU DESSUS                                                 
Information: You may need to update /etc/fstab.                           

root@test4:~# resize2fs /dev/vda1
resize2fs 1.42.9 (4-Feb-2014)
Filesystem at /dev/vda1 is mounted on /; on-line resizing required
old_desc_blocks = 3, new_desc_blocks = 4
The filesystem on /dev/vda1 is now 15722400 blocks long.

root@test4:~# df -h | grep vda
/dev/vda1        60G  797M   56G   2% /

Ajout d'une interface réseau à une VM:

$ neutron net-list | grep vlan3199
| 460f49ce-f5ed-449e-9e0f-7626bcee4379 | vlan3199         | ba3f12af-074a-4a31-9a7c-a621993e13bb 192.168.99.0/24     |

$ neutron port-create 460f49ce-f5ed-449e-9e0f-7626bcee4379 --name nagios-eth2 --fixed-ips type=dict list=true ip_address=192.168.99.248
Created a new port:
+-----------------------+---------------------------------------------------------------------------------------+
| Field                 | Value                                                                                 |
+-----------------------+---------------------------------------------------------------------------------------+
| admin_state_up        | True                                                                                  |
| allowed_address_pairs |                                                                                       |
| binding:host_id       |                                                                                       |
| binding:profile       | {}                                                                                    |
| binding:vif_details   | {}                                                                                    |
| binding:vif_type      | unbound                                                                               |
| binding:vnic_type     | normal                                                                                |
| device_id             |                                                                                       |
| device_owner          |                                                                                       |
| fixed_ips             | {"subnet_id": "ba3f12af-074a-4a31-9a7c-a621993e13bb", "ip_address": "192.168.99.248"} |
| id                    | 918e0ec7-0909-423c-9a67-15b5ef7c7ae0                                                  |
| mac_address           | fa:16:3e:6b:32:07                                                                     |
| name                  | nagios-eth2                                                                           |
| network_id            | 460f49ce-f5ed-449e-9e0f-7626bcee4379                                                  |
| security_groups       | b6d5b5fb-a053-4f97-b964-9e1a12d243b1                                                  |
| status                | DOWN                                                                                  |
| tenant_id             | ed980105f9d047e2bee738b3f261f126                                                      |
+-----------------------+---------------------------------------------------------------------------------------+

$ nova interface-attach --port-id 918e0ec7-0909-423c-9a67-15b5ef7c7ae0   nagios.tetaneutral.net

Dans la VM:

$ dmesg | tail 
[ 1315.826088] virtio-pci 0000:00:06.0: using default PCI settings
[ 1315.826102] virtio-pci 0000:00:07.0: no hotplug settings from platform
[ 1315.826102] virtio-pci 0000:00:07.0: using default PCI settings
[ 1315.826116] pci 0000:00:08.0: no hotplug settings from platform
[ 1315.826117] pci 0000:00:08.0: using default PCI settings
[ 1315.826382] virtio-pci 0000:00:08.0: enabling device (0000 -> 0003)
[ 1315.829281] virtio-pci 0000:00:08.0: setting latency timer to 64
[ 1315.829535] virtio-pci 0000:00:08.0: irq 50 for MSI/MSI-X
[ 1315.829555] virtio-pci 0000:00:08.0: irq 51 for MSI/MSI-X
[ 1315.829563] virtio-pci 0000:00:08.0: irq 52 for MSI/MSI-X

$ ip l   show dev eth2
4: eth2: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT qlen 1000
    link/ether fa:16:3e:6b:32:07 brd ff:ff:ff:ff:ff:ff

$ tail -4 /etc/network/interfaces
auto eth2
iface eth2 inet static
   address 192.168.99.248
   netmask 255.255.255.0

$ ifup eth2
$ ping 192.169.99.250
PING 192.169.99.250 (192.169.99.250) 56(84) bytes of data.
64 bytes from 192.169.99.250: icmp_req=1 ttl=119 time=170 ms
64 bytes from 192.169.99.250: icmp_req=2 ttl=119 time=204 ms
^C

VM de management (nommé openstack)

Live Migration d'un host à l'autre

Cela fait tout à notre place niveau kvm/libvirt/ceph

virsh migrate --persistent --undefinesource --live --p2p openstack qemu+ssh://g2:2222/system

Recover depuis une perte de la machine hote:

Créé un fichier openstack.xml à partir d'un backup de '/etc/libvirt/qemu/openstack.xml' ou utiliser l'exemple ici: attachment:openstack.xml

Note: il faut surement viré les uuid des interfaces openvswitch qui sont différent suivant le hosts

Puis on recréé la VM

$ virsh create openstack.xml
$ virsh start openstack.xml