OpenStack Advanced Topics

_images/openwest.gif

Spencer Krum, IBM

July 13th, 2016

@nibalizer

Note

  • Who am I
  • What do I work on
  • github
  • This talk is my version of an introduction to openstack
  • demystify
  • objective truths
  • no vendor pitch
  • i want you to know the words when openstack is being discussed
  • I'll also show you how to use it

Portland

_images/mt_hood.jpg

_images/openstack-cloud-software-vertical-large.png

Agenda

Ancillary Services

Who Am I?

Note

  • Sysop
  • PSU
  • Work at IBM
  • I build the infrastructure that tests openstack, jenkins, code hosting
  • Access to a good half dozen clouds
  • boot nodes all the time
  • Working at IBM to deploy a cloud

OpenStack Mission Statement

To produce a ubiquitous Open Source Cloud Computing platform that is
easy to use, simple to implement, interoperable between deployments,
works well at all scales, and meets the needs of users and operators of
both public and private clouds.

Basic Things you can ask an OpenStack to do

DevStack

People say to me: "Spencer, i tried to install openstack and i couldn't"

Enter DevStack

DIB: Disk Image Builder

Less Basic things you can ask an OpenStack to do

What is OpenStack

Note

  • Python daemon that takes in rest api and then causes other things to happen
  • Some kind of a programmable thing that does stuff that datacenter techs used to do
  • Tickets!
  • Ticket to get a vm
  • Rest API to get a vm
  • Apache 2

What OpenStack is Not

Note

  • Xen, Kvm, Virtualbox, Vmware these are hypervisors
  • Amazon web services, its not that and its not compatible
  • Eucalyptus

Definitions

Note

  • a subnet is l3
  • a network is l2

The Four Opens

Note

  • Not Open Core, Apache2
  • Design is open and open to contributors
  • The development is done in the open with open tooling
  • The discussion and voting and technical direction is all transparent
  • Lazy consensus
  • There is a CoC

History

Note

  • I started working on it in 2014

Fast Facts

Note

  • openstack development is freaking huge

Primary Services

Iaas UX

Note

  • OpenStack has a UX Team
  • What is cloud ux

_images/horizon_1.png

_images/horizon_2.png

CLI: Env Vars

_images/env-vars.gif

CLI: List Machines

_images/nova-list.gif

CLI: Show Machine

_images/nova-show.gif

CLI: Create Machine

_images/nova-boot.gif

CLI: Destroy Machine

_images/nova-delete.gif

CLI: Future

_images/openstack-server-list.gif

CLI: Recap

Upload a new image

nova list
nova boot
openstack server list
openstack server create
openstack flavor list
openstack image list

CLI: Advanced

Upload a new image

openstack image create --disk-format qcow2 \
--container-format bare --file mynixosimg.qcow nixos

CLI: Advanced

Upload a file to swift

openstack conatiner create test1
openstack object create test1 mypicture.png

Deployment: List Hosts

$ ansible all -i openstack.py  --list-hosts
  hosts (1):
    cacti-hodor-dfc7a021-3d50-4c3c-8082-a0aecb6d3878

Note

  • Demo This

Deployment: Playbook

---
  - name: Foo
    hosts: localhost
    connection: local
    vars:
      FLAVOR: '8GB Standard Instance'
      IMAGE_NAME: 'Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)'
      KEY_NAME: nibz
    tasks:
      - name: create instances
        os_server:
          name: "{{ item }}"
          image: "{{ IMAGE_NAME }}"
          key_name: "{{ KEY_NAME }}"
          wait: yes
          timeout: 200
          flavor: "{{ FLAVOR }}"
        with_items:
          - foo
          - bar
          - baz

Deployment: Boot Many Machines

$: ansible-playbook -i openstack.py ansible_machines.yml

PLAY [Foo] *********************************************************************

TASK [setup] *******************************************************************
ok: [localhost]

TASK [create instances] ********************************************************
changed: [localhost] => (item=foo)
changed: [localhost] => (item=bar)
changed: [localhost] => (item=baz)

PLAY RECAP *********************************************************************
localhost                  : ok=2    changed=1    unreachable=0    failed=0

Note

  • Demo This

Deployment: Results

$: ansible all -i openstack.py --list-hosts
  hosts (5):
    twitch-hodor-4b73cb8d-d2b2-4dc6-a533-486d816e45f1
    bar
    foo
    baz
    cacti-hodor-dfc7a021-3d50-4c3c-8082-a0aecb6d3878

Deployment: Terraform

Note

  • Demo!

Deployment: Terraform

# Configure the OpenStack Provider
provider "openstack" {
    user_name  = "${var.user_name}"
    tenant_name = "${var.tenant_name}"
    password  = "${var.password}"
    auth_url  = "${var.auth_url}"
}

Deployment: Terraform

resource "openstack_compute_instance_v2" "basic" {
  name = "texas-linux-fest"
  image_id = "e45c00df-b189-414c-b82c-0917cd8a464d"
  flavor_id = "small"
  key_pair = "${var.key_pair_name}"
  security_groups = ["default"]

  network {
    name = "external"
  }

}

Deployment: Terraform

resource "openstack_blockstorage_volume_v1" "myvol" {
  name = "myvol"
  size = 5
}

Deployment: Terraform

resource "openstack_compute_instance_v2" "basic" {
  name = "texas-linux-fest"
  image_id = "e45c00df-b189-414c-b82c-0917cd8a464d"
  flavor_id = "small"
  key_pair = "${var.key_pair_name}"
  security_groups = ["default"]

  network {
    name = "external"
  }
  volume {
    volume_id = "${openstack_blockstorage_volume_v1.myvol.id}"
  }

}

Library: Shade

Library: OpenStack Client Config

clouds:
  mordred:
    profile: hp
    auth:
      username: mordred@inaugust.com
      password: XXXXXXXXX
      project_name: mordred@inaugust.com
    region_name: region-b.geo-1
    dns_service_type: hpext:dns
    compute_api_version: 1.1
  monty:
    auth:
      auth_url: https://region-b.geo-1.identity.hpcloudsvc.com:35357/v2.0
      username: monty.taylor@hp.com
      password: XXXXXXXX
      project_name: monty.taylor@hp.com-default-tenant
    region_name: region-b.geo-1
    dns_service_type: hpext:dns

Library: Shade usage

cloudname = sys.argv[1]
cloud = shade.openstack_cloud(name=cloudname)
image = filter_images('trusty', cloud.list_images())
server_name = human_name + "-hodor-" + str(uuid.uuid4())

cloud.create_server(server_name, image['id'], flavor['id'], key_name=key[0]['id'])

Library: Shade

Further Services

Manilla

Barbican

Desginate

Desginate

DNS_DOMAIN_ID=9609dad3-fc98-451f-9bfc-0978be5733c5

designate --os-endpoint  \
https://region-a.geo-1.dns.hpcloudsvc.com/v1/  \
record-list 9609dad3-fc98-451f-9bfc-0978be5733c5

Magnum

Magnum

magnum bay-create --name k8s_bay --baymodel kubernetes --node-count 2

Magnum

Database Investigation

$: nova hypervisor-list
+----+---------------------+-------+---------+
| ID | Hypervisor hostname | State | Status  |
+----+---------------------+-------+---------+
| 1  | osat-00             | up    | enabled |
+----+---------------------+-------+---------+

mysql> select id,created_at,host,uuid from compute_nodes;
+----+---------------------+---------+--------------------------------------+
| id | created_at          | host    | uuid                                 |
+----+---------------------+---------+--------------------------------------+
|  1 | 2016-04-21 22:57:02 | osat-00 | 90dd1911-55da-417b-955f-8412b6405043 |
+----+---------------------+---------+--------------------------------------+

Database Investigation

$: openstack server list
+--------------------------------------+------+--------+------------------+
| ID                                   | Name | Status | Networks         |
+--------------------------------------+------+--------+------------------+
| 4b9c6d10-adbe-476a-ada8-fd74b4ba14f5 | derp | ACTIVE | private=10.0.0.2 |
+--------------------------------------+------+--------+------------------+


mysql> select created_at,id,display_name,node from instances;
+---------------------+----+--------------+---------+
| created_at          | id | display_name | node    |
+---------------------+----+--------------+---------+
| 2016-04-21 23:25:47 |  1 | derp         | osat-00 |
+---------------------+----+--------------+---------+

Rabbit Poking

root@osat-00:~# rabbitmqctl list_queues

Listing queues ...
cinder-scheduler0
cinder-scheduler.osat-000
cinder-scheduler_fanout_e047d94558b54154814054311e76417e0
cinder-volume0
cinder-volume.osat-00@lvmdriver-100
cinder-volume_fanout_756d498d0c9f4f409c2db54f71e6f19e0
compute_nodes0
compute.osat-000
compute_fanout_2369c871bbd745ed993afaf8311926770
conductor0
conductor.osat-0000
conductor_fanout_442efef3b5a5471bbb91f36fe18afbea0
conductor_fanout_97a06467f07d4a26a3dccf5112a94fb30
consoleauth0
consoleauth.osat-00000
consoleauth_fanout_2b3e4c3f17fa424caef5b1ffc2ae5aba0
Networks0
network.osat-000000
network_fanout_4c3fcd09064e4503ba717080f7bd45ff0
reply_48397d82474d45568675f3b68b054f840
reply_9e1f6ca491e74195a12b8acdaa6bea030
reply_cfecefe6614b4a299a1c38d41b57e9170
reply_ff1ca09e486349198cbe497df90b00b30
scheduler_fanout_e047d94558b54154814054311e76417e00
scheduler.osat-0000000
scheduler_fanout_2c5743eaed1a4a608794b19bfecce42e0
...done.

Grab a specific queue

./rabbitmqadmin get queue=compute.osat-00 > file

...  "task_state": "deleting", "shutdown_terminate": false, ...
"task_state": "deleting"

Note

  • i had to stop nova-compute in order to get the queue to actually fill up enough to look at an element in it
  • The blob you get looks like a database entry.then there is escaped json containing more escaped json
  • start and stopping nova-compute causes things to queue then they start again when nova compute runs again

SoapBox

Flavors, images, networks, regions

If you want to boot a vm you need to know all 4 of these things The problem is every cloud is different

Consistent flavor names and image names, and network names would make it easier Standards things

Bifrost

References

References (cont)

References

Thank You + Questions

_images/spencer_face.jpg

Spencer Krum

IBM

@nibalizer

nibz@spencerkrum.com

https://github.com/nibalizer/talk-openstack-advanced-topics