Sharing

2011年11月10日 星期四

iSCSI Target Management

收集一下目前可以管理 iSCSI Target 的東西,目前有使用過的

各種 Solution
比較
IET 的說明
  • A iSCSI target driver for Ethernet adapters, which tgt has used as a base for istgt

Tgt 的說明

  • Designed to work with multiple SCSI type devices and integrate them into the Linux kernel in a standard way
  • implementing a significant portion of tgt in user space while maintaining performance comparable to a target driver implemented in kernel space
  • The first author has maintained IET. The failure to push it into the mainline kernel is one of the reasons why tgt was born.

SCST 的說明
  • all the SCST components reside in kernel space



  1. 在使用上 IET 需要先設置 conf 檔案,雖然也可以用指令動態管理,但卻沒有方法更新 Conf 檔
  2. Tgt 則是全部用指令,之後再 output 設置到 conf 檔案
  3. Performance 似乎在 Kernal space 執行的  SCST 最好
  4. 根據這篇,似乎 Ubuntu 不支援 SCST,有點可惜
  5. LIO 還在開發中,但提供的介面很齊全,不管是 CLI or LIB 都有,在系統整合時應該會方便不少,但可惜它的穩定性以及開發時間都還無法滿足我的要求。


2011年11月8日 星期二

sudo with redirect syntax


執行這段時發現無法執行,看了半天才發現他可能是先執行 (sudo echo hello) 然後再導向檔案,所以就已經沒有 root 的身份

pjack@ubuntu1104-64-5:/etc/ceph/a$ sudo echo hello > tmp.txt
bash: tmp.txt: Permission denied


網路上有找到兩個解法


# 第一種
sudo sh -c "echo hello >> tmp.txt"

# 第二種
echo "hello" | sudo tee tmp.txt

2011年11月1日 星期二

Python 學習手冊第三版筆記 (七)


CH.27 例外事件基礎

with/as 環境管理器的敘述滿難懂的,感覺大部份的 with/as 都可以用 try/finally 實作完成,但好處似乎是物件可以事先把對 exception 的處理定義好,ex: 檔案碰到 exception 時會自動關閉,等到別人使用你的物件時,只要透過 with/as 就可以正確的處理 exception ,而不需要讓每個人都煩惱 "如果遇到 exception ,我是否需要去關檔?"

CH.28 例外事件物件

類別式例外事件的概念在 Java 中已發展的很完全,這讓我覺得原作者果然很懶惰 :P 所以只想用最簡單的方式來處理 Exception,不過看的出來 Python 在這部份的設計很明顯的不敷使用,也間接造成了光是 raise 就有很多種奇怪怪的寫法,書的作者也只能嘆氣囉! 這就是 Design 或是架構在一開始沒有設計好的後遺症

CH.29 例外事件的設計


>>> help(sys.exc_info)
Help on built-in function exc_info in module sys:

exc_info(...)
    exc_info() -> (type, value, traceback)
    
    Return information about the most recent exception caught by an except
    clause in the current stack frame or in an older stack frame.



>>> help(os.popen)
Help on built-in function popen in module nt:

popen(...)
    popen(command [, mode='r' [, bufsize]]) -> pipe
    
    Open a pipe to/from a command returning a file object.

>>> help(os.system)
Help on built-in function system in module nt:

system(...)
    system(command) -> exit_status
    
    Execute the command (a string) in a subshell.


PyDoc 、 PyChecker、PyUnit 好用的三大工具!


看到這裡我終於把這本書都讀完囉!