This page requires that you have already configured the commandline clients as described at OpenStack#Command_line_access

This is a work in progress if you find interesting CLI use cases pleas add them here:

Make sure you have latest clients

On Ubuntu systems you can add the official cloudarchive repository to track the latest OpenStack packages (including clients), for the currently version:

sudo add-apt-repository cloud-archive:kilo

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-14.04LTS image but you can use any available instance type or image

Anti-Afinity groups

  1. create the server group, we'll call it antiafinity-test
    nova server-group-create antiafinity-test anti-affinity
  2. launch some number (at least 1 at most 4 in this case) VMs in it, we'll call them different-host, don't forget to set ssh key and security groups
     nova boot --flavor m1.1core --image CSAIL-Ubuntu-14.04LTS --min-count 1 --max-count 4 --security-groups default,ssh-only --key-name Jon --hint group=antiafinity-test  different-host
  3. profit

note 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 nova command flags.

note2 if you have an older nova it may not support the --min-count and --max-count flags, if that is the case you'll need to use the --num-instances flag to request a specific number of instances.

Afinity groups

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

  1. create the server group, we'll call it afinity-test
    nova server-group-create afinity-test 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 groups
     nova boot --flavor m1.1core --image CSAIL-Ubuntu-14.04LTS --min-count 1 --max-count 4 --security-groups default,ssh-only --key-name Jon --hint group=afinity-test  same-host
  3. profit

note 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 nova command flags.

note2 if you have an older nova it may not support the --min-count and --max-count flags, if that is the case you'll need to use the --num-instances flag to request a specific number of instances.

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

-- JonProulx - 19 Jun 2015
Topic revision: 19 Jun 2015, JonProulx
 

MIT Computer Science and Artificial Intelligence Laboratory

 

  • About CSAIL
  • Research
  • News + Events
  • Resources
  • People

This site is powered by Foswiki MIT: Massachusetts Institute of Technology