Auto-scaling in OpenStack (1)

在OpenStack的架構中, Scaling是由heat project完成的,
在heat project中, 每一個由虛擬機組成的群組稱為stack,
而stack中的創建甚至動態擴充機制,
則有賴於HOT (Heat Orchestration Template) template的設定,

我們先來看一個最簡單的template範例:

heat_template_version: 2015-04-30

description: Simple template to deploy a single compute instance

resources:
  my_instance:
    type: OS::Nova::Server
    properties:
      key_name: my_key
      image: ubuntu-trusty-x86_64
      flavor: m1.small


在一個HOT template中,
首先要定義的是template的版本 (heat_template_version),
這版本所對應的日期, 並不能隨便填入,
不同日期對應到不同的heat release,
詳細版本號和對應功能的改變請參考:
http://docs.openstack.org/developer/heat/template_guide/hot_spec.html#hot-spec-template-version

在一個HOT template中, description是用來作為使用者註解的,

接著, 在resource中,
我們定義了my_instance, 作為虛擬機的樣板,
其中, 關於這台虛擬機, 我們需要以下的敘述:
key_name, image 和 flavor,

其中, key_name是用來登入的key,
image, 是用以開啟虛擬機的映像檔, 其名稱必須與glance中的名稱相同,
flavor則是開啟虛擬機的資源設定, 包括CPU, 記憶體, 硬碟等參數,
必須和nova中定義一致,

完成上述介紹後, 我們可用parameter, 和get_param的方式讓template更有架構,
parameters是指預先定義的參數, 使用以下的形式定義:
  param_name:
    type: string
    label: Label of parameter
    description:
    default: default setting

我們可以把上述template改成以下形式:

heat_template_version: 2015-04-30

description: Simple template to deploy a single compute instance

parameters:
  key_name:
    type: string
    label: Key Name
    description: Name of key-pair to be used for compute instance
    default: my_key
  image_id:
    type: string
    label: Image ID
    description: Image to be used for compute instance
    default: ubuntu-trusty-x86_64
  flavor:
    type: string
    label: Instance Type
    description: Type of instance (flavor) to be used
    default: m1.small

resources:
  my_instance:
    type: OS::Nova::Server
    properties:
      key_name: { get_param: key_name }
      image: { get_param: image_id }
      flavor: { get_param: flavor }


參考資料:
http://docs.openstack.org/developer/heat/template_guide/hello_world.html

留言

熱門文章

LTE筆記: RSRP, RSSI and RSRQ

[WiFi] WiFi 網路的識別: BSS, ESS, SSID, ESSID, BSSID

LTE筆記: 波束成型 (beamforming) 和天線陣列