OpenStack CLI
This page requires that you have already configured the command line clients as described at Command Line Access
Make sure you have latest clients
sudo pip install python-openstackclient --upgrade
Server Groups
Server groups allow you to specify set of servers which must run on the same system (affinity) or must run on different systems (anti-affinity). Generally anti-affinity is good for fault tolerance and load distribution while affinity is usefule when you want to minimize network effects between your instance.
The following example will assume you are using m1.1core
instance
type and the CSAIL-Ubuntu-16.04LTS
image but you can use any
available instance type or image
Anti-Affinity groups
-
Create the server group:
openstack server group create --policy my-distributed-group --policy anti-affinity
-
launch some number (at least 1 at most 4 in this case) VMs as members of the group, we’ll call them
my-distributed-instance
. Don’t forget to set ssh key and security groups.openstack server create --flavor m1.1core --image CSAIL-Ubuntu-16.04LTS --min 1 --max 4 --security-group default --security-group ssh-only --key-name my-ssh-keypair --hint group=antiaffinity-test my-distributed-instance
-
profit
Affinity groups
This is really exactly the same except in the first step you specify
affinity
rather than anti-affinity
-
create the server group, we’ll call it affinity-test
openstack server group create my-coresident-group --policy affinity
-
launch some number (at least 1 at most 4 in this case) VMs in it, we’ll call them
same-host
, don’t forget to set ssh key and security groupnova boot --flavor m1.1core --image CSAIL-Ubuntu-16.04LTS --min 1 --max 4 --security-group default --security-group ssh-only --key-name Jon --hint group=my-coresident-group my-coresident-instance
-
profit
Determining which physical host your VM is on
OpenStack doesn’t provide a way to get this information (well except for
cloud administrators), but because of the way we’ve configured our
physical nodes you can find out where you are running from within the VM
using
[[https://en.wikipedia.org/wiki/Link_Layer_Discovery_Protocol][lldp]]
ubuntu@vm:~$ sudo apt-get install lldpd
ubuntu@vm:~$ sudo lldpctl |grep SysName
SysName: nova-11.csail.mit.edu
note you may need to wait a minute or two after installing lldpd
before the remote system info is available.