wiki:Haizea_sim

Version 7 (modified by rock, 15 years ago) (diff)

--

Unattended Simulated Mode


【0.架構】

  • Haizea Configuration File - 一個文字檔包含一些選項
  • Request Tracefile - 一個文字檔包含了租約的需求

【1.配置】

【1.1 Haizea Configuration File】

從上圖架構知道,要使用 Haiea 的第一步便是要撰寫一篇好的 Haizea Configuration File,官方文件說可以參考範例檔 /usr/share/haizea/etc/sample_trace.conf 和 sample_trace_barebones (兩個文件內容一樣,只差再第2份沒註解),文檔中要注意的地方是 option 的設定和配置
  • 以下面範例來解說 option,便是『模擬』 2006-11-25 下午1點開始執行任務在 4台有1顆CPU 和1G Ram 的機器上執行 ([simulation]->屬性名稱,startime、resources->屬性細部設定)
    [simulation]
    starttime: 2006-11-25 13:00:00
    resources: 4  CPU:100 Memory:1024
    
  • 參考的屬性值


【1.2 Tracefile File】

而 Tracefile 便是在 Haizea Configuration File 中的 [tracefile] 屬性指定
[tracefile]
tracefile: /usr/share/haizea/traces/sample.lwf
  • 此 Tracefile 範例檔的格式為 LWF/Lease Workload Format (類似 XML 的格式)
    <lease-workload name="sample">
      <description>
      A simple trace where an AR lease preempts a 
      best-effort lease that is already running. 
      </description>
    
      <lease-requests>
      
      <!-- The lease requests are initially commented out -->
      
      <!-- First lease request -->
      <!--
      ...
      -->
    
      <!-- Second lease request -->
      <!--
      ...
      -->
      
      </lease-requests>
    </lease-workload>
    
  • XML 格式參考

【2.開始模擬】

現在我們使用已寫好的範例 configuration(sample_trace.conf) 和 tracefile(sample.lwf),便可透過haizea 指令開始執行模擬 (參數 -c 為指定設定檔)

【2.1 範例一】

haizea -c /usr/share/haizea/etc/sample_trace.conf
[2006-11-25 13:00:00.00] RM      Starting resource manager
[2006-11-25 13:00:00.00] TFILE   Loading tracefile /usr/share/haizea/traces/sample.lwf
[2006-11-25 13:00:00.00] TFILE   Loaded workload with 0 requests ()
[2006-11-25 13:00:00.00] CLOCK   Starting simulated clock
[2006-11-25 13:00:00.00] CLOCK   Simulated clock has stopped
[2006-11-25 13:00:00.00] RM      Stopping resource manager gracefully...
[2006-11-25 13:00:00.00] RM      --- Haizea status summary ---
[2006-11-25 13:00:00.00] RM      Number of leases (not including completed): 0
[2006-11-25 13:00:00.00] RM      Completed leases: 0
[2006-11-25 13:00:00.00] RM      ---- End summary ----

  • 此結果輸出主要有三類:RM(Resource Manager)、TFILE(TraceFile)、CLOCK
    • RM Starting resource manager:啟動資源管理者
    • TFILE Loading tracefile /usr/share/haizea/traces/sample.lwf:載入 tracefile
    • TFILE Loaded workload with 0 requests ():此範例檔並無租約要求
    • CLOCK Starting simulated clock:開始模擬的 clock
    • CLOCK Simulated clock has stopped:停止模擬的 clock

【2.2 範例一之版本1】

  • 現在我們修改 TraceFile (將註解的第18行和第34行打開)
    19         <lease-request arrival="00:00:00">
    20         <lease preemptible="true">
    21                 <nodes>
    22                         <node-set numnodes="1">
    23                                 <res type="CPU" amount="100"/>
    24                                 <res type="Memory" amount="1024"/>
    25                         </node-set>
    26                 </nodes>        
    27                 <start></start>
    28                 <duration time="01:00:00"/>
    29         <software>
    30           <disk-image id="foobar.img" size="1024"/>
    31         </software>
    32         </lease>
    33         </lease-request>
    
  • 再執行它
    haizea -c /usr/share/haizea/etc/sample_trace.conf
    [2006-11-25 13:00:00.00] RM      Starting resource manager
    [2006-11-25 13:00:00.00] TFILE   Loading tracefile /usr/share/haizea/traces/sample.lwf
    [2006-11-25 13:00:00.00] TFILE   Loaded workload with 1 requests (1 Best-effort)
    [2006-11-25 13:00:00.00] CLOCK   Starting simulated clock
    [2006-11-25 13:00:00.00] LSCHED  Lease #1 has been requested.
    [2006-11-25 13:00:00.00] LSCHED  Lease #1 has been marked as pending.
    [2006-11-25 13:00:00.00] LSCHED  Queued best-effort lease request #1, 1 nodes for 01:00:00.00.
    [2006-11-25 13:00:00.00] LSCHED  Next request in the queue is lease 1. Attempting to schedule...
    [2006-11-25 13:00:00.00] VMSCHED Lease #1 has been scheduled on nodes [1] from 2006-11-25 13:00:00.00 to 2006-11-25 14:00:00.00
    [2006-11-25 13:00:00.00] VMSCHED Started VMs for lease 1 on nodes [1]
    [2006-11-25 14:00:00.00] VMSCHED Stopped VMs for lease 1 on nodes [1]
    [2006-11-25 14:00:00.00] VMSCHED Lease 1's VMs have shutdown.
    [2006-11-25 14:00:00.00] CLOCK   Simulated clock has stopped
    [2006-11-25 14:00:00.00] RM      Stopping resource manager gracefully...
    [2006-11-25 14:00:00.00] RM      --- Haizea status summary ---
    [2006-11-25 14:00:00.00] RM      Number of leases (not including completed): 0
    [2006-11-25 14:00:00.00] RM      Completed leases: 1
    [2006-11-25 14:00:00.00] RM      ---- End summary ----
    
  • 兩個 CLOCK 之間多了LSCHED(租約排程) 和 VMSCHED(VM排程)
    • LSCHED Lease #1 has been requested.
    • LSCHED Lease #1 has been marked as pending.
    • LSCHED Queued best-effort lease request #1, 1 nodes for 01:00:00.00.
    • LSCHED Next request in the queue is lease 1. Attempting to schedule...
    • VMSCHED Lease #1 has been scheduled on nodes [1] from 2006-11-25 13:00:00.00 to 2006-11-25 14:00:00.00
    • VMSCHED Started VMs for lease 1 on nodes [1]
    • VMSCHED Stopped VMs for lease 1 on nodes [1]
    • VMSCHED Lease 1's VMs have shutdown.

【2.2 範例一之版本2】

  • 繼續修改 TraceFile (再把註解的第37行和第55行打開)
    38         <lease-request arrival="00:15:00">
    39         <lease preemptible="false">
    40                 <nodes>
    41                         <node-set numnodes="4">
    42                                 <res type="CPU" amount="100"/>
    43                                 <res type="Memory" amount="1024"/>
    44                         </node-set>
    45                 </nodes>        
    46                 <start>
    47                         <exact time="00:30:00"/>
    48                 </start>
    49                 <duration time="00:30:00"/>
    50         <software>
    51           <disk-image id="foobar.img" size="1024"/>
    52         </software>
    53         </lease>
    54         </lease-request>
    


Attachments (2)

Download all attachments as: .zip