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

  1. Create the server group:

    openstack server group create --policy my-distributed-group --policy anti-affinity
  2. 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
  3. profit

  • If your project has multiple networks you will need to specify the network id (unfortunately you need the id not the name). For the default public inet network you would add --nic net-id=0a1d0a27-cffa-4de3-92c5-9d3fd3f2e74d to the openstack command flags.

  • Affinity groups

    This is really exactly the same except in the first step you specify affinity rather than anti-affinity

    1. create the server group, we’ll call it affinity-test

      openstack server group create my-coresident-group --policy affinity
    2. 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 group

       nova 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
    3. profit

  • If your project has multiple networks you will need ot specify the netowrk id (unfortuantely you need the id not the name) for the default public inet network you would add --nic net-id=0a1d0a27-cffa-4de3-92c5-9d3fd3f2e74d to the openstack command flags.

  • 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.