星期六, 8月 29, 2015

Omni_操作小記

Omni Notes

GENI 的 Slice 除了使用圖形界面來管理以外, 也有其他的工具.
Omni 就是其中之一,  使用文字界面來管理 GENI 的 Slice.

Omni Wiki

Reference


安裝 Omni 我這次是用 Mac OS 來安裝

Mac 下載頁面

Mac 安裝說明

下載之後把 Omni 解開之後複製到 Applications

為了之後下指令方便, 官方有寫了一個 aliases 的 shell script.

內容如下
$ grep  -v   ^#   /Applications/omniTools-2.9/addAliases.command

writeAliases () {
   # Append a blank last line if there isn't one already
   lastline=`tail -1 $1`
   if [ "$lastline" != "" ]; then
echo $'\n' >> $1
   fi
   echo "# Aliases for commands in the GENI omniTools-2.9 package" >> $1
   echo "alias omni='/Applications/omniTools-2.9/omni.app/Contents/MacOS/omni'" >> $1
   echo "alias stitcher='/Applications/omniTools-2.9/stitcher.app/Contents/MacOS/stitcher'" >> $1
   echo "alias omni-configure='/Applications/omniTools-2.9/omni-configure.app/Contents/MacOS/omni-configure'" >> $1
   echo "alias readyToLogin='/Applications/omniTools-2.9/readyToLogin.app/Contents/MacOS/readyToLogin'" >> $1
   echo "alias addMemberToSliceAndSlivers='/Applications/omniTools-2.9/addMemberToSliceAndSlivers.app/Contents/MacOS/addMemberToSliceAndSlivers'" >> $1
   echo "alias clear-passphrases='/Applications/omniTools-2.9/clear-passphrases.app/Contents/MacOS/clear-passphrases'" >> $1
   echo "alias remote-execute='/Applications/omniTools-2.9/remote-execute.app/Contents/MacOS/remote-execute'" >> $1
}

removeAliases () {
  sed -i".bak" '/\/Applications\/omniTools/d;/# Aliases for commands in the GENI omniTools/d' $1
}

wroteAliases=false

for rcFile in $HOME/.bash_profile $HOME/.bash_login $HOME/.profile ; do
   if [ -f $rcFile ] ; then
removeAliases $rcFile
   fi
done

for rcFile in $HOME/.bash_profile $HOME/.bash_login $HOME/.profile ; do
   if [ -f $rcFile ] ; then
       writeAliases $rcFile
       wroteAliases=true
       break
   fi
done

if ! $wroteAliases ; then
   rcFile="$HOME/.bash_profile"
   echo $rcFile
   touch $rcFile
   writeAliases $rcFile
fi

以後打指令應該不想要打絕對路徑, 就執行這個 script 吧

還沒有執行前

$ omni
-bash: omni: command not found

執行 addAliases.command
$ /Applications/omniTools-2.9/addAliases.command

開一個新的終端機

$ omni --version
omni.py: GENI Omni Command Line Aggregate Manager Tool Version 2.9
Copyright (c) 2011-2015 Raytheon BBN Technologies

設定 Omni
首先要下載必要的資訊

登入到 GENI 點選右上角的  自己名字, 然後點選  Profile

螢幕快照 2015-08-24 下午2.10.14.png

點選  Configure omni
點選  Generate an SSL certificate

螢幕快照 2015-08-24 下午2.12.35.png

會另開一個視窗來到 GENI Certificate Management 畫面
點選 Generate Combined Certificate and Key File

螢幕快照 2015-08-24 下午2.15.00.png

下載憑證還有 Key
點選 Download Your Portal Generated Certificate and Private Key

螢幕快照 2015-08-24 下午2.17.36.png

回到 Configure omni 畫面
點選 Download your omni data

螢幕快照 2015-08-24 下午2.12.35.png


在下載頁面
點選 Download your omni data

螢幕快照 2015-08-24 下午2.21.24.png

系統會下載一個 omni.bundle , 把它存到 ~/Downloads/omni.bundle

開啟終端機
先觀察  ~/.gcf 目錄
$ ls -a ~/.gcf
.              ..             agg_nick_cache

執行 omni-configure 來設定
$ omni-configure
Creating omni_config: /Users/max/.gcf/omni_config
Using portal bundle: /Users/max/Downloads/omni.bundle
SSL certificate stored at:
/Users/max/.ssl/geni_cert_portal.pem
Private SSH key stored at:
/Users/max/.ssh/geni_key_portal
Public SSH key stored at:
/Users/max/.ssh/geni_key_portal.pub
Script will create an extra public key file, based on the private key of the SSL cert:
/Users/max/.ssl/geni_cert_portal.pem
Private SSH key from your SSL cert stored at:
/Users/max/.ssh/geni_cert_portal_key
Public SSH key from your SSL cert stored at:
/Users/max/.ssh/geni_cert_portal_key.pub
Wrote omni configuration file at:
/Users/max/.gcf/omni_config

================================================================================

Omni is now configured!

To test your configuration, run:
omni -a gpo-ig getversion

執行完畢之後觀察,  有興趣可以去看 omni_config
$ ls -a ~/.gcf
.              ..             agg_nick_cache omni_config

測試 omni
$ omni  -a  gpo-ig  getversion

基本指令練習

列出目前的 slices (maxhuang 是 username)

$ omni   listmyslices   maxhuang
14:39:06 INFO    : Loading agg_nick_cache file '/Users/max/.gcf/agg_nick_cache'
14:39:06 INFO    : Loading config file '/Users/max/.gcf/omni_config'
14:39:06 INFO    : Using control framework portal
14:39:06 INFO    : Member Authority is https://ch.geni.net/MA (from config)
14:39:06 INFO    : Slice Authority is https://ch.geni.net/SA (from config)
14:39:06 INFO    : User 'maxhuang' has 1 slice(s):
urn:publicid:IDN+ch.geni.net:SDXs+slice+sakanalab
14:39:06 INFO    :  ------------------------------------------------------
14:39:06 INFO    :  Completed listmyslices:

 Options as run:
framework: portal
project: SDXs

 Args: listmyslices maxhuang

 Result Summary: Printed user maxhuang slices. Found 1 slice(s) for user 'maxhuang'.  
14:39:06 INFO    :  ======================================================

建立 slice
$ omni   createslice   sakana20150824
14:42:06 INFO    : Loading agg_nick_cache file '/Users/max/.gcf/agg_nick_cache'
14:42:06 INFO    : Loading config file '/Users/max/.gcf/omni_config'
14:42:06 INFO    : Using control framework portal
14:42:06 INFO    : Member Authority is https://ch.geni.net/MA (from config)
14:42:06 INFO    : Slice Authority is https://ch.geni.net/SA (from config)
14:42:07 INFO    : Created slice with Name sakana20150824, URN urn:publicid:IDN+ch.geni.net:SDXs+slice+sakana20150824, Expiration 2015-08-31 19:42:07+00:00
14:42:07 INFO    :  ------------------------------------------------------
14:42:07 INFO    :  Completed createslice:

 Options as run:
framework: portal
project: SDXs

 Args: createslice sakana20150824

 Result Summary: Created slice with Name sakana20150824, URN urn:publicid:IDN+ch.geni.net:SDXs+slice+sakana20150824, Expiration 2015-08-31 19:42:07+00:00
14:42:07 INFO    :  ======================================================

可以透過 omni  listmyslices 來列出 slices 確認或是到 Web 界面確認

螢幕快照 2015-08-24 下午2.43.09.png


Renew slice  (omni  renewslice slice名稱  日期)
$ omni   renewslice   sakana20150824   20150904

如果要建立 Resource ( VM / PC ), 那就要了解 RSpec 了

RSpec ( Resource Specification ) 說明可以看這邊

主要進行方式如下
rspec-types.png

利用練習的 RSpec 建立 Resource ( sakana20150824 為 slicename )
$ omni   createsliver   -a   nysernet-ig   sakana20150824 http://www.gpolab.bbn.com/experiment-support/HelloGENI/hellogeni.rspec

列出 Resource
$ omni   listresources   -a  nysernet-ig   sakana20150824

列出 Resource 狀態
$ omni   sliverstatus    -a  nysernet-ig  sakana20150824

接下來練習用自己指定的 rspec 來建立 Resource

RSpec 的取得, 簡易的方式為透過 Web 界面來取得或是下載

在Slice 界面點選 Add Resource
拖曳 VM 或是 PC
選取相關規格
點選 View Rspec 就會出現自己選的 RSpec
螢幕快照 2015-08-25 下午4.09.24.png

將這段文字儲存為 xml 或是  .rspec

測試的 RSepc 檔案 test.rspec 如下
<rspec xmlns="http://www.geni.net/resources/rspec/3" xmlns:emulab="http://www.protogeni.net/resources/rspec/ext/emulab/1" xmlns:tour="http://www.protogeni.net/resources/rspec/ext/apt-tour/1" xmlns:jacks="http://www.protogeni.net/resources/rspec/ext/jacks/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.geni.net/resources/rspec/3    http://www.geni.net/resources/rspec/3/request.xsd" type="request">
 <node xmlns="http://www.geni.net/resources/rspec/3" client_id="node-0" component_manager_id="urn:publicid:IDN+exogeni.net:slvmsite+authority+am">
   <icon xmlns="http://www.protogeni.net/resources/rspec/ext/jacks/1" url="https://portal.geni.net/images/EG-VM-noTxt-centered.svg"/>
   <routable_control_ip xmlns="http://www.protogeni.net/resources/rspec/ext/emulab/1"/>
   <sliver_type xmlns="http://www.geni.net/resources/rspec/3" name="XOLarge">
     <disk_image xmlns="http://www.geni.net/resources/rspec/3" name="http://geni-images.renci.org/images/standard/ubuntu/ub1404-v1.0.3.xml" version="2d553fdbca830020d7cf13011399d7210dcefe96"/>
   </sliver_type>
   <hardware_type xmlns="http://www.geni.net/resources/rspec/3" name="orca-vm-cloud"/>
   <services xmlns="http://www.geni.net/resources/rspec/3"/>
 </node>
</rspec>
大致上有
  • rspec
  • node
  • routable_control_ip
  • sliver_type
  • hardware_type

按照上面 omni createsliver 指令 我們還要有 -a Aggregates名稱

Aggregates 名稱可以從這個地方查

例如 我如果是要使用 StarLightExoGENI 就到他的 wiki 資訊頁面

查到他的 Aggregate Manager Common Name 為 sl-eg


嘗試使用自己選的 image 來建立 Resource
$ omni createsliver   sakana20150824 -a sl-eg https://dl.dropboxusercontent.com/u/12787647/iCAIR/GENI/test.rspec
16:20:37 INFO    : Loading agg_nick_cache file '/Users/max/.gcf/agg_nick_cache'
16:20:37 INFO    : Loading config file '/Users/max/.gcf/omni_config'
16:20:37 INFO    : Using control framework portal
16:20:37 INFO    : Member Authority is https://ch.geni.net/MA (from config)
16:20:37 INFO    : Slice Authority is https://ch.geni.net/SA (from config)
16:20:37 INFO    : Substituting AM nickname sl-eg with URL https://sl-hn.exogeni.net:11443/orca/xmlrpc, URN urn:publicid:IDN+exogeni.net:slvmsite+authority+am
16:20:38 INFO    : Slice urn:publicid:IDN+ch.geni.net:SDXs+slice+sakana20150824 expires on 2015-09-04 00:00:00 UTC
16:20:40 INFO    : Creating sliver(s) from rspec file https://dl.dropboxusercontent.com/u/12787647/iCAIR/GENI/test.rspec for slice urn:publicid:IDN+ch.geni.net:SDXs+slice+sakana20150824
16:20:44 WARNING : Failed CreateSliver for slice sakana20150824 at sl-eg.  Error from Aggregate: code 2: ERROR: duplicate slice urn urn:publicid:IDN+ch.geni.net:SDXs+slice+sakana20150824.
16:20:44 INFO    :  ------------------------------------------------------
16:20:44 INFO    :  Completed createsliver:

 Options as run:
aggregate: ['sl-eg']
framework: portal
project: SDXs

 Args: createsliver sakana20150824 https://dl.dropboxusercontent.com/u/12787647/iCAIR/GENI/test.rspec

 Result Summary: Failed CreateSliver for slice sakana20150824 at sl-eg.  Error from Aggregate: code 2: ERROR: duplicate slice urn urn:publicid:IDN+ch.geni.net:SDXs+slice+sakana20150824.
16:20:44 INFO    :  ======================================================

這個時候會失敗, 因為 GENI 的設計上面, 一個 Slice 只接受一次 createsliver 的請求
  • 也就是說如果你要建立新的 Resource 就要把舊的 delete
  • 如果一次使用兩個 Resource ( VM / PC ), 要一次設定好

那就順便練習一下刪除 Resource 吧

$ omni   deletesliver   sakana20150824  -a  sl-eg
16:24:46 INFO    : Loading agg_nick_cache file '/Users/max/.gcf/agg_nick_cache'
16:24:46 INFO    : Loading config file '/Users/max/.gcf/omni_config'
16:24:46 INFO    : Using control framework portal
16:24:46 INFO    : Member Authority is https://ch.geni.net/MA (from config)
16:24:46 INFO    : Slice Authority is https://ch.geni.net/SA (from config)
16:24:46 INFO    : Substituting AM nickname sl-eg with URL https://sl-hn.exogeni.net:11443/orca/xmlrpc, URN urn:publicid:IDN+exogeni.net:slvmsite+authority+am
16:24:47 INFO    : Slice urn:publicid:IDN+ch.geni.net:SDXs+slice+sakana20150824 expires on 2015-09-04 00:00:00 UTC
16:24:49 INFO    : Deleted sliver urn:publicid:IDN+ch.geni.net:SDXs+slice+sakana20150824 at sl-eg
16:24:49 INFO    :  ------------------------------------------------------
16:24:49 INFO    :  Completed deletesliver:

 Options as run:
aggregate: ['sl-eg']
framework: portal
project: SDXs

 Args: deletesliver sakana20150824

 Result Summary: Deleted sliver urn:publicid:IDN+ch.geni.net:SDXs+slice+sakana20150824 at sl-eg
16:24:49 INFO    :  ======================================================

刪除完畢之後驗證一下

$ omni    listresources   -a   sl-eg  sakana20150824
16:31:19 INFO    : Loading agg_nick_cache file '/Users/max/.gcf/agg_nick_cache'
16:31:19 INFO    : Loading config file '/Users/max/.gcf/omni_config'
16:31:19 INFO    : Using control framework portal
16:31:19 INFO    : Member Authority is https://ch.geni.net/MA (from config)
16:31:19 INFO    : Slice Authority is https://ch.geni.net/SA (from config)
16:31:19 INFO    : Substituting AM nickname sl-eg with URL https://sl-hn.exogeni.net:11443/orca/xmlrpc, URN urn:publicid:IDN+exogeni.net:slvmsite+authority+am
16:31:20 INFO    : Slice urn:publicid:IDN+ch.geni.net:SDXs+slice+sakana20150824 expires on 2015-09-04 00:00:00 UTC
16:31:20 INFO    : Gathering resources reserved for slice sakana20150824.
16:31:21 WARNING : No resource listing returned!
16:31:21 INFO    : Listed reserved resources on 0 out of 1 possible aggregates.
16:31:21 WARNING : No RSpec returned for slice sakana20150824 from exogeni-net-slvmsite
16:31:21 INFO    :  ------------------------------------------------------
16:31:21 INFO    :  Completed listresources:

 Options as run:
aggregate: ['sl-eg']
framework: portal
project: SDXs

 Args: listresources sakana20150824

 Result Summary: Queried resources for slice sakana20150824 from 0 of 1 aggregate(s).
No resources from AM sl-eg:  (Error from Aggregate: code 12: Invalid slice urn urn:publicid:IDN+ch.geni.net:SDXs+slice+sakana20150824.)
16:31:21 INFO    :  ======================================================

再次要求建立 Resource

$ omni   createsliver   sakana20150824  -a sl-eg https://dl.dropboxusercontent.com/u/12787647/iCAIR/GENI/test.rspec
16:33:14 INFO    : Loading agg_nick_cache file '/Users/max/.gcf/agg_nick_cache'
16:33:14 INFO    : Loading config file '/Users/max/.gcf/omni_config'
16:33:14 INFO    : Using control framework portal
16:33:14 INFO    : Member Authority is https://ch.geni.net/MA (from config)
16:33:14 INFO    : Slice Authority is https://ch.geni.net/SA (from config)
16:33:14 INFO    : Substituting AM nickname sl-eg with URL https://sl-hn.exogeni.net:11443/orca/xmlrpc, URN urn:publicid:IDN+exogeni.net:slvmsite+authority+am
16:33:14 INFO    : Slice urn:publicid:IDN+ch.geni.net:SDXs+slice+sakana20150824 expires on 2015-09-04 00:00:00 UTC
16:33:16 INFO    : Creating sliver(s) from rspec file https://dl.dropboxusercontent.com/u/12787647/iCAIR/GENI/test.rspec for slice urn:publicid:IDN+ch.geni.net:SDXs+slice+sakana20150824
16:33:23 INFO    : Got return from CreateSliver for slice sakana20150824 at sl-eg:
16:33:23 INFO    : <?xml version="1.0" ?>
16:33:23 INFO    :   <!-- Reserved resources for:
Slice: sakana20150824
at AM:
URN: urn:publicid:IDN+exogeni.net:slvmsite+authority+am
URL: https://sl-hn.exogeni.net:11443/orca/xmlrpc
-->
16:33:23 INFO    :   <rspec type="manifest" xmlns="http://www.geni.net/resources/rspec/3" xmlns:ns2="http://hpn.east.isi.edu/rspec/ext/stitch/0.1/" xmlns:ns3="http://groups.geni.net/exogeni/attachment/wiki/RspecExtensions/slice-info/1" xmlns:ns4="http://groups.geni.net/exogeni/attachment/wiki/RspecExtensions/sliver-info/1" xmlns:ns5="http://www.geni.net/resources/rspec/ext/postBootScript/1" xmlns:ns6="http://www.geni.net/resources/rspec/ext/color/2" xmlns:ns7="http://www.geni.net/resources/rspec/ext/storage/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.geni.net/resources/rspec/3 http://www.geni.net/resources/rspec/3/manifest.xsd http://hpn.east.isi.edu/rspec/ext/stitch/0.1/ http://hpn.east.isi.edu/rspec/ext/stitch/0.1/stitch-schema.xsd http://groups.geni.net/exogeni/attachment/wiki/RspecExtensions/slice-info/1 http://groups.geni.net/exogeni/attachment/wiki/RspecExtensions/slice-info/1/slice_info.xsd?format=raw http://groups.geni.net/exogeni/attachment/wiki/RspecExtensions/sliver-info/1 http://groups.geni.net/exogeni/attachment/wiki/RspecExtensions/sliver-info/1/sliver_info.xsd?format=raw http://www.geni.net/resources/rspec/ext/postBootScript/1 http://www.geni.net/resources/rspec/ext/postBootScript/1/request.xsd http://www.geni.net/resources/rspec/ext/color/2 http://www.geni.net/resources/rspec/ext/color/2/color.xsdhttp://www.geni.net/resources/rspec/ext/storage/1 http://www.geni.net/resources/rspec/ext/storage/1/storage.xsd">  
     <node client_id="node-0" component_id="urn:publicid:IDN+exogeni.net:slvmsite+node+orca-vm-cloud" component_manager_id="urn:publicid:IDN+exogeni.net:slvmsite+authority+am" component_name="orca-vm-cloud" exclusive="false" sliver_id="urn:publicid:IDN+exogeni.net:slvmsite+sliver+14785705-276f-455a-8d41-ecd7feace2af:node-0">    
           <location country="unknown" latitude="42.05286" longitude="-87.681564"/>    
           <sliver_type name="xo.large">      
                 <disk_image name="http://geni-images.renci.org/images/standard/ubuntu/ub1404-v1.0.3.xml" version="2d553fdbca830020d7cf13011399d7210dcefe96"/>      
           </sliver_type>    
           <services/>    
           <ns4:geni_sliver_info creation_time="2015-08-25T21:33:18.000Z" creator_urn="max-huang@northwestern.edu, urn:publicid:IDN+ch.geni.net+user+maxhuang" expiration_time="2015-09-04T00:00:00.000Z" start_time="2015-08-25T21:33:18.000Z" state="configuring"/>    
     </node>  
     <ns3:geni_slice_info state="configuring" urn="urn:publicid:IDN+ch.geni.net:SDXs+slice+sakana20150824" uuid="ec660c50-19c1-4fa1-9394-7c908b1b6038"/>  
</rspec>
16:33:23 INFO    :  ------------------------------------------------------
16:33:23 INFO    :  Completed createsliver:

 Options as run:
aggregate: ['sl-eg']
framework: portal
project: SDXs

 Args: createsliver sakana20150824 https://dl.dropboxusercontent.com/u/12787647/iCAIR/GENI/test.rspec

 Result Summary: Got Reserved resources RSpec from exogeni-net-slvmsite
16:33:23 INFO    :  ======================================================



那如果是一次建立兩個 Resources 呢

測試的 RSepc 檔案 test2.rspec 如下

<rspec xmlns="http://www.geni.net/resources/rspec/3" xmlns:emulab="http://www.protogeni.net/resources/rspec/ext/emulab/1" xmlns:tour="http://www.protogeni.net/resources/rspec/ext/apt-tour/1" xmlns:jacks="http://www.protogeni.net/resources/rspec/ext/jacks/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.geni.net/resources/rspec/3    http://www.geni.net/resources/rspec/3/request.xsd" type="request">
 <node xmlns="http://www.geni.net/resources/rspec/3" client_id="node-0" component_manager_id="urn:publicid:IDN+exogeni.net:slvmsite+authority+am">
   <icon xmlns="http://www.protogeni.net/resources/rspec/ext/jacks/1" url="https://portal.geni.net/images/EG-VM-noTxt-centered.svg"/>
   <routable_control_ip xmlns="http://www.protogeni.net/resources/rspec/ext/emulab/1"/>
   <sliver_type xmlns="http://www.geni.net/resources/rspec/3" name="XOLarge">
     <disk_image xmlns="http://www.geni.net/resources/rspec/3" name="http://geni-images.renci.org/images/standard/ubuntu/ub1404-v1.0.3.xml" version="2d553fdbca830020d7cf13011399d7210dcefe96"/>
   </sliver_type>
   <hardware_type xmlns="http://www.geni.net/resources/rspec/3" name="orca-vm-cloud"/>
   <services xmlns="http://www.geni.net/resources/rspec/3"/>
 </node>
 <node xmlns="http://www.geni.net/resources/rspec/3" client_id="node-1" component_manager_id="urn:publicid:IDN+exogeni.net:slvmsite+authority+am">
   <icon xmlns="http://www.protogeni.net/resources/rspec/ext/jacks/1" url="https://portal.geni.net/images/EG-VM-noTxt-centered.svg"/>
   <routable_control_ip xmlns="http://www.protogeni.net/resources/rspec/ext/emulab/1"/>
   <sliver_type xmlns="http://www.geni.net/resources/rspec/3" name="XOLarge">
     <disk_image xmlns="http://www.geni.net/resources/rspec/3" name="http://geni-images.renci.org/images/standard/ubuntu/ub1404-v1.0.3.xml" version="2d553fdbca830020d7cf13011399d7210dcefe96"/>
   </sliver_type>
   <hardware_type xmlns="http://www.geni.net/resources/rspec/3" name="orca-vm-cloud"/>
   <services xmlns="http://www.geni.net/resources/rspec/3"/>
 </node>
</rspec>

主要就是多一個 node 的描述
也可以參考 vimdiff 的結果

螢幕快照 2015-08-25 下午4.46.17.png

這樣就可以進行基本的 Omni 操作了

沒有留言: